-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonathan Spratley
committed
Dec 1, 2014
1 parent
af2e8ba
commit 365ca4f
Showing
9 changed files
with
218 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,62 @@ | ||
'use strict' | ||
angular.module('angularCmsApp').controller('UsersCtrl', ($scope, DataService) -> | ||
$scope.awesomeThings = [ | ||
'HTML5 Boilerplate' | ||
'AngularJS' | ||
'Karma' | ||
] | ||
|
||
$scope.user = | ||
username: null | ||
email: null | ||
password: null | ||
role: null | ||
created: new Date() | ||
modified: new Date() | ||
metadata: | ||
avatar: '' | ||
name: null | ||
aboue: null | ||
|
||
#Hold the users | ||
$scope.users = [] | ||
|
||
#Holds the user groups | ||
$scope.groups = ['Admin', 'Member', 'Public'] | ||
|
||
$scope.getGroups = () -> | ||
DataService.fetch('groups').then((data) -> | ||
$scope.groups = data | ||
console.log(data) | ||
) | ||
$scope.awesomeThings = [ | ||
'HTML5 Boilerplate' | ||
'AngularJS' | ||
'Karma' | ||
] | ||
|
||
#Select user | ||
$scope.selectUser = (user) -> | ||
$scope.user = user | ||
$scope.user = | ||
username: null | ||
email: null | ||
password: null | ||
role: null | ||
created: new Date() | ||
modified: new Date() | ||
metadata: | ||
avatar: '' | ||
name: null | ||
aboue: null | ||
|
||
#Get users | ||
$scope.getUsers = () -> | ||
DataService.fetch('users').then((data) -> | ||
$scope.users = data | ||
$scope.getGroups() unless $scope.groups | ||
) | ||
#Hold the users | ||
$scope.users = [] | ||
|
||
#Holds the user groups | ||
$scope.groups = ['Admin', 'Member', 'Public'] | ||
|
||
#Delete user | ||
$scope.deleteUser = (index, user) -> | ||
ask = confirm "Delete #{user.email}?" | ||
$scope.getGroups = () -> | ||
DataService.fetch('groups').then((results) -> | ||
$scope.groups = results.data | ||
console.log(data) | ||
) | ||
|
||
if ask | ||
DataService.destroy('users', user).then((data) -> | ||
$scope.users.pop(index) | ||
$scope.getUsers() | ||
) | ||
#Select user | ||
$scope.selectUser = (user) -> | ||
$scope.user = user | ||
|
||
#Add user to database | ||
$scope.addUser = (user) -> | ||
DataService.save('users', user).then((data) -> | ||
#Get users | ||
$scope.getUsers = () -> | ||
DataService.fetch('users').then((results) -> | ||
$scope.users = results.data | ||
$scope.getGroups() unless $scope.groups | ||
) | ||
|
||
#Delete user | ||
$scope.deleteUser = (index, user) -> | ||
ask = confirm "Delete #{user.email}?" | ||
|
||
if ask | ||
DataService.destroy('users', user).then((data) -> | ||
$scope.users.pop(index) | ||
$scope.getUsers() | ||
#$scope.users.push(user) unless user._id | ||
$scope.user = {} | ||
$('#user-modal').modal('hide') | ||
) | ||
|
||
|
||
#Add user to database | ||
$scope.addUser = (user) -> | ||
DataService.save('users', user).then((data) -> | ||
$scope.getUsers() | ||
#$scope.users.push(user) unless user._id | ||
$scope.user = {} | ||
$('#user-modal').modal('hide') | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
// An example configuration file. | ||
exports.config = { | ||
// The address of a running selenium server. | ||
seleniumAddress: 'http://localhost:4444/wd/hub', | ||
// The address of a running selenium server. | ||
seleniumAddress: 'http://localhost:4444/wd/hub', | ||
params: { | ||
baseUrl: 'http://localhost:9000/#' | ||
}, | ||
|
||
// Capabilities to be passed to the webdriver instance. | ||
capabilities: { | ||
'browserName': 'chrome' | ||
}, | ||
// Capabilities to be passed to the webdriver instance. | ||
capabilities: { | ||
'browserName': 'chrome' | ||
} | ||
, | ||
|
||
// Spec patterns are relative to the current working directly when | ||
// protractor is called. | ||
specs: [ | ||
'.tmp/protractor/*.js', | ||
'test/protractor/*.js' | ||
], | ||
// Spec patterns are relative to the current working directly when | ||
// protractor is called. | ||
specs: [ | ||
'.tmp/protractor/*.js', | ||
'test/protractor/*.js' | ||
], | ||
|
||
// Options to be passed to Jasmine-node. | ||
jasmineNodeOpts: { | ||
showColors: true, | ||
defaultTimeoutInterval: 30000 | ||
} | ||
// Options to be passed to Jasmine-node. | ||
jasmineNodeOpts: { | ||
showColors: true, | ||
defaultTimeoutInterval: 30000 | ||
}, | ||
onPrepare: function () { | ||
var SpecReporter = require( 'jasmine-spec-reporter' ); | ||
// add jasmine spec reporter | ||
jasmine.getEnv().addReporter( new SpecReporter( {displayStacktrace: true} ) ); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.