Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit 9575fdc

Browse files
committed
Fixing Conflicts
1 parent 59fc0de commit 9575fdc

File tree

4 files changed

+52
-186
lines changed

4 files changed

+52
-186
lines changed

app/tests/user.server.model.test.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,9 @@ describe('User Model Unit Tests:', function() {
4747
});
4848
});
4949

50-
<<<<<<< HEAD
5150
it('should be able to save without problems', function(done) {
5251
user.save(done);
5352
});
54-
=======
55-
it('should be able to save whithout problems', function(done) {
56-
user.save(done);
57-
});
58-
>>>>>>> pr/63
5953

6054
it('should fail to save an existing user again', function(done) {
6155
user.save();

public/modules/articles/config/articles.client.config.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@
22

33
// Configuring the Articles module
44
angular.module('articles').run(['Menus',
5-
<<<<<<< HEAD
65
function(Menus) {
76
// Set top bar menu items
87
Menus.addMenuItem('topbar', 'Articles', 'articles', 'dropdown');
98
Menus.addSubMenuItem('topbar', 'articles', 'List Articles', 'articles');
109
Menus.addSubMenuItem('topbar', 'articles', 'New Article', 'articles/create');
1110
}
12-
=======
13-
function(Menus) {
14-
// Set top bar menu items
15-
Menus.addMenuItem('topbar', 'Articles', 'articles');
16-
Menus.addMenuItem('topbar', 'New Article', 'articles/create');
17-
}
18-
>>>>>>> pr/63
19-
]);
11+
]);
Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
'use strict';
22

3-
<<<<<<< HEAD
4-
angular.module('core')
5-
.controller('HomeController', ['$scope', 'Authentication', function ($scope, Authentication) {
6-
// This provides Authentication context.
7-
// see /public/modules/users/services/authentication.client.service.js
8-
$scope.authentication = Authentication;
9-
}]);
10-
=======
3+
114
angular.module('core').controller('HomeController', ['$scope', 'Authentication',
12-
function($scope, Authentication) {
13-
$scope.authentication = Authentication;
14-
}
15-
]);
16-
>>>>>>> pr/63
5+
function($scope, Authentication) {
6+
// This provides Authentication context.
7+
$scope.authentication = Authentication;
8+
}
9+
]);

public/modules/core/services/menus.client.service.js

