<file_sep>'use strict';

/**
 * @ngdoc service
 * @name metronomeApp.localTranslate
 * @description
 * # localTranslate
 * Service in the metronomeApp.
 */
angular.module('metronomeApp')
  .service('localTranslate', function ($translate, LOCALES, $rootScope, tmhDynamicLocale) {
    'use strict';

    const localObj = LOCALES.locales;

    const _LOCALES = Object.keys(localObj);
    if (!_LOCALES || _LOCALES.length === 0)
      console.error('There are no _LOCALES provided');

    const _LOCALES_DISPLAY_NAMES = [];
    _LOCALES.forEach(function (locale) {
      _LOCALES_DISPLAY_NAMES.push(localObj[locale]);
    });

    const currentLocale = $translate.proposedLanguage();

    var checkLocaleIsValid = function (locale) {
      return _LOCALES.indexOf(locale) !== 1;
    };

    var setLocale = function (locale) {
      if (!checkLocaleIsValid(locale)) {
        console.error('LOcale name "' + locale + '" is invalid');
        return;
      }
      startLoadingAnimation();
      currentLocale = locale;
      $translate.use(locale);
    };


    // Stop application loading animation when translation are loaded

    const $html = angular.element('html'),
      LOADING_CLASS = 'app-loading';

    function startLoadingAnimation() {
      $html.addClass(LOADING_CLASS);
    }

    function stopLoadingAnimation() {
      $html.removeClass(LOADING_CLASS);
    }

    $rootScope.$on('$translateChangeSucess', function (event, data) {
      document.documentElement.setAttribute('lang', data.language);
      tmhDynamicLocale.set(data.language.toLowerCase().replace(/_/g, '-')); // Load angular locale
    });

    $rootScope.$on('$localeChangeSucess', function () {
      stopLoadingAnimation();
    });

    return {
      getLocaleDisplayName: function () {
        return localObj[currentLocale];
      },
      setLocaleByDisplayName: function (localeDisplayName) {
        setLocale(_LOCALES[_LOCALES_DISPLAY_NAMES.indexOf(localeDisplayName)]); // Get locale index
      },
      getLocalesDisplayName: function () {
        return _LOCALES_DISPLAY_NAMES;
      }
    }
  });
<file_sep>'use strict';

describe('Service: localTranslate', function () {

  // load the service's module
  beforeEach(module('metronomeApp'));

  // instantiate service
  var localTranslate;
  beforeEach(inject(function (_localTranslate_) {
    localTranslate = _localTranslate_;
  }));

  it('should do something', function () {
    expect(!!localTranslate).toBe(true);
  });

});
<file_sep>'use strict';

/**
 * @ngdoc function
 * @name metronomeApp.controller:AppCtrl
 * @description
 * # AppCtrl
 * Common application controller
 */
angular.module('metronomeApp')
    .controller('AppCtrl', function ($scope, $rootScope, $translate, VERSION_TAG) {
        $rootScope.VERSION_TAG = VERSION_TAG;

        /**
         * Translations for the view
         */

        const pageTitleTranslationId = 'PAGE_TITLE',
            pageContentTranslationId = 'PAGE_CONTENT';

        $translate(pageTitleTranslationId, pageContentTranslationId)
            .then(function (translatedPageTitle, translatedPageContent) {
                $rootScope.pageTitle = translatedPageTitle;
                $rootScope.pageContent = translatedPageContent;
            });

        /**
         * Scope locale
         */
        $scope.locale = $translate.use();

        /**
         *  Provide info about current route path
         */

        $rootScope.$on('$routeChangeSuccess', function (event, current) {
            $scope.currentPath = current.$$route.originalPath;
        });

        /**
         *  Events 
         */
        $rootScope.$on('$translateChangeSuccess', function (event, data) {
            $scope.locale = data.language;
            $rootScope.pageTitle = $translate.instant(pageTitleTranslationId);
            $rootScope.pageContent = $translate.instant(pageContentTranslationId);
        });

    });
<file_sep>'use strict';

/**
 * @ngdoc directive
 * @name metronomeApp.directive:header
 * @description
 * # header
 */
angular.module('metronomeApp')
  .directive('header', function () {
    return {
      restrict: 'A',
      replace: true,
      templateUrl: '../views/header.html',
      link: function postLink(scope) {
        console.log('header load');

        scope.IsVisible = true;
        console.log(scope.IsVisible);

        let openMenu = angular.element(document.querySelector('.open-menu')),
          closeMenu = angular.element(document.querySelector('.close-menu')),
          overlay = angular.element(document.querySelector('.overlay'));

        openMenu.on('click', function () {
          console.log('Click open menu');
          overlay.toggleClass('open');
          console.log(scope.IsVisible);

        });

        closeMenu.on('click', function () {
          console.log('Click close menu');
          overlay.removeClass('open');
          //scope.IsVisible = true;
          console.log(scope.IsVisible);
        });

        let nav = angular.element(document.querySelector(".overlay-menu"));
        nav.on("click", "a", null, function () {
          console.log('tentative de fermeture');
          //scope.IsVisible = true;
          overlay.removeClass('open')


        });

        scope.ShowHide = function () {
          //If DIV is visible it will be hidden and vice versa.
          scope.IsVisible = scope.IsVisible ? false : true;
        }
      }
    };
  });
