From fc72d3b12a663ae24c00ed5325f4e66022b43b05 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 9 Mar 2015 16:21:31 -0400 Subject: [PATCH] Cleanup references to ZURB Foundation --- UI/Templates/UIxPageFrame.wox | 4 +- UI/WebServerResources/js/Common/ui-common.js | 22 ---------- UI/WebServerResources/js/Common/ui-desktop.js | 41 ++++++++----------- UI/WebServerResources/js/Common/utils.js | 2 - UI/WebServerResources/js/ContactsUI.js | 37 ++++++++--------- UI/WebServerResources/js/MailerUI.js | 10 ++--- 6 files changed, 39 insertions(+), 77 deletions(-) delete mode 100644 UI/WebServerResources/js/Common/ui-common.js diff --git a/UI/Templates/UIxPageFrame.wox b/UI/Templates/UIxPageFrame.wox index b72c5c411..062ab957e 100644 --- a/UI/Templates/UIxPageFrame.wox +++ b/UI/Templates/UIxPageFrame.wox @@ -12,7 +12,7 @@ + xml:lang="en" const:lang="en"> <var:string value="title" /> @@ -167,12 +167,10 @@ <script type="text/javascript" rsrc:src="js/vendor/angular-aria.js"><!-- space --></script> <script type="text/javascript" rsrc:src="js/vendor/angular-material.js"><!-- space --></script> <script type="text/javascript" rsrc:src="js/vendor/angular-ui-router.js"><!-- space --></script> - <script type="text/javascript" rsrc:src="js/vendor/mm-foundation-tpls.js"><!-- space --></script> <script type="text/javascript" rsrc:src="js/vendor/angular-recursion.js"><!-- space --></script> <script type="text/javascript" rsrc:src="js/vendor/angular-vs-repeat.js"><!-- space --></script> <script type="text/javascript" rsrc:src="js/Common/utils.js"><!-- space --></script> <script type="text/javascript" rsrc:src="js/Common/ui.js"><!-- space --></script> - <script type="text/javascript" rsrc:src="js/Common/ui-common.js"><!-- space --></script> <script type="text/javascript" rsrc:src="js/Common/ui-desktop.js"><!-- space --></script> <var:if condition="hasProductSpecificJavaScript"> diff --git a/UI/WebServerResources/js/Common/ui-common.js b/UI/WebServerResources/js/Common/ui-common.js deleted file mode 100644 index f79e4d5c0..000000000 --- a/UI/WebServerResources/js/Common/ui-common.js +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* JavaScript for common UI services */ - -(function() { - 'use strict'; - - /* Angular module instanciation */ - angular.module('SOGo.UICommon', []) - - .filter('encodeUri', function ($window) { - return $window.encodeURIComponent; - }) - - .filter('decodeUri', function ($window) { - return $window.decodeURIComponent; - }) - - .filter('loc', function () { - return l; - }); - -})(); diff --git a/UI/WebServerResources/js/Common/ui-desktop.js b/UI/WebServerResources/js/Common/ui-desktop.js index 91e1fcf99..afd73edbd 100644 --- a/UI/WebServerResources/js/Common/ui-desktop.js +++ b/UI/WebServerResources/js/Common/ui-desktop.js @@ -44,27 +44,16 @@ * 'OK' button */ Dialog.confirm = function(title, content) { - var d = this.$q.defer(); - this.$modal.open({ - template: - '<h2 data-ng-bind-html="title"></h2>' + - '<p data-ng-bind-html="content"></p>' + - '<a class="button button-primary" ng-click="confirm()">' + l('OK') + '</a>' + - '<a class="button button-secondary" ng-click="closeModal()">' + l('Cancel') + '</a>' + - '<span class="close-reveal-modal" ng-click="closeModal()"><i class="icon-close"></i></span>', - windowClass: 'small', - controller: function($scope, $modalInstance) { - $scope.title = title; - $scope.content = content; - $scope.closeModal = function() { - $modalInstance.close(); - d.resolve(false); - }; - $scope.confirm = function() { - $modalInstance.close(); - d.resolve(true); - }; - } + var d = this.$q.defer(), + confirm = this.$modal.confirm() + .title(title) + .content(content) + .ok(l('OK')) + .cancel(l('Cancel')); + this.$modal.show(confirm).then(function() { + d.resolve(); + }, function() { + d.reject(); }); return d.promise; }; @@ -102,14 +91,14 @@ * @memberof Dialog * @desc The factory we'll register as sgDialog in the Angular module SOGo.UIDesktop */ - Dialog.$factory = ['$modal', '$q', function($modal, $q) { - angular.extend(Dialog, { $modal: $modal, $q: $q }); + Dialog.$factory = ['$q', '$mdDialog', function($q, $mdDialog) { + angular.extend(Dialog, { $q: $q , $modal: $mdDialog }); return Dialog; // return constructor }]; /* Angular module instanciation */ - angular.module('SOGo.UIDesktop', ['mm.foundation', 'RecursionHelper']) + angular.module('SOGo.UIDesktop', ['ngMaterial', 'RecursionHelper']) /* Factory registration in Angular module */ .factory('sgDialog', Dialog.$factory) @@ -355,6 +344,7 @@ </div> </div> */ + /* .directive('sgDropdownContentToggle', ['$document', '$window', '$location', '$position', function ($document, $window, $location, $position) { var openElement = null, closeMenu = angular.noop; @@ -456,6 +446,7 @@ } }; }]) + */ /* * sgSubscribe - Common subscription widget @@ -501,7 +492,7 @@ <div sg-subscribe="contact" sg-subscribe-on-select="subscribeToFolder"></div> */ - .directive('sgUserTypeahead', ['$parse', '$q', '$timeout', '$position', 'sgUser', function($parse, $q, $timeout, $position, User) { + .directive('sgUserTypeahead', ['$parse', '$q', '$timeout', 'sgUser', function($parse, $q, $timeout, User) { return { restrict: 'A', require: 'ngModel', diff --git a/UI/WebServerResources/js/Common/utils.js b/UI/WebServerResources/js/Common/utils.js index e90414c9f..9c6dcb50e 100644 --- a/UI/WebServerResources/js/Common/utils.js +++ b/UI/WebServerResources/js/Common/utils.js @@ -1,5 +1,3 @@ -//$(document).foundation(); - String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; diff --git a/UI/WebServerResources/js/ContactsUI.js b/UI/WebServerResources/js/ContactsUI.js index 4e46495ce..22c93df3a 100644 --- a/UI/WebServerResources/js/ContactsUI.js +++ b/UI/WebServerResources/js/ContactsUI.js @@ -6,7 +6,7 @@ angular.module('SOGo.Common', []); - angular.module('SOGo.ContactsUI', ['ngSanitize', 'ui.router', 'mm.foundation', 'vs-repeat', 'SOGo.Common', 'SOGo.UI', 'SOGo.UIDesktop']) + angular.module('SOGo.ContactsUI', ['ngSanitize', 'ui.router', 'vs-repeat', 'SOGo.Common', 'SOGo.UI', 'SOGo.UIDesktop']) .constant('sgSettings', { baseURL: ApplicationBaseURL, @@ -83,7 +83,7 @@ $urlRouterProvider.otherwise('/personal'); }]) - .controller('AddressBookCtrl', ['$state', '$scope', '$rootScope', '$stateParams', '$timeout', '$modal', 'sgFocus', 'sgCard', 'sgAddressBook', 'sgDialog', 'sgSettings', 'stateAddressbooks', 'stateAddressbook', function($state, $scope, $rootScope, $stateParams, $timeout, $modal, focus, Card, AddressBook, Dialog, Settings, stateAddressbooks, stateAddressbook) { + .controller('AddressBookCtrl', ['$state', '$scope', '$rootScope', '$stateParams', '$timeout', '$mdDialog', 'sgFocus', 'sgCard', 'sgAddressBook', 'sgDialog', 'sgSettings', 'stateAddressbooks', 'stateAddressbook', function($state, $scope, $rootScope, $stateParams, $timeout, $modal, focus, Card, AddressBook, Dialog, Settings, stateAddressbooks, stateAddressbook) { var currentAddressbook; $scope.activeUser = Settings.activeUser; @@ -354,26 +354,23 @@ }; $scope.confirmDelete = function(card) { Dialog.confirm(l('Warning'), - l('Are you sure you want to delete the card of <em>%{0}</em>?', card.$fullname())) - .then(function(res) { - if (res) { - // User confirmed the deletion - card.$delete() - .then(function() { - // Remove card from list of addressbook - $rootScope.addressbook.cards = _.reject($rootScope.addressbook.cards, function(o) { - return o.id == card.id; - }); - // Remove card object from scope - $scope.card = null; - $state.go('addressbook', { addressbookId: $scope.addressbook.id }); - }, function(data, status) { - Dialog.alert(l('Warning'), l('An error occured while deleting the card "%{0}".', - card.$fullname())); + l('Are you sure you want to delete the card of %{0}?', card.$fullname())) + .then(function() { + // User confirmed the deletion + card.$delete() + .then(function() { + // Remove card from list of addressbook + $rootScope.addressbook.cards = _.reject($rootScope.addressbook.cards, function(o) { + return o.id == card.id; }); - } + // Remove card object from scope + $scope.card = null; + $state.go('addressbook', { addressbookId: $scope.addressbook.id }); + }, function(data, status) { + Dialog.alert(l('Warning'), l('An error occured while deleting the card "%{0}".', + card.$fullname())); + }); }); }; }]); - })(); diff --git a/UI/WebServerResources/js/MailerUI.js b/UI/WebServerResources/js/MailerUI.js index d84ddb385..abcb76997 100644 --- a/UI/WebServerResources/js/MailerUI.js +++ b/UI/WebServerResources/js/MailerUI.js @@ -7,7 +7,7 @@ angular.module('SOGo.Common', []); angular.module('SOGo.ContactsUI', []); - angular.module('SOGo.MailerUI', ['ngSanitize', 'ui.router', 'mm.foundation', 'vs-repeat', 'ck', 'ngTagsInput', 'angularFileUpload', 'SOGo.Common', 'SOGo.UI', 'SOGo.UICommon', 'SOGo.UIDesktop', 'SOGo.ContactsUI']) + angular.module('SOGo.MailerUI', ['ngSanitize', 'ui.router', 'vs-repeat', 'ck', 'ngTagsInput', 'angularFileUpload', 'SOGo.Common', 'SOGo.UI', 'SOGo.UIDesktop', 'SOGo.ContactsUI']) .constant('sgSettings', { baseURL: ApplicationBaseURL, @@ -172,7 +172,7 @@ }) }) - .controller('MailboxesCtrl', ['$scope', '$rootScope', '$stateParams', '$state', '$timeout', '$modal', 'sgFocus', 'encodeUriFilter', 'sgDialog', 'sgSettings', 'sgAccount', 'sgMailbox', 'stateAccounts', function($scope, $rootScope, $stateParams, $state, $timeout, $modal, focus, encodeUriFilter, Dialog, Settings, Account, Mailbox, stateAccounts) { + .controller('MailboxesCtrl', ['$scope', '$rootScope', '$stateParams', '$state', '$timeout', 'sgFocus', 'encodeUriFilter', 'sgDialog', 'sgSettings', 'sgAccount', 'sgMailbox', 'stateAccounts', function($scope, $rootScope, $stateParams, $state, $timeout, focus, encodeUriFilter, Dialog, Settings, Account, Mailbox, stateAccounts) { $scope.activeUser = Settings.activeUser; $scope.accounts = stateAccounts; @@ -233,7 +233,7 @@ } }]) - .controller('MailboxCtrl', ['$scope', '$rootScope', '$stateParams', 'stateAccount', 'stateMailbox', '$timeout', '$modal', 'sgFocus', 'sgDialog', 'sgAccount', 'sgMailbox', function($scope, $rootScope, $stateParams, stateAccount, stateMailbox, $timeout, $modal, focus, Dialog, Account, Mailbox) { + .controller('MailboxCtrl', ['$scope', '$rootScope', '$stateParams', 'stateAccount', 'stateMailbox', '$timeout', 'sgFocus', 'sgDialog', 'sgAccount', 'sgMailbox', function($scope, $rootScope, $stateParams, stateAccount, stateMailbox, $timeout, focus, Dialog, Account, Mailbox) { $scope.account = stateAccount; $scope.mailbox = stateMailbox; $rootScope.currentFolder = stateMailbox; @@ -242,7 +242,7 @@ }); }]) - .controller('MessageCtrl', ['$scope', '$rootScope', '$stateParams', '$state', 'stateAccount', 'stateMailbox', 'stateMessage', '$timeout', '$modal', 'encodeUriFilter', 'sgFocus', 'sgDialog', 'sgAccount', 'sgMailbox', function($scope, $rootScope, $stateParams, $state, stateAccount, stateMailbox, stateMessage, $timeout, $modal, encodeUriFilter, focus, Dialog, Account, Mailbox) { + .controller('MessageCtrl', ['$scope', '$rootScope', '$stateParams', '$state', 'stateAccount', 'stateMailbox', 'stateMessage', '$timeout', 'encodeUriFilter', 'sgFocus', 'sgDialog', 'sgAccount', 'sgMailbox', function($scope, $rootScope, $stateParams, $state, stateAccount, stateMailbox, stateMessage, $timeout, encodeUriFilter, focus, Dialog, Account, Mailbox) { $rootScope.message = stateMessage; $scope.loadImages = function() { // Load external resources @@ -273,7 +273,7 @@ }; }]) - .controller('MessageEditorCtrl', ['$scope', '$rootScope', '$stateParams', '$state', '$q', 'FileUploader', 'stateAccounts', 'stateMessage', '$timeout', '$modal', 'sgFocus', 'sgDialog', 'sgAccount', 'sgMailbox', 'sgAddressBook', function($scope, $rootScope, $stateParams, $state, $q, FileUploader, stateAccounts, stateMessage, $timeout, $modal, focus, Dialog, Account, Mailbox, AddressBook) { + .controller('MessageEditorCtrl', ['$scope', '$rootScope', '$stateParams', '$state', '$q', 'FileUploader', 'stateAccounts', 'stateMessage', '$timeout', 'sgFocus', 'sgDialog', 'sgAccount', 'sgMailbox', 'sgAddressBook', function($scope, $rootScope, $stateParams, $state, $q, FileUploader, stateAccounts, stateMessage, $timeout, focus, Dialog, Account, Mailbox, AddressBook) { if ($stateParams.actionName == 'reply') { stateMessage.$reply().then(function(msgObject) { $scope.message = msgObject;