diff --git a/app/src/Template/Element/javascript.ctp b/app/src/Template/Element/javascript.ctp index c8891f937..c46b3f145 100644 --- a/app/src/Template/Element/javascript.ctp +++ b/app/src/Template/Element/javascript.ctp @@ -32,18 +32,9 @@ // Establish left-side navigation $('#main-menu').metisMenu(); - // Never allow MDL to apply "aria-hidden" on the fixed menu drawer (it should always be available to screen readers) - $('#navigation-drawer').removeAttr('aria-hidden'); - // Focus any designated form element $('.focusFirst').focus(); - // MDL prematurely marks all required=true fields with "is-invalid" class. - // Remove it. Must be done after MDL scripts have run (hence, window.load) - $(window).on('load', function() { - $('.mdl-textfield').removeClass('is-invalid'); - }); - // DESKTOP MENU DRAWER BEHAVIOR // Check the drawer half-closed cookie on first load and set the drawer state appropriately if (Cookies.get("desktop-drawer-state") == "half-closed") { @@ -61,21 +52,37 @@ } } - // Desktop hamburger menu-drawer toggle - $('#desktop-hamburger').click(function () { - if( $("#navigation-drawer").hasClass("half-closed")) { - $("#navigation-drawer").removeClass("half-closed"); - $("#main").removeClass("drawer-half-closed"); - // set a cookie to hold drawer half-open state between requests - Cookies.set("desktop-drawer-state", "open"); + // Hamburger menu-drawer toggle + $('#co-hamburger').click(function () { + if($(window).width() < 768) { + // Mobile mode + $("#navigation-drawer").removeClass("half-closed").toggle(); } else { - $("#navigation-drawer").addClass("half-closed"); - $("#main").addClass("drawer-half-closed"); - // ensure all the sub-menus collapse when half-closing the menu - $("#navigation .metismenu li ul").removeClass("in"); - $("#navigation .metismenu li").removeClass("active"); - // set a cookie to hold drawer half-open state between requests - Cookies.set("desktop-drawer-state", "half-closed"); + // Desktop mode + if ($("#navigation-drawer").hasClass("half-closed")) { + $("#navigation-drawer").removeClass("half-closed"); + $("#main").removeClass("drawer-half-closed"); + // set a cookie to hold drawer half-open state between requests + Cookies.set("desktop-drawer-state", "open"); + } else { + $("#navigation-drawer").addClass("half-closed"); + $("#main").addClass("drawer-half-closed"); + // ensure all the sub-menus collapse when half-closing the menu + $("#navigation .metismenu li ul").removeClass("in"); + $("#navigation .metismenu li").removeClass("active"); + // set a cookie to hold drawer half-open state between requests + Cookies.set("desktop-drawer-state", "half-closed"); + } + } + }); + + // Catch the edge-case of browser resize causing menu-drawer + // to remain hidden and vice versa. + $(window).resize(function() { + if($( window ).width() > 767) { + $("#navigation-drawer").show(); + } else { + $("#navigation-drawer").hide(); } }); @@ -130,8 +137,11 @@ // Accordion $(".accordion").accordion(); - // Make all submit buttons pretty (MDL) - $("input:submit").addClass("spin submit-button mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect"); + // Make all submit buttons pretty (Bootstrap) + $("input:submit").addClass("spin submit-button btn btn-primary"); + + // Make all select form controls Bootstrappy + $("select").addClass("form-control"); // Other buttons (jQuery) $(".addbutton").button({ diff --git a/app/src/Template/Element/menuMain.ctp b/app/src/Template/Element/menuMain.ctp index 78f1ecbfc..8f9bba476 100644 --- a/app/src/Template/Element/menuMain.ctp +++ b/app/src/Template/Element/menuMain.ctp @@ -47,7 +47,7 @@ $linkContent = '' . $icon . '' . __('match.ct.'.$model, [99]) - . ''; + . ''; print $this->Html->link( $linkContent, @@ -55,8 +55,7 @@ 'controller' => $model, 'action' => 'index', 'matchgrid_id' => $vv_cur_mg->id], - ['class' => 'mdl-js-ripple-effect', - 'escape' => false] + ['escape' => false] ); print ""; @@ -77,15 +76,14 @@ $linkContent = '' . $icon . '' . __('match.ct.'.$model, [99]) - . ''; + . ''; print $this->Html->link( $linkContent, ['plugin' => null, 'controller' => $model, 'action' => 'index'], - ['class' => 'mdl-js-ripple-effect', - 'escape' => false] + ['escape' => false] ); print ""; diff --git a/app/src/Template/Element/menuUser.ctp b/app/src/Template/Element/menuUser.ctp index 6ebb09aa6..b98b78d63 100644 --- a/app/src/Template/Element/menuUser.ctp +++ b/app/src/Template/Element/menuUser.ctp @@ -39,10 +39,10 @@