templateCache everywhere

This commit is contained in:
Sam 2016-04-27 21:16:01 +03:00
parent 3694cab7bb
commit 13c0f35f1d
6 changed files with 73 additions and 64 deletions

View file

@ -1,18 +1,19 @@
'use strict';
// Setting up route
angular.module('forms').config(['$stateProvider',
angular.module('forms').config([
'$stateProvider', '$templateCache',
function($stateProvider) {
function($stateProvider, $templateCache) {
// Forms state routing
$stateProvider.
state('listForms', {
url: '/forms',
templateUrl: 'modules/forms/views/list-forms.client.view.html'
template: $templateCache.get('modules/forms/views/list-forms.client.view.html')
}).
state('submitForm', {
url: '/forms/:formId',
templateUrl: 'modules/forms/views/submit-form.client.view.html',
template: $templateCache.get('modules/forms/views/submit-form.client.view.html'),
data: {
hideNav: true,
},
@ -26,7 +27,7 @@ angular.module('forms').config(['$stateProvider',
controllerAs: 'ctrl'
}).state('viewForm', {
url: '/forms/:formId/admin',
templateUrl: 'modules/forms/views/admin-form.client.view.html',
template: $templateCache.get('modules/forms/views/admin-form.client.view.html'),
data: {
permissions: [ 'editForm' ]
},
@ -39,16 +40,16 @@ angular.module('forms').config(['$stateProvider',
controller: 'AdminFormController'
}).state('viewForm.configure', {
url: '/configure',
templateUrl: 'modules/forms/views/adminTabs/configure.html'
template: $templateCache.get('modules/forms/views/adminTabs/configure.html')
}).state('viewForm.design', {
url: '/design',
templateUrl: 'modules/forms/views/adminTabs/design.html'
template: $templateCache.get('modules/forms/views/adminTabs/design.html')
}).state('viewForm.analyze', {
url: '/analyze',
templateUrl: 'modules/forms/views/adminTabs/analyze.html',
template: $templateCache.get('modules/forms/views/adminTabs/analyze.html')
}).state('viewForm.create', {
url: '/create',
templateUrl: 'modules/forms/views/adminTabs/create.html'
template: $templateCache.get('modules/forms/views/adminTabs/create.html')
});
}
]);

View file

@ -1,8 +1,12 @@
'use strict';
// Forms controller
angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm',
function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm) {
angular.module('forms').controller('AdminFormController', [
'$rootScope', '$scope', '$stateParams', '$state', 'Forms',
'CurrentForm', '$http', '$uibModal', 'myForm',
function($rootScope, $scope, $stateParams, $state, Forms,
CurrentForm, $http, $uibModal, myForm) {
$scope = $rootScope;
$scope.animationsEnabled = true;

View file

@ -1,9 +1,10 @@
'use strict';
angular.module('forms').directive('configureFormDirective', ['$rootScope', '$http', 'Upload', 'CurrentForm',
function ($rootScope, $http, Upload, CurrentForm) {
angular.module('forms').directive('configureFormDirective', [
'$rootScope', '$http', 'Upload', 'CurrentForm', '$templateCache',
function ($rootScope, $http, Upload, CurrentForm, $templateCache) {
return {
templateUrl: 'modules/forms/views/directiveViews/form/configure-form.client.view.html',
template: $templateCache.get('modules/forms/views/directiveViews/form/configure-form.client.view.html'),
restrict: 'E',
scope: {
myform:'=',

View file

@ -1,9 +1,10 @@
'use strict';
angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormFields',
function ($rootScope, FormFields) {
angular.module('forms').directive('editFormDirective', [
'$rootScope', 'FormFields', '$templateCache',
function ($rootScope, FormFields, $templateCache) {
return {
templateUrl: 'modules/forms/views/directiveViews/form/edit-form.client.view.html',
template: $templateCache.get('modules/forms/views/directiveViews/form/edit-form.client.view.html'),
restrict: 'E',
scope: {
myform:'=',

View file

@ -1,9 +1,10 @@
'use strict';
angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope', '$http',
function ($rootScope, $http) {
angular.module('forms').directive('editSubmissionsFormDirective', [
'$rootScope', '$http', '$templateCache',
function ($rootScope, $http, $templateCache) {
return {
templateUrl: 'modules/forms/views/directiveViews/form/edit-submissions-form.client.view.html',
template: $templateCache.get('modules/forms/views/directiveViews/form/edit-submissions-form.client.view.html'),
restrict: 'E',
scope: {
myform:'=',

View file

@ -1,8 +1,9 @@
'use strict';
// Setting up route
angular.module('users').config(['$stateProvider',
function($stateProvider) {
angular.module('users').config([
'$stateProvider', '$templateCache',
function($stateProvider, $templateCache) {
var checkLoggedin = function($q, $timeout, $state, User, Auth) {
var deferred = $q.defer();
@ -34,64 +35,64 @@ angular.module('users').config(['$stateProvider',
loggedin: checkLoggedin
},
url: '/settings/profile',
templateUrl: 'modules/users/views/settings/edit-profile.client.view.html'
template: $templateCache.get('modules/users/views/settings/edit-profile.client.view.html')
}).
state('password', {
resolve: {
loggedin: checkLoggedin
},
url: '/settings/password',
templateUrl: 'modules/users/views/settings/change-password.client.view.html'
template: $templateCache.get('modules/users/views/settings/change-password.client.view.html')
}).
state('accounts', {
resolve: {
loggedin: checkLoggedin
},
url: '/settings/accounts',
templateUrl: 'modules/users/views/settings/social-accounts.client.view.html'
template: $templateCache.get('modules/users/views/settings/social-accounts.client.view.html')
}).
state('signup', {
url: '/signup',
templateUrl: 'modules/users/views/authentication/signup.client.view.html'
template: $templateCache.get('modules/users/views/authentication/signup.client.view.html')
}).
state('signup-success', {
url: '/signup-success',
templateUrl: 'modules/users/views/authentication/signup-success.client.view.html'
template: $templateCache.get('modules/users/views/authentication/signup-success.client.view.html')
}).
state('signin', {
url: '/signin',
templateUrl: 'modules/users/views/authentication/signin.client.view.html'
template: $templateCache.get('modules/users/views/authentication/signin.client.view.html')
}).
state('access_denied', {
url: '/access_denied',
templateUrl: 'modules/users/views/authentication/access-denied.client.view.html'
template: $templateCache.get('modules/users/views/authentication/access-denied.client.view.html')
}).
state('resendVerifyEmail', {
url: '/verify',
templateUrl: 'modules/users/views/verify/resend-verify-email.client.view.html'
template: $templateCache.get('modules/users/views/verify/resend-verify-email.client.view.html')
}).
state('verify', {
url: '/verify/:token',
templateUrl: 'modules/users/views/verify/verify-account.client.view.html'
template: $templateCache.get('modules/users/views/verify/verify-account.client.view.html')
}).
state('forgot', {
url: '/password/forgot',
templateUrl: 'modules/users/views/password/forgot-password.client.view.html'
template: $templateCache.get('modules/users/views/password/forgot-password.client.view.html')
}).
state('reset-invalid', {
url: '/password/reset/invalid',
templateUrl: 'modules/users/views/password/reset-password-invalid.client.view.html'
template: $templateCache.get('modules/users/views/password/reset-password-invalid.client.view.html')
}).
state('reset-success', {
url: '/password/reset/success',
templateUrl: 'modules/users/views/password/reset-password-success.client.view.html'
template: $templateCache.get('modules/users/views/password/reset-password-success.client.view.html')
}).
state('reset', {
url: '/password/reset/:token',
templateUrl: 'modules/users/views/password/reset-password.client.view.html'
template: $templateCache.get('modules/users/views/password/reset-password.client.view.html')
});
}
]);