mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-06 10:08:49 +02:00
Fixing Conflicts
This commit is contained in:
@@ -47,15 +47,9 @@ describe('User Model Unit Tests:', function() {
|
||||
});
|
||||
});
|
||||
|
||||
<<<<<<< HEAD
|
||||
it('should be able to save without problems', function(done) {
|
||||
user.save(done);
|
||||
});
|
||||
=======
|
||||
it('should be able to save whithout problems', function(done) {
|
||||
user.save(done);
|
||||
});
|
||||
>>>>>>> pr/63
|
||||
|
||||
it('should fail to save an existing user again', function(done) {
|
||||
user.save();
|
||||
|
||||
@@ -2,18 +2,10 @@
|
||||
|
||||
// Configuring the Articles module
|
||||
angular.module('articles').run(['Menus',
|
||||
<<<<<<< HEAD
|
||||
function(Menus) {
|
||||
// Set top bar menu items
|
||||
Menus.addMenuItem('topbar', 'Articles', 'articles', 'dropdown');
|
||||
Menus.addSubMenuItem('topbar', 'articles', 'List Articles', 'articles');
|
||||
Menus.addSubMenuItem('topbar', 'articles', 'New Article', 'articles/create');
|
||||
}
|
||||
=======
|
||||
function(Menus) {
|
||||
// Set top bar menu items
|
||||
Menus.addMenuItem('topbar', 'Articles', 'articles');
|
||||
Menus.addMenuItem('topbar', 'New Article', 'articles/create');
|
||||
}
|
||||
>>>>>>> pr/63
|
||||
]);
|
||||
]);
|
||||
@@ -1,16 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
<<<<<<< HEAD
|
||||
angular.module('core')
|
||||
.controller('HomeController', ['$scope', 'Authentication', function ($scope, Authentication) {
|
||||
// This provides Authentication context.
|
||||
// see /public/modules/users/services/authentication.client.service.js
|
||||
$scope.authentication = Authentication;
|
||||
}]);
|
||||
=======
|
||||
|
||||
angular.module('core').controller('HomeController', ['$scope', 'Authentication',
|
||||
function($scope, Authentication) {
|
||||
$scope.authentication = Authentication;
|
||||
}
|
||||
]);
|
||||
>>>>>>> pr/63
|
||||
function($scope, Authentication) {
|
||||
// This provides Authentication context.
|
||||
$scope.authentication = Authentication;
|
||||
}
|
||||
]);
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
//Menu service used for managing menus
|
||||
angular.module('core').service('Menus', [
|
||||
<<<<<<< HEAD
|
||||
function() {
|
||||
// Define a set of default roles
|
||||
this.defaultRoles = ['user'];
|
||||
@@ -12,14 +11,14 @@ angular.module('core').service('Menus', [
|
||||
|
||||
// A private function for rendering decision
|
||||
var shouldRender = function(user) {
|
||||
if(user) {
|
||||
if (user) {
|
||||
for (var userRoleIndex in user.roles) {
|
||||
for (var roleIndex in this.roles) {
|
||||
if(this.roles[roleIndex] === user.roles[userRoleIndex]) {
|
||||
if (this.roles[roleIndex] === user.roles[userRoleIndex]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return this.isPublic;
|
||||
}
|
||||
@@ -87,37 +86,37 @@ angular.module('core').service('Menus', [
|
||||
uiRoute: menuItemUIRoute || ('/' + menuItemURL),
|
||||
isPublic: isPublic || this.menus[menuId].isPublic,
|
||||
roles: roles || this.defaultRoles,
|
||||
subitems: [],
|
||||
subitems: [],
|
||||
shouldRender: shouldRender
|
||||
});
|
||||
|
||||
// Return the menu object
|
||||
return this.menus[menuId];
|
||||
};
|
||||
|
||||
|
||||
// Add submenu item object
|
||||
this.addSubMenuItem = function(menuId, rootMenuItemURL, menuItemTitle, menuItemURL, menuItemUIRoute, isPublic, roles) {
|
||||
// Validate that the menu exists
|
||||
this.validateMenuExistance(menuId);
|
||||
|
||||
// Search for menu item
|
||||
for (var itemIndex in this.menus[menuId].items) {
|
||||
if (this.menus[menuId].items[itemIndex].link === rootMenuItemURL) {
|
||||
// Push new submenu item
|
||||
this.menus[menuId].items[itemIndex].subitems.push({
|
||||
title: menuItemTitle,
|
||||
link: menuItemURL,
|
||||
uiRoute: menuItemUIRoute || ('/' + menuItemURL),
|
||||
isPublic: isPublic || this.menus[menuId].isPublic,
|
||||
roles: roles || this.defaultRoles,
|
||||
shouldRender: shouldRender
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Return the menu object
|
||||
return this.menus[menuId];
|
||||
};
|
||||
this.addSubMenuItem = function(menuId, rootMenuItemURL, menuItemTitle, menuItemURL, menuItemUIRoute, isPublic, roles) {
|
||||
// Validate that the menu exists
|
||||
this.validateMenuExistance(menuId);
|
||||
|
||||
// Search for menu item
|
||||
for (var itemIndex in this.menus[menuId].items) {
|
||||
if (this.menus[menuId].items[itemIndex].link === rootMenuItemURL) {
|
||||
// Push new submenu item
|
||||
this.menus[menuId].items[itemIndex].subitems.push({
|
||||
title: menuItemTitle,
|
||||
link: menuItemURL,
|
||||
uiRoute: menuItemUIRoute || ('/' + menuItemURL),
|
||||
isPublic: isPublic || this.menus[menuId].isPublic,
|
||||
roles: roles || this.defaultRoles,
|
||||
shouldRender: shouldRender
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Return the menu object
|
||||
return this.menus[menuId];
|
||||
};
|
||||
|
||||
// Remove existing menu object by menu id
|
||||
this.removeMenuItem = function(menuId, menuItemURL) {
|
||||
@@ -134,138 +133,26 @@ angular.module('core').service('Menus', [
|
||||
// Return the menu object
|
||||
return this.menus[menuId];
|
||||
};
|
||||
|
||||
|
||||
// Remove existing menu object by menu id
|
||||
this.removeSubMenuItem = function(menuId, submenuItemURL) {
|
||||
// Validate that the menu exists
|
||||
this.validateMenuExistance(menuId);
|
||||
|
||||
// Search for menu item to remove
|
||||
for (var itemIndex in this.menus[menuId].items) {
|
||||
for (var subitemIndex in this.menus[menuId].items[itemIndex].subitems) {
|
||||
if (this.menus[menuId].items[itemIndex].subitems[subitemIndex].link === submenuItemURL) {
|
||||
this.menus[menuId].items[itemIndex].subitems.splice(subitemIndex, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return the menu object
|
||||
return this.menus[menuId];
|
||||
};
|
||||
this.removeSubMenuItem = function(menuId, submenuItemURL) {
|
||||
// Validate that the menu exists
|
||||
this.validateMenuExistance(menuId);
|
||||
|
||||
// Search for menu item to remove
|
||||
for (var itemIndex in this.menus[menuId].items) {
|
||||
for (var subitemIndex in this.menus[menuId].items[itemIndex].subitems) {
|
||||
if (this.menus[menuId].items[itemIndex].subitems[subitemIndex].link === submenuItemURL) {
|
||||
this.menus[menuId].items[itemIndex].subitems.splice(subitemIndex, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return the menu object
|
||||
return this.menus[menuId];
|
||||
};
|
||||
|
||||
//Adding the topbar menu
|
||||
this.addMenu('topbar');
|
||||
}
|
||||
=======
|
||||
|
||||
function() {
|
||||
// Define a set of default roles
|
||||
this.defaultRoles = ['user'];
|
||||
|
||||
// Define the menus object
|
||||
this.menus = {};
|
||||
|
||||
// A private function for rendering decision
|
||||
var shouldRender = function(user) {
|
||||
if (user) {
|
||||
for (var userRoleIndex in user.roles) {
|
||||
for (var roleIndex in this.roles) {
|
||||
if (this.roles[roleIndex] === user.roles[userRoleIndex]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return this.isPublic;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// Validate menu existance
|
||||
this.validateMenuExistance = function(menuId) {
|
||||
if (menuId && menuId.length) {
|
||||
if (this.menus[menuId]) {
|
||||
return true;
|
||||
} else {
|
||||
throw new Error('Menu does not exists');
|
||||
}
|
||||
} else {
|
||||
throw new Error('MenuId was not provided');
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// Get the menu object by menu id
|
||||
this.getMenu = function(menuId) {
|
||||
// Validate that the menu exists
|
||||
this.validateMenuExistance(menuId);
|
||||
|
||||
// Return the menu object
|
||||
return this.menus[menuId];
|
||||
};
|
||||
|
||||
// Add new menu object by menu id
|
||||
this.addMenu = function(menuId, isPublic, roles) {
|
||||
// Create the new menu
|
||||
this.menus[menuId] = {
|
||||
isPublic: isPublic || false,
|
||||
roles: roles || this.defaultRoles,
|
||||
items: [],
|
||||
shouldRender: shouldRender
|
||||
};
|
||||
|
||||
// Return the menu object
|
||||
return this.menus[menuId];
|
||||
};
|
||||
|
||||
// Remove existing menu object by menu id
|
||||
this.removeMenu = function(menuId) {
|
||||
// Validate that the menu exists
|
||||
this.validateMenuExistance(menuId);
|
||||
|
||||
// Return the menu object
|
||||
delete this.menus[menuId];
|
||||
};
|
||||
|
||||
// Add menu item object
|
||||
this.addMenuItem = function(menuId, menuItemTitle, menuItemURL, menuItemUIRoute, isPublic, roles) {
|
||||
// Validate that the menu exists
|
||||
this.validateMenuExistance(menuId);
|
||||
|
||||
// Push new menu item
|
||||
this.menus[menuId].items.push({
|
||||
title: menuItemTitle,
|
||||
link: menuItemURL,
|
||||
uiRoute: menuItemUIRoute || ('/' + menuItemURL),
|
||||
isPublic: isPublic || this.menus[menuId].isPublic,
|
||||
roles: roles || this.defaultRoles,
|
||||
shouldRender: shouldRender
|
||||
});
|
||||
|
||||
// Return the menu object
|
||||
return this.menus[menuId];
|
||||
};
|
||||
|
||||
// Remove existing menu object by menu id
|
||||
this.removeMenuItem = function(menuId, menuItemURL) {
|
||||
// Validate that the menu exists
|
||||
this.validateMenuExistance(menuId);
|
||||
|
||||
// Search for menu item to remove
|
||||
for (var itemIndex in this.menus[menuId].items) {
|
||||
if (this.menus[menuId].items[itemIndex].link === menuItemURL) {
|
||||
this.menus[menuId].items.splice(itemIndex, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the menu object
|
||||
return this.menus[menuId];
|
||||
};
|
||||
|
||||
//Adding the topbar menu
|
||||
this.addMenu('topbar');
|
||||
}
|
||||
>>>>>>> pr/63
|
||||
]);
|
||||
]);
|
||||
Reference in New Issue
Block a user