Skip to content

Commit

Permalink
Updated templates
Browse files Browse the repository at this point in the history
  • Loading branch information
nicho90 committed Apr 6, 2017
1 parent 0790a6c commit 0e67a21
Show file tree
Hide file tree
Showing 9 changed files with 1,940 additions and 353 deletions.
2 changes: 1 addition & 1 deletion cleanup.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

cd /path/to/temp/doc
cd public/files/temp/

for i in 1 2 3 4 5 6 7
do
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
var app = angular.module("ethics-app");


// Document submission controller
app.controller("documentShowSubmissionController", function($scope, $rootScope, $routeParams, $translate, $location, config, $window, $authenticationService, $documentService) {

/*************************************************
FUNCTIONS
*************************************************/

/**
* [redirect description]
* @param {[type]} path [description]
* @return {[type]} [description]
*/
$scope.redirect = function(path){
$location.url(path);
};

/**
* [cancel description]
* @return {[type]} [description]
*/
$scope.cancel = function(){
$scope.redirect("/documents/" + $documentService.getId() + "/status/" + $documentService.getStatus());
};

/**
* [toggleConcernHistory description]
* @param {[type]} language [description]
* @return {[type]} [description]
*/
$scope.toggle = function(category, property, language){
switch (category) {
case 'general': {
switch (property){
case 'display': {
$scope.status.general.display = !$scope.status.general.display;
break;
}
case 'history': {
$scope.status.general.history = !$scope.status.general.history;
if($scope.status.general.history){
$scope.status.general.limit = $scope.document.revisions.length;
} else {
$scope.status.general.limit = 1;
}
break;
}
}
break;
}
case 'descriptions': {
switch (property) {
case 'language': {
switch (language) {
case 'en': {
$scope.status.descriptions.language.en = !$scope.status.descriptions.language.en;
break;
}
case 'de': {
$scope.status.descriptions.language.de = !$scope.status.descriptions.language.de;
break;
}
case 'pt': {
$scope.status.descriptions.language.pt = !$scope.status.descriptions.language.pt;
break;
}
}
break;
}
case 'history': {
switch (language) {
case 'en': {
$scope.status.descriptions.history.en.display = !$scope.status.descriptions.history.en.display;

if($scope.status.descriptions.history.en.display){
$scope.status.descriptions.history.en.limit = $scope.document.revisions.length;
} else {
$scope.status.descriptions.history.en.limit = 1;
}
break;
}
case 'de': {
$scope.status.descriptions.history.de.display = !$scope.status.descriptions.history.de.display;

if($scope.status.descriptions.history.de.display){
$scope.status.descriptions.history.de.limit = $scope.document.revisions.length;
} else {
$scope.status.descriptions.history.de.limit = 1;
}
break;
}
case 'pt': {
$scope.status.descriptions.history.pt.display = !$scope.status.descriptions.history.pt.display;

if($scope.status.descriptions.history.pt.display){
$scope.status.descriptions.history.pt.limit = $scope.document.revisions.length;
} else {
$scope.status.descriptions.history.pt.limit = 1;
}
break;
}
}
break;
}
case 'comments': {
switch (language) {
case 'en': {
$scope.status.descriptions.comments.en = !$scope.status.descriptions.comments.en;
break;
}
case 'de': {
$scope.status.descriptions.comments.de = !$scope.status.descriptions.comments.de;
break;
}
case 'pt': {
$scope.status.descriptions.comments.pt = !$scope.status.descriptions.comments.pt;
break;
}
}
}
}
break;
}
case 'concerns': {
switch (property) {
case 'display': {
$scope.status.concerns.display = !$scope.status.concerns.display;
break;
}
case 'history': {
$scope.status.concerns.history = !$scope.status.concerns.history;

if($scope.status.concerns.history){
$scope.status.concerns.limit = $scope.document.revisions.length;
} else {
$scope.status.concerns.limit = 1;
}

break;
}
case 'comments': {
$scope.status.concerns.comments = !$scope.status.concerns.comments;
break;
}
}
break;
}
}
};

/*************************************************
INIT
*************************************************/
$scope.$parent.loading = { status: true, message: "Loading submission" };
$scope.document = $documentService.get();
$scope.latest_revision = $documentService.getLatestRevision();

// Show/hide comments and history
$scope.status = {
general: {
display: true,
history: false,
limit: 1
},
descriptions: {
language: {
en: true,
de: $scope.latest_revision.descriptions.de_used,
pt: $scope.latest_revision.descriptions.pt_used
},
history: {
en: {
display: false,
limit: 1
},
de: {
display: false,
limit: 1
},
pt: {
display: false,
limit: 1
}
},
comments: {
en: true,
de: $scope.latest_revision.descriptions.de_used,
pt: $scope.latest_revision.descriptions.pt_used
}
},
concerns: {
display: true,
history: false,
limit: 1,
comments: true
}
};
$scope.$parent.loading = { status: false, message: "" };
});
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ app.controller("documentShowSubmissionController", function($scope, $rootScope,
$scope.status.descriptions.history.pt.display = !$scope.status.descriptions.history.pt.display;

if($scope.status.descriptions.history.pt.display){
$scope.status.descriptions.limit = $scope.document.revisions.length;
$scope.status.descriptions.history.pt.limit = $scope.document.revisions.length;
} else {
$scope.status.descriptions.limit = 1;
$scope.status.descriptions.history.pt.limit = 1;
}
break;
}
Expand Down Expand Up @@ -155,9 +155,9 @@ app.controller("documentShowSubmissionController", function($scope, $rootScope,
*************************************************/
$scope.$parent.loading = { status: true, message: "Loading submission" };
$scope.document = $documentService.get();
console.log($scope.document);
$scope.latest_revision = $documentService.getLatestRevision();

// Show/hide comments and history
$scope.status = {
general: {
display: true,
Expand Down
Loading

0 comments on commit 0e67a21

Please sign in to comment.