Skip to content

Commit

Permalink
Remove all IIFEs (#1172)
Browse files Browse the repository at this point in the history
Now we are in npm/webpack world we don't need these to give us scope.
  • Loading branch information
nicksellen authored and simison committed Jan 11, 2020
1 parent 1bb2908 commit ea51189
Show file tree
Hide file tree
Showing 142 changed files with 10,149 additions and 10,435 deletions.
166 changes: 82 additions & 84 deletions modules/admin/client/config/admin.client.routes.js
Original file line number Diff line number Diff line change
@@ -1,87 +1,85 @@
(function () {
angular
.module('admin')
.config(AdminRoutes);
angular
.module('admin')
.config(AdminRoutes);

/* @ngInject */
function AdminRoutes($stateProvider) {
/* @ngInject */
function AdminRoutes($stateProvider) {

$stateProvider.
state('admin', {
url: '/admin',
template: '<admin></admin>', // This should be lowercase
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin',
},
}).
state('admin-audit-log', {
url: '/admin/audit-log',
// `template` is Angular state so
// it should be lowercase, with dashes
// This is the bridge towards (and from) React
template: '<admin-audit-log></admin-audit-log>',
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin - Audit log',
},
}).
state('admin-acquisition-stories', {
url: '/admin/acquisition-stories',
// `template` is Angular state so
// it should be lowercase, with dashes
// This is the bridge towards (and from) React
template: '<admin-acquisition-stories></admin-acquisition-stories>',
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin - Acquisition stories',
},
}).
state('admin-messages', {
url: '/admin/messages',
// `template` is Angular state so
// it should be lowercase, with dashes
// This is the bridge towards (and from) React
template: '<admin-messages></admin-messages>',
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin - Messages',
},
}).
state('admin-search-users', {
url: '/admin/search-users',
// `template` is Angular state so
// it should be lowercase, with dashes
// This is the bridge towards (and from) React
template: '<admin-search-users></admin-search-users>',
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin - Search users',
},
}).
state('admin-user', {
url: '/admin/user',
// `template` is Angular state so
// it should be lowercase, with dashes
// This is the bridge towards (and from) React
template: '<admin-user></admin-user>',
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin - User',
},
});
$stateProvider.
state('admin', {
url: '/admin',
template: '<admin></admin>', // This should be lowercase
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin',
},
}).
state('admin-audit-log', {
url: '/admin/audit-log',
// `template` is Angular state so
// it should be lowercase, with dashes
// This is the bridge towards (and from) React
template: '<admin-audit-log></admin-audit-log>',
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin - Audit log',
},
}).
state('admin-acquisition-stories', {
url: '/admin/acquisition-stories',
// `template` is Angular state so
// it should be lowercase, with dashes
// This is the bridge towards (and from) React
template: '<admin-acquisition-stories></admin-acquisition-stories>',
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin - Acquisition stories',
},
}).
state('admin-messages', {
url: '/admin/messages',
// `template` is Angular state so
// it should be lowercase, with dashes
// This is the bridge towards (and from) React
template: '<admin-messages></admin-messages>',
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin - Messages',
},
}).
state('admin-search-users', {
url: '/admin/search-users',
// `template` is Angular state so
// it should be lowercase, with dashes
// This is the bridge towards (and from) React
template: '<admin-search-users></admin-search-users>',
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin - Search users',
},
}).
state('admin-user', {
url: '/admin/user',
// `template` is Angular state so
// it should be lowercase, with dashes
// This is the bridge towards (and from) React
template: '<admin-user></admin-user>',
requiresRole: 'admin',
requiresAuth: true,
footerHidden: true,
data: {
pageTitle: 'Admin - User',
},
});

}
}());
}
100 changes: 49 additions & 51 deletions modules/contacts/client/config/contacts.client.routes.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,57 @@
import contactAddTemplateUrl from '@/modules/contacts/client/views/add-contact.client.view.html';
import contactConfirmTemplateUrl from '@/modules/contacts/client/views/confirm-contact.client.view.html';

(function () {
angular
.module('contacts')
.config(ContactsRoutes);

/* @ngInject */
function ContactsRoutes($stateProvider) {

$stateProvider.
state('contactAdd', {
url: '/contact-add/:userId',
templateUrl: contactAddTemplateUrl,
requiresAuth: true,
controller: 'ContactAddController',
controllerAs: 'contactAdd',
resolve: {
// A string value resolves to a service
ContactByService: 'ContactByService',
UsersMini: 'UsersMini',

existingContact: function (ContactByService, $stateParams) {
return ContactByService.get({ userId: $stateParams.userId });
},

friend: function (UsersMini, $stateParams) {
return UsersMini.get({
userId: $stateParams.userId,
});
},
angular
.module('contacts')
.config(ContactsRoutes);

/* @ngInject */
function ContactsRoutes($stateProvider) {

$stateProvider.
state('contactAdd', {
url: '/contact-add/:userId',
templateUrl: contactAddTemplateUrl,
requiresAuth: true,
controller: 'ContactAddController',
controllerAs: 'contactAdd',
resolve: {
// A string value resolves to a service
ContactByService: 'ContactByService',
UsersMini: 'UsersMini',

existingContact: function (ContactByService, $stateParams) {
return ContactByService.get({ userId: $stateParams.userId });
},
data: {
pageTitle: 'Add contact',
},
}).
state('contactConfirm', {
url: '/contact-confirm/:contactId',
templateUrl: contactConfirmTemplateUrl,
requiresAuth: true,
controller: 'ContactConfirmController',
controllerAs: 'contactConfirm',
resolve: {
// A string value resolves to a service
Contact: 'Contact',

contact: function (Contact, $stateParams) {
return Contact.get({ contactId: $stateParams.contactId });
},

friend: function (UsersMini, $stateParams) {
return UsersMini.get({
userId: $stateParams.userId,
});
},
data: {
pageTitle: 'Confirm contact',
},
data: {
pageTitle: 'Add contact',
},
}).
state('contactConfirm', {
url: '/contact-confirm/:contactId',
templateUrl: contactConfirmTemplateUrl,
requiresAuth: true,
controller: 'ContactConfirmController',
controllerAs: 'contactConfirm',
resolve: {
// A string value resolves to a service
Contact: 'Contact',

contact: function (Contact, $stateParams) {
return Contact.get({ contactId: $stateParams.contactId });
},
});

}
}());
},
data: {
pageTitle: 'Confirm contact',
},
});

}
Loading

0 comments on commit ea51189

Please sign in to comment.