uncomment jshint and fix minor bug
authorrougeronj
Thu, 11 Jun 2015 16:19:36 +0200
changeset 172 ffdfe491869c
parent 171 903d6f504f71
child 173 70f75e29f58d
uncomment jshint and fix minor bug rename myCustomer to imgType (customer to check if image is portrait or landscape)
client/app/app.css
client/app/app.js
client/app/auth/auth_controller.js
client/app/books/galleryItem.html
client/app/components/app_service.js
client/app/index.html
client/app/slides/slides.css
client/gulpfile.js
--- a/client/app/app.css	Thu Jun 11 15:38:19 2015 +0200
+++ b/client/app/app.css	Thu Jun 11 16:19:36 2015 +0200
@@ -1,4 +1,4 @@
-#logo {
+.logo {
     padding-top: 0;
 }
 
--- a/client/app/app.js	Thu Jun 11 15:38:19 2015 +0200
+++ b/client/app/app.js	Thu Jun 11 16:19:36 2015 +0200
@@ -3,10 +3,10 @@
 
     angular.module('ammico', [ 'ngRoute','ammicoHome', 'ammicoMyvisit', 'ammicoBooks', 'ammicoVisites', 'ammicoSlides', 'ammicoSlideshow', 'ammicoSearch', 'ammicoAuth', 'ammicoCommon', 'templates' ])
     .config(function($routeProvider, $httpProvider) {
-        $httpProvider.interceptors.push(function($q, $location) {
+        $httpProvider.interceptors.push(function($q) {
             return {
                 responseError: function(rejection) {
-                    if (rejection.status == 401) {
+                    if (rejection.status === 401) {
                         localStorage.removeItem('token');
                     }
                     return $q.reject(rejection);
@@ -76,15 +76,15 @@
     })
     .run( function($rootScope, $location, $window, $http, authApi, context) {
         $rootScope.globals = {};
-        if (localStorage.getItem('token') || context['token']) {
+        if (localStorage.getItem('token') || context.token) {
             $rootScope.globals.userLogged = true;
-            localStorage.setItem('token', (localStorage.getItem('token') || context['token']));
-            $http.defaults.headers.common.Authorization = 'Token ' + (localStorage.getItem('token') || context['token']);
+            localStorage.setItem('token', (localStorage.getItem('token') || context.token));
+            $http.defaults.headers.common.Authorization = 'Token ' + (localStorage.getItem('token') || context.token);
         }
         $rootScope.$on( '$routeChangeStart', function(event, next) {
             if (next.authRequired && !$rootScope.globals.userLogged) {
                 $location.path( '/auth/login' );
             }
         });
-    })
+    });
 })();
--- a/client/app/auth/auth_controller.js	Thu Jun 11 15:38:19 2015 +0200
+++ b/client/app/auth/auth_controller.js	Thu Jun 11 16:19:36 2015 +0200
@@ -37,12 +37,12 @@
         };
     })
     .controller('authregisterCtrl', function($scope, $modalInstance, authApi){
-        $scope.message = "";
+        $scope.message = '';
 
         $scope.user = {
-            email: "",
-            password: "",
-            confirmPassword: ""
+            email: '',
+            password: '',
+            confirmPassword: ''
         };
 
         $scope.submit = function(isValid) {
@@ -57,29 +57,29 @@
                     $modalInstance.close('/auth/login');
                 });
             } else {
-                $scope.message = "Il reste toujours des champs invalides";
+                $scope.message = 'Il reste toujours des champs invalides';
             }
         };
         $scope.back = function () {
             $modalInstance.close('/auth/login');
         };
     })
-    .directive("compareTo", function(){
+    .directive('compareTo', function(){
         return {
-            require: "ngModel",
+            require: 'ngModel',
             scope: {
-              otherModelValue: "=compareTo"
+                otherModelValue: '=compareTo'
             },
             link: function($scope, element, attributes, ngModel) {
 
-              ngModel.$validators.compareTo = function(modelValue) {
-                return modelValue == $scope.otherModelValue;
-              };
+                ngModel.$validators.compareTo = function(modelValue) {
+                    return modelValue === $scope.otherModelValue;
+                };
 
-              $scope.$watch("otherModelValue", function() {
-                  ngModel.$validate();
-              });
+                $scope.$watch('otherModelValue', function() {
+                    ngModel.$validate();
+                });
             }
-        }
+        };
     });
 })();
