Fix IE design. Refs #263

This commit is contained in:
Pavel Chipiga 2012-03-30 01:51:39 +03:00
parent 5aca4a0ea9
commit 1f57d88957
4 changed files with 80 additions and 51 deletions

View File

@ -5,6 +5,8 @@
%title= choose_title %title= choose_title
= stylesheet_link_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css', :media => 'screen, projection' = stylesheet_link_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css', :media => 'screen, projection'
= stylesheet_link_tag "application" = stylesheet_link_tag "application"
/[if lt IE 9]
= javascript_include_tag 'http://html5shiv.googlecode.com/svn/trunk/html5.js'
= javascript_include_tag "application" = javascript_include_tag "application"
= csrf_meta_tag = csrf_meta_tag
@ -18,6 +20,7 @@
= render :partial => 'layouts/menu/top', :locals => {:which_menu => 'top_menu'} = render :partial => 'layouts/menu/top', :locals => {:which_menu => 'top_menu'}
.information .information
= render 'search/form' = render 'search/form'
- if current_user
.user .user
.avatar= image_tag avatar_url(current_user), :alt => 'avatar', :height => "30" .avatar= image_tag avatar_url(current_user), :alt => 'avatar', :height => "30"
.profile .profile
@ -31,6 +34,9 @@
.a= link_to current_user.uname, current_user .a= link_to current_user.uname, current_user
.a= link_to t('layout.settings.label'), edit_profile_path .a= link_to t('layout.settings.label'), edit_profile_path
.a= link_to t('layout.logout'), destroy_user_session_path, :method => :delete .a= link_to t('layout.logout'), destroy_user_session_path, :method => :delete
- else
.user
.profile= link_to t("layout.devise.shared_links.sign_in"), new_user_session_path
.right .right
.both .both
- if content_for?(:submenu) - if content_for?(:submenu)

View File

@ -7,8 +7,10 @@
= stylesheet_link_tag "login" = stylesheet_link_tag "login"
- elsif ['registrations', 'passwords'].include?(controller_name) && ['new', 'create', 'edit', 'update'].include?(action_name) - elsif ['registrations', 'passwords'].include?(controller_name) && ['new', 'create', 'edit', 'update'].include?(action_name)
= stylesheet_link_tag "reg_session" = stylesheet_link_tag "reg_session"
= csrf_meta_tag /[if lt IE 9]
= javascript_include_tag 'http://html5shiv.googlecode.com/svn/trunk/html5.js'
= javascript_include_tag "login" = javascript_include_tag "login"
= csrf_meta_tag
%body %body
-# render :partial => "layouts/flashes" -# render :partial => "layouts/flashes"

View File

