forked from drugis/gemtc-web
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
18 changed files
with
436 additions
and
33 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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<form id="edit-study-title-form" novalidate ng-submit="editTitle(title.new)"> | ||
<div class="grid-container"> | ||
<div class="grid-x"> | ||
<div class="cell"> | ||
<h3>Edit study title</h3> | ||
</div> | ||
<div class="cell"> | ||
<label>Study title</label> | ||
</div> | ||
<div class="cell alert"> | ||
Changing the study title will delete all model results! | ||
</div> | ||
<div class="cell large-6"> | ||
<input autofocus="true" type="text" ng-model="title.new" ng-change="checkTitle(title.new)"> | ||
</div> | ||
<div class="cell"> | ||
<button ng-disabled="error" ng-click="editTitle(title.new)" class="button" type="button"> | ||
Edit | ||
</button> | ||
</div> | ||
<div class="cell alert" ng-if="error"> | ||
{{error}} | ||
</div> | ||
</div> | ||
</div> | ||
<button ng-click="cancel()" class="close-button" aria-label="Close reveal" type="button"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</form> |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
define(['lodash'], function(_) { | ||
var dependencies = [ | ||
'$scope', | ||
'$modalInstance', | ||
'studyTitle', | ||
'entries', | ||
'callback' | ||
]; | ||
var EditStudyTitleController = function( | ||
$scope, | ||
$modalInstance, | ||
studyTitle, | ||
entries, | ||
callback | ||
) { | ||
// functions | ||
$scope.cancel = $modalInstance.close; | ||
$scope.editTitle = editTitle; | ||
$scope.checkTitle = checkTitle; | ||
|
||
// init | ||
$scope.title = { | ||
new: studyTitle | ||
}; | ||
|
||
function checkTitle(newTitle) { | ||
if (newTitle === '') { | ||
$scope.error = 'Title is empty'; | ||
} else if (newTitle !== studyTitle && _.some(entries, ['study', newTitle])) { | ||
$scope.error = 'Study with that title already exists'; | ||
} else { | ||
$scope.error = undefined; | ||
} | ||
} | ||
|
||
function editTitle() { | ||
if ($scope.error) { | ||
return; | ||
} | ||
callback($scope.title.new); | ||
$modalInstance.close(); | ||
} | ||
|
||
}; | ||
return dependencies.concat(EditStudyTitleController); | ||
}); |
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
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
Oops, something went wrong.