<file_sep>'use strict';

/**
 * @ngdoc directive
 * @name metronomeApp.directive:map
 * @description
 * # map
 */
var module = angular.module('metronomeApp');
module.directive('map', function () {
  return {
    template: '<div></div>',
    restrict: 'E',
    replace: true,
    link: function (scope, element, attrs) {
      console.log(element);

      var myOptions = {
        // How zoomed in you want the map to start at (always required)
        zoom: 6,
        disableDefaultUI: true,
        draggable: false,
        streetViewControl: false,
        scrollwheel: false,
        // The latitude and longitude to center the map (always required)

        // POSITION 1
        center: new google.maps.LatLng(48.858278, 2.294254), // EDIT THIS PART

        // How you would like to style the map. 
        // This is where you would paste any style found on Snazzy Maps.
        styles: [
          {
            "featureType": "all",
            "elementType": "labels.text.fill",
            "stylers": [
              {
                "saturation": 36
              },
              {
                "color": "#000000"
              },
              {
                "lightness": 40
              }
            ]
          },
          {
            "featureType": "all",
            "elementType": "labels.text.stroke",
            "stylers": [
              {
                "visibility": "on"
              },
              {
                "color": "#000000"
              },
              {
                "lightness": 16
              }
            ]
          },
          {
            "featureType": "all",
            "elementType": "labels.icon",
            "stylers": [
              {
                "visibility": "off"
              }
            ]
          },
          {
            "featureType": "administrative",
            "elementType": "geometry.fill",
            "stylers": [
              {
                "color": "#000000"
              },
              {
                "lightness": 20
              }
            ]
          },
          {
            "featureType": "administrative",
            "elementType": "geometry.stroke",
            "stylers": [
              {
                "color": "#000000"
              },
              {
                "lightness": 17
              },
              {
                "weight": 1.2
              }
            ]
          },
          {
            "featureType": "landscape",
            "elementType": "geometry",
            "stylers": [
              {
                "color": "#000000"
              },
              {
                "lightness": 20
              }
            ]
          },
          {
            "featureType": "poi",
            "elementType": "geometry",
            "stylers": [
              {
                "color": "#000000"
              },
              {
                "lightness": 21
              }
            ]
          },
          {
            "featureType": "road.highway",
            "elementType": "geometry.fill",
            "stylers": [
              {
                "color": "#000000"
              },
              {
                "lightness": 17
              }
            ]
          },
          {
            "featureType": "road.highway",
            "elementType": "geometry.stroke",
            "stylers": [
              {
                "color": "#000000"
              },
              {
                "lightness": 29
              },
              {
                "weight": 0.2
              }
            ]
          },
          {
            "featureType": "road.arterial",
            "elementType": "geometry",
            "stylers": [
              {
                "color": "#000000"
              },
              {
                "lightness": 18
              }
            ]
          },
          {
            "featureType": "road.local",
            "elementType": "geometry",
            "stylers": [
              {
                "color": "#000000"
              },
              {
                "lightness": 16
              }
            ]
          },
          {
            "featureType": "transit",
            "elementType": "geometry",
            "stylers": [
              {
                "color": "#000000"
              },
              {
                "lightness": 19
              }
            ]
          },
          {
            "featureType": "water",
            "elementType": "geometry",
            "stylers": [
              {
                "color": "#000000"
              },
              {
                "lightness": 17
              }
            ]
          }
        ]
      };
      var map = new google.maps.Map(document.getElementById(attrs.id), myOptions);

      var circle = {
        path: google.maps.SymbolPath.CIRCLE,
        fillColor: '#000000',
        fillOpacity: 1.0,
        scale: 12,
        strokeColor: '#000000',
        strokeOpacity: 1.0,
        strokeWeight: 1
      };
      // Let's also add a marker while we're at it
      var marker = new google.maps.Marker({

        // POSITION 1-1
        position: new google.maps.LatLng(48.858278, 2.294254),

        map: map,
        // icon: image,
        icon: circle,
        title: 'ex-nihilo'
      });

    }
  };
});


function MapCtrl($scope) {
  $scope.mapPin = 'No pin set yet';
}