Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
Joni-Aaltonen committed Jun 29, 2015
1 parent e53d41e commit 2769231
Show file tree
Hide file tree
Showing 21 changed files with 1,373 additions and 517 deletions.
5 changes: 3 additions & 2 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="bower_components/angular-worldskills-utils/src/spinner.css" />
<!-- endbower -->
<!-- endbuild -->
<!-- build:css(.tmp) styles/main.css -->
Expand Down Expand Up @@ -75,8 +74,9 @@
</div>
</div>
</div>
<!-- <div class="appContainer" ng-view=""></div> -->
<!-- <div class="appContainer" ng-view=""></div> -->
<div class='container' ng-controller='MainCtrl'>
<alerts></alerts>
<div ui-view></div>
</div>
<div class='container'>
Expand Down Expand Up @@ -190,6 +190,7 @@
<script src="scripts/services/events.js"></script>
<script src="scripts/services/user.js"></script>
<script src="scripts/services/statuses.js"></script>
<script src="scripts/services/connections.js"></script>
<!-- endbuild -->
</body>
</html>
2 changes: 1 addition & 1 deletion app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ angular
controller: 'EventsCtrl',
data: {
requireLoggedIn: true,
forbiddenCallback: function(auth, $state){
unAuthenticatedCallback: function(auth, $state){
$state.go('signup');
},
requiredRoles: [
Expand Down
25 changes: 24 additions & 1 deletion app/scripts/controllers/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,36 @@
* Controller of the connectApp
*/
angular.module('connectApp')
.controller('EventCtrl', function ($scope, $http, Statuses) {
.controller('EventCtrl', function ($scope, $http, Statuses, User, $state) {

$scope.sortType = 'name'; // set the default sort type
$scope.sortReverse = false; // set the default sort order
$scope.searchContact = ''; // set the default search/filter term
$scope.Statuses = Statuses;
$scope.STATUS = Statuses.status();
$scope.loading.event = false;

$scope.eventId = $state.params.eventId;

$scope.setAttendance = function(status, e){
e.preventDefault();
//e.stopPropagation();

$scope.loading.event = true;

User.setAttendance($scope.eventId, status).then(function(res){
//set status to UI
if(typeof User.data.subscriptions[$scope.eventId] == 'undefined') //init
User.data.subscriptions[$scope.eventId] = {};

User.data.subscriptions[$scope.eventId].status = res.status;
$scope.loading.event = false;
},
function(error){
WSAlert.danger(error);
$scope.loading.event = false;
});
};


$scope.contacts = [
Expand Down
10 changes: 9 additions & 1 deletion app/scripts/controllers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ angular.module('connectApp')

$scope.loading.events = {};
$scope.STATUS = Statuses.status();
$scope.email = 'testing';

$scope.setAttendance = function(eventId, status, e){
e.preventDefault();
Expand All @@ -33,4 +34,11 @@ angular.module('connectApp')
$scope.loading.events[eventId] = false;
});
};
});
})
.directive('events', function(){
return {
restrict: 'E',
replace: true,
templateUrl: 'views/directive.events.html'
}
});
5 changes: 2 additions & 3 deletions app/scripts/controllers/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

angular.module('connectApp')
.controller('MainCtrl', function ($scope, $state, $rootScope, $translate, Language, User, Events, Statuses, auth) {
.controller('MainCtrl', function ($q, $scope, $state, $rootScope, $translate, Language, User, Events, Statuses, auth, WSAlert) {
$scope.selectedLanguage = Language.selectedLanguage;

//redirect to events state - if logged in
Expand All @@ -17,8 +17,7 @@ angular.module('connectApp')
$scope.statuses = Statuses;
$scope.loading = {};

User.init().then(function(result){
//console.log('user init');
$q.when(User.init()).then(function(result){
User.subscriptions($scope.user.data.id).then(function(res){
//console.log('subscriptions loaded');
},
Expand Down
Loading

0 comments on commit 2769231

Please sign in to comment.