Commit 3a41cab62fec901241ea8534ed1a3e66ba98a1c9

Authored by Caio Almeida
1 parent 0ec5f412

Hide the close rightbar button on large screens

ConfJuvApp/www/html/_right_sidebar.html
... ... @@ -2,7 +2,7 @@
2 2 <ion-content>
3 3 <h2>
4 4 <span>Pesquisa</span>
5   - <button menu-toggle="right" class="button button-icon icon ion-close-circled"></button>
  5 + <button menu-toggle="right" class="button button-icon icon ion-close-circled" hide-when="large"></button>
6 6 </h2>
7 7 <h3>Filtrar propostas por tema</h2>
8 8 <label ng-repeat="topic in topics">
... ...
ConfJuvApp/www/js/app.js
... ... @@ -16,3 +16,33 @@ angular.module(&#39;confjuvapp&#39;, [&#39;ionic&#39;, &#39;confjuvapp.controllers&#39;, &#39;confjuvapp.fil
16 16 }
17 17 });
18 18 })
  19 +
  20 +.directive('hideWhen', ['$window', function($window) {
  21 + return {
  22 + restrict: 'A',
  23 + link: function($scope, $element, $attr) {
  24 + function checkExpose() {
  25 + var mq = $attr.hideWhen == 'large' ? '(min-width:768px)' : $attr.hideWhen;
  26 + if ($window.matchMedia(mq).matches) {
  27 + $element.addClass('ng-hide');
  28 + }
  29 + else {
  30 + $element.removeClass('ng-hide');
  31 + }
  32 + }
  33 + function onResize() {
  34 + debouncedCheck();
  35 + }
  36 + var debouncedCheck = ionic.debounce(function() {
  37 + $scope.$apply(function() {
  38 + checkExpose();
  39 + });
  40 + }, 300, false);
  41 + checkExpose();
  42 + ionic.on('resize', onResize, $window);
  43 + $scope.$on('$destroy', function(){
  44 + ionic.off('resize', onResize, $window);
  45 + });
  46 + }
  47 + };
  48 +}]);
... ...