Skip to content

Commit

Permalink
Modularize result list
Browse files Browse the repository at this point in the history
  • Loading branch information
moradology committed Sep 19, 2015
1 parent 0f75e25 commit 1148d5f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 27 deletions.
27 changes: 1 addition & 26 deletions www/modules/app.dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,34 +595,9 @@ define(['angular', 'moment', 'socket', 'jquery', 'underscore'], function (angula
}


}
};
},

listResult: function ($state, $http) {
return {
restrict: 'E',
scope: {
proposal: '=',
result: '=',
key: '='
},
templateUrl: 'html/listResult.html',
link: function (scope) {
scope.saveResult = function () {
delete scope.result.edit;
scope.proposal[scope.result.who] = scope.result;
var pushComponents = {};
pushComponents.uid = scope.proposal.uid;
pushComponents.who = scope.result.who;
pushComponents[scope.result.who] = scope.result;
pushComponents.key = scope.key;
$http.post('/api/proposalResult', pushComponents).then(function () {
$state.go('proposal/:uid/:resultee', {uid: scope.proposal.uid, resultee: ''});
});
};
}
};
}

};
});
4 changes: 3 additions & 1 deletion www/modules/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ define([
'mediaImages/edit/dir',
'budget/list/dir',
'attachments/edit/dir',
'result/list/dir',
'app.filter',
'angular-ui-router'
], function (angular,
appSvc, appCtrl, appCfg, appDir, appDirToolbar, appDirEditOwners, appDirEditMediaImages,
budgetList, appDirEditAttachments, appFilt) {
budgetList, appDirEditAttachments, appDirListResult, appFilt) {
'use strict';

return angular.module('app', ['ui.router'])
Expand All @@ -30,5 +31,6 @@ define([
.directive(appDirEditMediaImages)
.directive(budgetList)
.directive(appDirEditAttachments)
.directive(appDirListResult)
.filter(appFilt);
});
34 changes: 34 additions & 0 deletions www/modules/result/list/dir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*jslint browser:true, nomen:true, vars:true */
/*global define, FileReader */

define([], function () {
'use strict';

return {
listResult: function ($state, $http) {
return {
restrict: 'E',
scope: {
proposal: '=',
result: '=',
key: '='
},
templateUrl: 'modules/result/list/template.html',
link: function (scope) {
scope.saveResult = function () {
delete scope.result.edit;
scope.proposal[scope.result.who] = scope.result;
var pushComponents = {};
pushComponents.uid = scope.proposal.uid;
pushComponents.who = scope.result.who;
pushComponents[scope.result.who] = scope.result;
pushComponents.key = scope.key;
$http.post('/api/proposalResult', pushComponents).then(function () {
$state.go('proposal/:uid/:resultee', {uid: scope.proposal.uid, resultee: ''});
});
};
}
};
}
};
});
File renamed without changes.

0 comments on commit 1148d5f

Please sign in to comment.