--- a/client/app/books/galleryItem.html	Thu Jun 11 15:38:19 2015 +0200
+++ b/client/app/books/galleryItem.html	Thu Jun 11 16:19:36 2015 +0200
@@ -1,5 +1,5 @@
 
-<a href="#/slide/{{slide.id}}"><img ng-src="{{ slide.details.images[0] }}" my-customer /></a>
+<a href="#/slide/{{slide.id}}"><img ng-src="{{ slide.details.images[0] }}" img-type /></a>
 <div class="gallery-buttons">
     <a ng-click="slide.toggleFavorite()"><span ng-class="{'glyphicon-star': slide.favorite, 'glyphicon-star-empty': !slide.favorite}" class="glyphicon"></span></a>
     <a ng-click="slide.addToBook();"><span class="glyphicon glyphicon-plus"></span></a>
--- a/client/app/components/app_service.js	Thu Jun 11 15:38:19 2015 +0200
+++ b/client/app/components/app_service.js	Thu Jun 11 16:19:36 2015 +0200
@@ -27,7 +27,7 @@
                 modalInstance.result.then(function (idBook) {
                     var newSlide = _this;
                     newSlide.book = idBook;
-                    delete newSlide["id"];
+                    delete newSlide.id;
                     slides.save(newSlide);
                 });
             },
@@ -41,7 +41,7 @@
                         if (array){
                             array.splice(array.indexOf(_this), 1);
                         }
-                        //$scope.$emit("slideDeleted", array);
+                        //$scope.$emit('slideDeleted', array);
                     },
                     function(error) {
                         if (error.status === 404 && array){
@@ -104,22 +104,23 @@
                     });
         };
     })
-    .directive('myCustomer', function(){
+    .directive('imgType', function(){
         return {
-            link: function(scope, elem, attr) {
+            restrict: 'AE',
+            link: function(scope, elem) {
                 elem.bind('error', function() {
                     elem.parents('li.item').addClass('no-img');
                     elem.remove();
                 });
                 elem.on('load', function() {
-                    var w = $(this).width(),
-                        h = $(this).height();
+                    var w = elem.width(),
+                        h = elem.height();
                     if (w > h){
-                        $(this).addClass('img-landscape');
+                        elem.addClass('img-landscape');
                     }
                 });
             }
-        }
+        };
     });
     
 })();
--- a/client/app/index.html	Thu Jun 11 15:38:19 2015 +0200
+++ b/client/app/index.html	Thu Jun 11 16:19:36 2015 +0200
@@ -23,7 +23,7 @@
             <span class="icon-bar"></span>
             <span class="icon-bar"></span>
           </button>
-          <a class="navbar-brand row" id="logo" href="#/">
+          <a class="navbar-brand row logo" href="#/">
               <!-- build:imgLogo -->
               <img src="img/ammico_logo_small.png">
               <!-- endbuild -->
--- a/client/app/slides/slides.css	Thu Jun 11 15:38:19 2015 +0200
+++ b/client/app/slides/slides.css	Thu Jun 11 16:19:36 2015 +0200
@@ -35,9 +35,9 @@
     max-width: 100%;
     display: block;
     margin: auto;
-    -webkit-box-shadow: 0px 0px 15px 0px rgba(0,0,0,0.60);
-    -moz-box-shadow: 0px 0px 15px 0px rgba(0,0,0,0.60);
-    box-shadow: 0px 0px 15px 0px rgba(0,0,0,0.60);
+    -webkit-box-shadow: 0 0 15px 0 rgba(0,0,0,0.60);
+    -moz-box-shadow: 0 0 15px 0 rgba(0,0,0,0.60);
+    box-shadow: 0 0 15px 0 rgba(0,0,0,0.60);
 }
 
 .slide .caption {
--- a/client/gulpfile.js	Thu Jun 11 15:38:19 2015 +0200
+++ b/client/gulpfile.js	Thu Jun 11 16:19:36 2015 +0200
@@ -21,9 +21,9 @@
 gulp.task('scripts', function(){
     //combine all js files of the app
     gulp.src(scriptsSrc)
-//        .pipe(plugins.jshint())
-//        .pipe(plugins.jshint.reporter('default'))
-//        .pipe(plugins.jshint.reporter('fail'))
+        .pipe(plugins.jshint())
+        .pipe(plugins.jshint.reporter('default'))
+        .pipe(plugins.jshint.reporter('fail'))
         .pipe(plugins.concat('app.js'))
         .pipe(gulp.dest(buildFolder+'/js'))
         .pipe(plugins.filesize())