@ -1,11 +1,14 @@
/*! HTML5 Shiv v3.3RC1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ /*! HTML5 Shiv vpre3.5 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */
;(function(window, document) { ;(function(window, document) {
/** Preset options */ /** Preset options */
var options = window.html5 || {}; var options = window.html5 || {};
/** Used to skip problem elements */ /** Used to skip problem elements */
var reSkip = /^<|^(?:button|iframe|input|script|textarea)$/i; var reSkip = /^<|^(?:button|form|map|select|textarea|object|iframe)$/i;
/** Not all elements can be cloned in IE (this list can be shortend) **/
var saveClones = /^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i;
/** Detect whether the browser supports default html5 styles */ /** Detect whether the browser supports default html5 styles */
var supportsHtml5Styles; var supportsHtml5Styles;
@ -14,17 +17,22 @@
var supportsUnknownElements; var supportsUnknownElements;
(function() { (function() {
var fake, var a = document.createElement('a');
a = document.createElement('a'),
compStyle = window.getComputedStyle,
docEl = document.documentElement,
body = document.body || (fake = docEl.insertBefore(document.createElement('body'), docEl.firstChild));
body.insertBefore(a, body.firstChild);
a.hidden = true;
a.innerHTML = '<xyz></xyz>'; a.innerHTML = '<xyz></xyz>';
supportsHtml5Styles = (a.currentStyle || compStyle(a, null)).display == 'none'; //if the hidden property is implemented we can assume, that the browser supports HTML5 Styles | this fails in Chrome 8
supportsHtml5Styles = ('hidden' in a);
//if we are part of Modernizr, we do an additional test to solve the Chrome 8 fail
if(supportsHtml5Styles && typeof injectElementWithStyles == 'function'){
injectElementWithStyles('#modernizr{}', function(node){
node.hidden = true;
supportsHtml5Styles = (window.getComputedStyle ?
getComputedStyle(node, null) :
node.currentStyle).display == 'none';
});
}
supportsUnknownElements = a.childNodes.length == 1 || (function() { supportsUnknownElements = a.childNodes.length == 1 || (function() {
// assign a false positive if unable to shiv // assign a false positive if unable to shiv
try { try {
@ -40,8 +48,6 @@
); );
}()); }());
body.removeChild(a);
fake && docEl.removeChild(fake);
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@ -77,34 +83,48 @@
* @param {Document|DocumentFragment} ownerDocument The document. * @param {Document|DocumentFragment} ownerDocument The document.
*/ */
function shivMethods(ownerDocument) { function shivMethods(ownerDocument) {
var nodeName, var cache = {},
cache = {},
docCreateElement = ownerDocument.createElement, docCreateElement = ownerDocument.createElement,
docCreateFragment = ownerDocument.createDocumentFragment, docCreateFragment = ownerDocument.createDocumentFragment,
elements = getElements(), frag = docCreateFragment();
frag = docCreateFragment(),
index = elements.length;
function createDocumentFragment() { ownerDocument.createElement = function(nodeName) {
var node = frag.cloneNode(false); //abort shiv
return html5.shivMethods ? (shivMethods(node), node) : node; if(!html5.shivMethods){
docCreateElement(nodeName);
} }
function createElement(nodeName) { var node;
// avoid shiving elements like button, iframe, input, and textarea
// because IE < 9 cannot set the `name` or `type` attributes of an if(cache[nodeName]){
// element once it's inserted into a document node = cache[nodeName].cloneNode();
var node = (cache[nodeName] || (cache[nodeName] = docCreateElement(nodeName))).cloneNode(false); } else if(saveClones.test(nodeName)){
return html5.shivMethods && !reSkip.test(nodeName) ? frag.appendChild(node) : node; node = (cache[nodeName] = docCreateElement(nodeName)).cloneNode();
} else {
node = docCreateElement(nodeName);
} }
while (index--) { // Avoid adding some elements to fragments in IE < 9 because
nodeName = elements[index]; // * Attributes like `name` or `type` cannot be set/changed once an element
cache[nodeName] = docCreateElement(nodeName); // is inserted into a document/fragment
// * Link elements with `src` attributes that are inaccessible, as with
// a 403 response, will cause the tab/window to crash
// * Script elements appended to fragments will execute when their `src`
// or `text` property is set
return node.canHaveChildren && !reSkip.test(nodeName) ? frag.appendChild(node) : node;
};
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
'var n=f.cloneNode(),c=n.createElement;' +
'h.shivMethods&&(' +
// unroll the `createElement` calls
getElements().join().replace(/\w+/g, function(nodeName) {
docCreateElement(nodeName);
frag.createElement(nodeName); frag.createElement(nodeName);
} return 'c("' + nodeName + '")';
ownerDocument.createElement = createElement; }) +
ownerDocument.createDocumentFragment = createDocumentFragment; ');return n}'
)(html5, frag);
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@ -134,7 +154,7 @@
'mark{background:#FF0;color:#000}' 'mark{background:#FF0;color:#000}'
); );
} }
if (html5.shivMethods && !supportsUnknownElements) { if (!supportsUnknownElements) {
shived = !shivMethods(ownerDocument); shived = !shivMethods(ownerDocument);
} }
if (shived) { if (shived) {
@ -161,7 +181,7 @@
* @memberOf html5 * @memberOf html5
* @type Array|String * @type Array|String
*/ */
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' '), 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video',
/** /**
* A flag to indicate that the HTML5 style sheet should be inserted. * A flag to indicate that the HTML5 style sheet should be inserted.

View File

@ -7,4 +7,5 @@
//= require codemirror/runmode //= require codemirror/runmode
//= require_tree ./codemirror/modes //= require_tree ./codemirror/modes
//= require cusel //= require cusel
// require html5shiv
// require_tree . // require_tree .