Lines changed: 45 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
//Menu service used for managing menus
44
angular.module('core').service('Menus', [
5-
<<<<<<< HEAD
65
function() {
76
// Define a set of default roles
87
this.defaultRoles = ['user'];
@@ -12,14 +11,14 @@ angular.module('core').service('Menus', [
1211

1312
// A private function for rendering decision
1413
var shouldRender = function(user) {
15-
if(user) {
14+
if (user) {
1615
for (var userRoleIndex in user.roles) {
1716
for (var roleIndex in this.roles) {
18-
if(this.roles[roleIndex] === user.roles[userRoleIndex]) {
17+
if (this.roles[roleIndex] === user.roles[userRoleIndex]) {
1918
return true;
2019
}
2120
}
22-
}
21+
}
2322
} else {
2423
return this.isPublic;
2524
}
@@ -87,37 +86,37 @@ angular.module('core').service('Menus', [
8786
uiRoute: menuItemUIRoute || ('/' + menuItemURL),
8887
isPublic: isPublic || this.menus[menuId].isPublic,
8988
roles: roles || this.defaultRoles,
90-
subitems: [],
89+
subitems: [],
9190
shouldRender: shouldRender
9291
});
9392

9493
// Return the menu object
9594
return this.menus[menuId];
9695
};
97-
96+
9897
// Add submenu item object
99-
this.addSubMenuItem = function(menuId, rootMenuItemURL, menuItemTitle, menuItemURL, menuItemUIRoute, isPublic, roles) {
100-
// Validate that the menu exists
101-
this.validateMenuExistance(menuId);
102-
103-
// Search for menu item
104-
for (var itemIndex in this.menus[menuId].items) {
105-
if (this.menus[menuId].items[itemIndex].link === rootMenuItemURL) {
106-
// Push new submenu item
107-
this.menus[menuId].items[itemIndex].subitems.push({
108-
title: menuItemTitle,
109-
link: menuItemURL,
110-
uiRoute: menuItemUIRoute || ('/' + menuItemURL),
111-
isPublic: isPublic || this.menus[menuId].isPublic,
112-
roles: roles || this.defaultRoles,
113-
shouldRender: shouldRender
114-
});
115-
}
116-
}
117-
118-
// Return the menu object
119-
return this.menus[menuId];
120-
};
98+
this.addSubMenuItem = function(menuId, rootMenuItemURL, menuItemTitle, menuItemURL, menuItemUIRoute, isPublic, roles) {
99+
// Validate that the menu exists
100+
this.validateMenuExistance(menuId);
101+
102+
// Search for menu item
103+
for (var itemIndex in this.menus[menuId].items) {
104+
if (this.menus[menuId].items[itemIndex].link === rootMenuItemURL) {
105+
// Push new submenu item
106+
this.menus[menuId].items[itemIndex].subitems.push({
107+
title: menuItemTitle,
108+
link: menuItemURL,
109+
uiRoute: menuItemUIRoute || ('/' + menuItemURL),
110+
isPublic: isPublic || this.menus[menuId].isPublic,
111+
roles: roles || this.defaultRoles,
112+
shouldRender: shouldRender
113+
});
114+
}
115+
}
116+
117+
// Return the menu object
118+
return this.menus[menuId];
119+
};
121120

122121
// Remove existing menu object by menu id
123122
this.removeMenuItem = function(menuId, menuItemURL) {
@@ -134,138 +133,26 @@ angular.module('core').service('Menus', [
134133
// Return the menu object
135134
return this.menus[menuId];
136135
};
137-
136+
138137
// Remove existing menu object by menu id
139-
this.removeSubMenuItem = function(menuId, submenuItemURL) {
140-
// Validate that the menu exists
141-
this.validateMenuExistance(menuId);
142-
143-
// Search for menu item to remove
144-
for (var itemIndex in this.menus[menuId].items) {
145-
for (var subitemIndex in this.menus[menuId].items[itemIndex].subitems) {
146-
if (this.menus[menuId].items[itemIndex].subitems[subitemIndex].link === submenuItemURL) {
147-
this.menus[menuId].items[itemIndex].subitems.splice(subitemIndex, 1);
148-
}
149-
}
150-
}
151-
152-
// Return the menu object
153-
return this.menus[menuId];
154-
};
138+
this.removeSubMenuItem = function(menuId, submenuItemURL) {
139+
// Validate that the menu exists
140+
this.validateMenuExistance(menuId);
141+
142+
// Search for menu item to remove
143+
for (var itemIndex in this.menus[menuId].items) {
144+
for (var subitemIndex in this.menus[menuId].items[itemIndex].subitems) {
145+
if (this.menus[menuId].items[itemIndex].subitems[subitemIndex].link === submenuItemURL) {
146+
this.menus[menuId].items[itemIndex].subitems.splice(subitemIndex, 1);
147+
}
148+
}
149+
}
150+
151+
// Return the menu object
152+
return this.menus[menuId];
153+
};
155154

156155
//Adding the topbar menu
157156
this.addMenu('topbar');
158157
}
159-
=======
160-
161-
function() {
162-
// Define a set of default roles
163-
this.defaultRoles = ['user'];
164-
165-
// Define the menus object
166-
this.menus = {};
167-
168-
// A private function for rendering decision
169-
var shouldRender = function(user) {
170-
if (user) {
171-
for (var userRoleIndex in user.roles) {
172-
for (var roleIndex in this.roles) {
173-
if (this.roles[roleIndex] === user.roles[userRoleIndex]) {
174-
return true;
175-
}
176-
}
177-
}
178-
} else {
179-
return this.isPublic;
180-
}
181-
182-
return false;
183-
};
184-
185-
// Validate menu existance
186-
this.validateMenuExistance = function(menuId) {
187-
if (menuId && menuId.length) {
188-
if (this.menus[menuId]) {
189-
return true;
190-
} else {
191-
throw new Error('Menu does not exists');
192-
}
193-
} else {
194-
throw new Error('MenuId was not provided');
195-
}
196-
197-
return false;
198-
};
199-
200-
// Get the menu object by menu id
201-
this.getMenu = function(menuId) {
202-
// Validate that the menu exists
203-
this.validateMenuExistance(menuId);
204-
205-
// Return the menu object
206-
return this.menus[menuId];
207-
};
208-
209-
// Add new menu object by menu id
210-
this.addMenu = function(menuId, isPublic, roles) {
211-
// Create the new menu
212-
this.menus[menuId] = {
213-
isPublic: isPublic || false,
214-
roles: roles || this.defaultRoles,
215-
items: [],
216-
shouldRender: shouldRender
217-
};
218-
219-
// Return the menu object
220-
return this.menus[menuId];
221-
};
222-
223-
// Remove existing menu object by menu id
224-
this.removeMenu = function(menuId) {
225-
// Validate that the menu exists
226-
this.validateMenuExistance(menuId);
227-
228-
// Return the menu object
229-
delete this.menus[menuId];
230-
};
231-
232-
// Add menu item object
233-
this.addMenuItem = function(menuId, menuItemTitle, menuItemURL, menuItemUIRoute, isPublic, roles) {
234-
// Validate that the menu exists
235-
this.validateMenuExistance(menuId);
236-
237-
// Push new menu item
238-
this.menus[menuId].items.push({
239-
title: menuItemTitle,
240-
link: menuItemURL,
241-
uiRoute: menuItemUIRoute || ('/' + menuItemURL),
242-
isPublic: isPublic || this.menus[menuId].isPublic,
243-
roles: roles || this.defaultRoles,
244-
shouldRender: shouldRender
245-
});
246-
247-
// Return the menu object
248-
return this.menus[menuId];
249-
};
250-
251-
// Remove existing menu object by menu id
252-
this.removeMenuItem = function(menuId, menuItemURL) {
253-
// Validate that the menu exists
254-
this.validateMenuExistance(menuId);
255-
256-
// Search for menu item to remove
257-
for (var itemIndex in this.menus[menuId].items) {
258-
if (this.menus[menuId].items[itemIndex].link === menuItemURL) {
259-
this.menus[menuId].items.splice(itemIndex, 1);
260-
}
261-
}
262-
263-
// Return the menu object
264-
return this.menus[menuId];
265-
};
266-
267-
//Adding the topbar menu
268-
this.addMenu('topbar');
269-
}
270-
>>>>>>> pr/63
271-
]);
158+
]);

0 commit comments

Comments
 (0)