diff options
39 files changed, 94 insertions, 50 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index 72db7eb1..a967bfc4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,12 +1,10 @@ { "extends": "eslint:recommended", "rules": { - "no-undef": "off", - "no-unused-vars": "off", - "eqeqeq": ["warn", "smart"], "no-console": "warn", "no-loop-func": "warn", + "no-unused-vars": "warn", "block-spacing": "error", "camelcase": "error", @@ -20,6 +18,17 @@ "quotes": ["error", "single", "avoid-escape"], "semi": "error", "space-before-blocks": "error" - + }, + "env": { + "browser": true, + "jquery": true + }, + "globals": { + "angular": false, + "vCard": false, + "_": false, + "OC": false, + "t": false, + "dav": false } } diff --git a/js/components/addressBook/addressBook_controller.js b/js/components/addressBook/addressBook_controller.js index 45839931..bb08f7e7 100644 --- a/js/components/addressBook/addressBook_controller.js +++ b/js/components/addressBook/addressBook_controller.js @@ -1,4 +1,5 @@ -app.controller('addressbookCtrl', function($scope, AddressBookService) { +angular.module('contactsApp') +.controller('addressbookCtrl', function($scope, AddressBookService) { var ctrl = this; ctrl.urlBase = window.location.protocol + '//' + window.location.host; diff --git a/js/components/addressBook/addressBook_directive.js b/js/components/addressBook/addressBook_directive.js index e6eabc77..d4084f02 100644 --- a/js/components/addressBook/addressBook_directive.js +++ b/js/components/addressBook/addressBook_directive.js @@ -1,4 +1,5 @@ -app.directive('addressbook', function() { +angular.module('contactsApp') +.directive('addressbook', function() { return { restrict: 'A', // has to be an attribute to work with core css scope: {}, diff --git a/js/components/addressBookList/addressBookList_controller.js b/js/components/addressBookList/addressBookList_controller.js index e508882a..bc48d995 100644 --- a/js/components/addressBookList/addressBookList_controller.js +++ b/js/components/addressBookList/addressBookList_controller.js @@ -1,4 +1,5 @@ -app.controller('addressbooklistCtrl', function($scope, AddressBookService, SettingsService) { +angular.module('contactsApp') +.controller('addressbooklistCtrl', function($scope, AddressBookService, SettingsService) { var ctrl = this; ctrl.loading = true; diff --git a/js/components/addressBookList/addressBookList_directive.js b/js/components/addressBookList/addressBookList_directive.js index f20fcc1f..a68ac10b 100644 --- a/js/components/addressBookList/addressBookList_directive.js +++ b/js/components/addressBookList/addressBookList_directive.js @@ -1,4 +1,5 @@ -app.directive('addressbooklist', function() { +angular.module('contactsApp') +.directive('addressbooklist', function() { return { restrict: 'EA', // has to be an attribute to work with core css scope: {}, diff --git a/js/components/contact/contact_controller.js b/js/components/contact/contact_controller.js index aa9fcb26..5c4d7311 100644 --- a/js/components/contact/contact_controller.js +++ b/js/components/contact/contact_controller.js @@ -1,4 +1,5 @@ -app.controller('contactCtrl', function($route, $routeParams) { +angular.module('contactsApp') +.controller('contactCtrl', function($route, $routeParams) { var ctrl = this; ctrl.openContact = function() { diff --git a/js/components/contact/contact_directive.js b/js/components/contact/contact_directive.js index db96b5f8..d5dd07aa 100644 --- a/js/components/contact/contact_directive.js +++ b/js/components/contact/contact_directive.js @@ -1,4 +1,5 @@ -app.directive('contact', function() { +angular.module('contactsApp') +.directive('contact', function() { return { scope: {}, controller: 'contactCtrl', diff --git a/js/components/contactDetails/contactDetails_controller.js b/js/components/contactDetails/contactDetails_controller.js index 91e35404..bc8088d7 100644 --- a/js/components/contactDetails/contactDetails_controller.js +++ b/js/components/contactDetails/contactDetails_controller.js @@ -1,4 +1,5 @@ -app.controller('contactdetailsCtrl', function(ContactService, AddressBookService, vCardPropertiesService, $routeParams, $scope) { +angular.module('contactsApp') +.controller('contactdetailsCtrl', function(ContactService, AddressBookService, vCardPropertiesService, $routeParams, $scope) { var ctrl = this; ctrl.loading = true; diff --git a/js/components/contactDetails/contactDetails_directive.js b/js/components/contactDetails/contactDetails_directive.js index 2b32fd18..23c67eb6 100644 --- a/js/components/contactDetails/contactDetails_directive.js +++ b/js/components/contactDetails/contactDetails_directive.js @@ -1,4 +1,5 @@ -app.directive('contactdetails', function() { +angular.module('contactsApp') +.directive('contactdetails', function() { return { priority: 1, scope: {}, diff --git a/js/components/contactList/contactList_controller.js b/js/components/contactList/contactList_controller.js index 9a1c9441..3f02179e 100644 --- a/js/components/contactList/contactList_controller.js +++ b/js/components/contactList/contactList_controller.js @@ -1,4 +1,5 @@ -app.controller('contactlistCtrl', function($scope, $filter, $route, $routeParams, ContactService, vCardPropertiesService, SearchService) { +angular.module('contactsApp') +.controller('contactlistCtrl', function($scope, $filter, $route, $routeParams, ContactService, vCardPropertiesService, SearchService) { var ctrl = this; ctrl.routeParams = $routeParams; diff --git a/js/components/contactList/contactList_directive.js b/js/components/contactList/contactList_directive.js index 1cfe18ce..ba0315d1 100644 --- a/js/components/contactList/contactList_directive.js +++ b/js/components/contactList/contactList_directive.js @@ -1,4 +1,5 @@ -app.directive('contactlist', function() { +angular.module('contactsApp') +.directive('contactlist', function() { return { priority: 1, scope: {}, diff --git a/js/components/datepicker_directive.js b/js/components/datepicker_directive.js index 6f28b008..1a7480ed 100644 --- a/js/components/datepicker_directive.js +++ b/js/components/datepicker_directive.js @@ -1,4 +1,5 @@ -app.directive('datepicker', function() { +angular.module('contactsApp') +.directive('datepicker', function() { return { restrict: 'A', require : 'ngModel', diff --git a/js/components/detailsItem/detailsItem_controller.js b/js/components/detailsItem/detailsItem_controller.js index 3aafc402..6fd7e5f4 100644 --- a/js/components/detailsItem/detailsItem_controller.js +++ b/js/components/detailsItem/detailsItem_controller.js @@ -1,4 +1,5 @@ -app.controller('detailsItemCtrl', function($templateRequest, vCardPropertiesService, ContactService) { +angular.module('contactsApp') +.controller('detailsItemCtrl', function($templateRequest, vCardPropertiesService, ContactService) { var ctrl = this; ctrl.meta = vCardPropertiesService.getMeta(ctrl.name); diff --git a/js/components/detailsItem/detailsItem_directive.js b/js/components/detailsItem/detailsItem_directive.js index 49f1b415..2191c995 100644 --- a/js/components/detailsItem/detailsItem_directive.js +++ b/js/components/detailsItem/detailsItem_directive.js @@ -1,4 +1,5 @@ -app.directive('detailsitem', ['$compile', function($compile) { +angular.module('contactsApp') +.directive('detailsitem', ['$compile', function($compile) { return { scope: {}, controller: 'detailsItemCtrl', diff --git a/js/components/focus_directive.js b/js/components/focus_directive.js index 77ae7439..76d01bc3 100644 --- a/js/components/focus_directive.js +++ b/js/components/focus_directive.js @@ -1,4 +1,5 @@ -app.directive('focusExpression', function ($timeout) { +angular.module('contactsApp') +.directive('focusExpression', function ($timeout) { return { restrict: 'A', link: { diff --git a/js/components/group/group_controller.js b/js/components/group/group_controller.js index 89c1bb15..a250c267 100644 --- a/js/components/group/group_controller.js +++ b/js/components/group/group_controller.js @@ -1,3 +1,4 @@ -app.controller('groupCtrl', function() { +angular.module('contactsApp') +.controller('groupCtrl', function() { var ctrl = this; }); diff --git a/js/components/group/group_directive.js b/js/components/group/group_directive.js index 86e0a7fa..3aa5a99f 100644 --- a/js/components/group/group_directive.js +++ b/js/components/group/group_directive.js @@ -1,4 +1,5 @@ -app.directive('group', function() { +angular.module('contactsApp') +.directive('group', function() { return { restrict: 'A', // has to be an attribute to work with core css scope: {}, diff --git a/js/components/groupList/groupList_controller.js b/js/components/groupList/groupList_controller.js index aadcb789..33aae4a7 100644 --- a/js/components/groupList/groupList_controller.js +++ b/js/components/groupList/groupList_controller.js @@ -1,4 +1,5 @@ -app.controller('grouplistCtrl', function($scope, ContactService, SearchService, $routeParams) { +angular.module('contactsApp') +.controller('grouplistCtrl', function($scope, ContactService, SearchService, $routeParams) { var ctrl = this; var initialGroups = [t('contacts', 'All contacts'), t('contacts', 'Not grouped')]; diff --git a/js/components/groupList/groupList_directive.js b/js/components/groupList/groupList_directive.js index 748a3671..42a7ff72 100644 --- a/js/components/groupList/groupList_directive.js +++ b/js/components/groupList/groupList_directive.js @@ -1,4 +1,5 @@ -app.directive('grouplist', function() { +angular.module('contactsApp') +.directive('grouplist', function() { return { restrict: 'EA', // has to be an attribute to work with core css scope: {}, diff --git a/js/components/parsers/groupModel_directive.js b/js/components/parsers/groupModel_directive.js index b37c1f25..5d0e9673 100644 --- a/js/components/parsers/groupModel_directive.js +++ b/js/components/parsers/groupModel_directive.js @@ -1,4 +1,5 @@ -app.directive('groupModel', function($filter) { +angular.module('contactsApp') +.directive('groupModel', function($filter) { return{ restrict: 'A', require: 'ngModel', diff --git a/js/components/parsers/telModel_directive.js b/js/components/parsers/telModel_directive.js index 84cd74b1..f19dfb54 100644 --- a/js/components/parsers/telModel_directive.js +++ b/js/components/parsers/telModel_directive.js @@ -1,4 +1,5 @@ -app.directive('telModel', function() { +angular.module('contactsApp') +.directive('telModel', function() { return{ restrict: 'A', require: 'ngModel', diff --git a/js/filters/JSON2vCard_filter.js b/js/filters/JSON2vCard_filter.js index d55e0c25..634d75f0 100644 --- a/js/filters/JSON2vCard_filter.js +++ b/js/filters/JSON2vCard_filter.js @@ -1,5 +1,6 @@ -app.filter('JSON2vCard', function() { +angular.module('contactsApp') +.filter('JSON2vCard', function() { return function(input) { return vCard.generate(input); }; -});
\ No newline at end of file +}); diff --git a/js/filters/contactColor_filter.js b/js/filters/contactColor_filter.js index 008dc619..79a58257 100644 --- a/js/filters/contactColor_filter.js +++ b/js/filters/contactColor_filter.js @@ -1,4 +1,5 @@ -app.filter('contactColor', function() { +angular.module('contactsApp') +.filter('contactColor', function() { return function(input) { var colors = [ '#001f3f', diff --git a/js/filters/contactGroup_filter.js b/js/filters/contactGroup_filter.js index 4687d780..3ceb1ca1 100644 --- a/js/filters/contactGroup_filter.js +++ b/js/filters/contactGroup_filter.js @@ -1,4 +1,5 @@ -app.filter('contactGroupFilter', function() { +angular.module('contactsApp') +.filter('contactGroupFilter', function() { 'use strict'; return function (contacts, group) { if (typeof contacts === 'undefined') { diff --git a/js/filters/field_filter.js b/js/filters/field_filter.js index d0f7de82..8db1de04 100644 --- a/js/filters/field_filter.js +++ b/js/filters/field_filter.js @@ -1,4 +1,5 @@ -app.filter('fieldFilter', function() { +angular.module('contactsApp') +.filter('fieldFilter', function() { 'use strict'; return function (fields, contact) { if (typeof fields === 'undefined') { diff --git a/js/filters/firstCharacter_filter.js b/js/filters/firstCharacter_filter.js index 538ba2f8..63241c95 100644 --- a/js/filters/firstCharacter_filter.js +++ b/js/filters/firstCharacter_filter.js @@ -1,4 +1,5 @@ -app.filter('firstCharacter', function() { +angular.module('contactsApp') +.filter('firstCharacter', function() { return function(input) { return input.charAt(0); }; diff --git a/js/filters/orderDetailItems_filter.js b/js/filters/orderDetailItems_filter.js index cdeb50c6..d052d762 100644 --- a/js/filters/orderDetailItems_filter.js +++ b/js/filters/orderDetailItems_filter.js @@ -1,4 +1,5 @@ -app.filter('orderDetailItems', function(vCardPropertiesService) { +angular.module('contactsApp') +.filter('orderDetailItems', function(vCardPropertiesService) { 'use strict'; return function(items, field, reverse) { diff --git a/js/filters/toArray_filter.js b/js/filters/toArray_filter.js index 418f36b5..aff8f497 100644 --- a/js/filters/toArray_filter.js +++ b/js/filters/toArray_filter.js @@ -1,4 +1,5 @@ -app.filter('toArray', function() { +angular.module('contactsApp') +.filter('toArray', function() { return function(obj) { if (!(obj instanceof Object)) return obj; return _.map(obj, function(val, key) { diff --git a/js/filters/vCard2JSON_filter.js b/js/filters/vCard2JSON_filter.js index 752b5856..f8b59050 100644 --- a/js/filters/vCard2JSON_filter.js +++ b/js/filters/vCard2JSON_filter.js @@ -1,5 +1,6 @@ -app.filter('vCard2JSON', function() { +angular.module('contactsApp') +.filter('vCard2JSON', function() { return function(input) { return vCard.parse(input); }; -});
\ No newline at end of file +}); @@ -8,9 +8,8 @@ * @copyright Hendrik Leppelsack 2015 */ -var app = angular.module('contactsApp', ['uuid4', 'angular-cache', 'ngRoute', 'ui.bootstrap', 'ui.select', 'ngSanitize']); - -app.config(function($routeProvider) { +angular.module('contactsApp', ['uuid4', 'angular-cache', 'ngRoute', 'ui.bootstrap', 'ui.select', 'ngSanitize']) +.config(function($routeProvider) { $routeProvider.when('/:gid', { template: '<contactdetails></contactdetails>' diff --git a/js/models/addressBook_model.js b/js/models/addressBook_model.js index 8b076416..649f308d 100644 --- a/js/models/addressBook_model.js +++ b/js/models/addressBook_model.js @@ -1,4 +1,5 @@ -app.factory('AddressBook', function() +angular.module('contactsApp') +.factory('AddressBook', function() { return function AddressBook(data) { angular.extend(this, { diff --git a/js/models/contact_model.js b/js/models/contact_model.js index 502ec15c..cc3a951d 100644 --- a/js/models/contact_model.js +++ b/js/models/contact_model.js @@ -1,4 +1,5 @@ -app.factory('Contact', function($filter) { +angular.module('contactsApp') +.factory('Contact', function($filter) { return function Contact(addressBook, vCard) { angular.extend(this, { diff --git a/js/services/addressBook_service.js b/js/services/addressBook_service.js index 3d6d3260..ea59a201 100644 --- a/js/services/addressBook_service.js +++ b/js/services/addressBook_service.js @@ -1,4 +1,5 @@ -app.factory('AddressBookService', function(DavClient, DavService, SettingsService, AddressBook, Contact) { +angular.module('contactsApp') +.factory('AddressBookService', function(DavClient, DavService, SettingsService, AddressBook, Contact) { var addressBooks = []; diff --git a/js/services/contact_service.js b/js/services/contact_service.js index 12879e0d..81515bae 100644 --- a/js/services/contact_service.js +++ b/js/services/contact_service.js @@ -1,9 +1,9 @@ -var contacts; -app.service('ContactService', function(DavClient, AddressBookService, Contact, $q, CacheFactory, uuid4) { +angular.module('contactsApp') +.service('ContactService', function(DavClient, AddressBookService, Contact, $q, CacheFactory, uuid4) { var cacheFilled = false; - contacts = CacheFactory('contacts'); + var contacts = CacheFactory('contacts'); var observerCallbacks = []; @@ -29,7 +29,7 @@ app.service('ContactService', function(DavClient, AddressBookService, Contact, $ promises.push( AddressBookService.sync(addressBook).then(function(addressBook) { for(var i in addressBook.objects) { - contact = new Contact(addressBook, addressBook.objects[i]); + var contact = new Contact(addressBook, addressBook.objects[i]); contacts.put(contact.uid(), contact); } }) |