-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4905 from archesproject/galen_consultations-prj_2…
…7_add_ref_number_wkflw_step Galen consultations prj 27 add ref number wkflw step
- Loading branch information
Showing
7 changed files
with
201 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ jsdoc.json | |
migrate_graphs.py | ||
djcp.sh | ||
.vscode | ||
.DS_Store |
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
74 changes: 74 additions & 0 deletions
74
arches/app/media/js/views/components/workflows/new-multi-tile-step.js
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,74 @@ | ||
define([ | ||
'knockout', | ||
'views/components/workflows/new-tile-step', | ||
'viewmodels/alert' | ||
], function(ko, NewTileStepViewModel, AlertViewModel) { | ||
|
||
/** | ||
* A generic viewmodel for workflow steps that can add multiple tiles | ||
* @name NewMultiTileStepViewModel | ||
**/ | ||
|
||
function NewMultiTileStepViewModel(params) { | ||
NewTileStepViewModel.apply(this, [params]); | ||
var self = this; | ||
|
||
this.remove = function(tile) { | ||
tile.deleteTile( function(response) { | ||
self.alert(new AlertViewModel( | ||
'ep-alert-red', | ||
response.responseJSON.message[0], | ||
response.responseJSON.message[1], | ||
null, | ||
function(){ return; } | ||
)); | ||
}); | ||
}; | ||
|
||
this.edit = function(tile) { | ||
self.tile(tile); | ||
}; | ||
|
||
self.saveTile = function(tile, callback) { | ||
self.loading(true); | ||
tile.save(function(response) { | ||
self.loading(false); | ||
self.alert( | ||
new AlertViewModel( | ||
'ep-alert-red', | ||
response.responseJSON.message[0], | ||
response.responseJSON.message[1], | ||
null, | ||
function(){ return; } | ||
) | ||
); | ||
}, function(tile) { | ||
params.resourceid(tile.resourceinstance_id); | ||
params.tileid(tile.tileid); | ||
self.resourceId(tile.resourceinstance_id); | ||
self.complete(true); | ||
if (typeof callback === 'function') { | ||
callback.apply(null, arguments); | ||
} | ||
self.tile(self.card().getNewTile()); | ||
self.tile().reset(); | ||
setTimeout(function() { | ||
self.tile().reset(); | ||
}, 1); | ||
self.loading(false); | ||
}); | ||
}; | ||
|
||
var updateTileOnInit = self.tile.subscribe(function() { | ||
updateTileOnInit.dispose(); | ||
self.tile(self.card().getNewTile()); | ||
}); | ||
} | ||
ko.components.register('new-multi-tile-step', { | ||
viewModel: NewMultiTileStepViewModel, | ||
template: { | ||
require: 'text!templates/views/components/workflows/new-multi-tile-step.htm' | ||
} | ||
}); | ||
return NewMultiTileStepViewModel; | ||
}); |
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
49 changes: 49 additions & 0 deletions
49
arches/app/templates/views/components/workflows/new-multi-tile-step.htm
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,49 @@ | ||
<!-- ko let: { self: $data } --> | ||
<!-- ko if: !loading() --> | ||
<div data-bind="" class="wf-multi-tile-step-container"> | ||
<!-- ko if: tile() && card() --> | ||
<div class="wf-multi-tile-step-form"> | ||
<h3>Add Reference Number</h3> | ||
<div data-bind="component: { | ||
name: cardComponentLookup[card().model.component_id()].componentname, | ||
params: { | ||
card: card(), | ||
tile: tile(), | ||
provisionalTileViewModel: provisionalTileViewModel, | ||
reviewer: reviewer, | ||
loading: loading, | ||
form: $data | ||
} | ||
}"></div> | ||
</div> | ||
<div class="wf-multi-tile-step-list"> | ||
<!-- ko foreach: {data: card().tiles, as: 'tile'} --> | ||
<div class="wf-multi-tile-step-card"> | ||
<div class="wf-multi-tile-card-info"> | ||
<div class="workflow-step-icon complete"><span><i class="fa fa-hashtag"></i></span></div> | ||
<div class="wf-multi-tile-card-info-details"> | ||
<!-- ko foreach: {data: $parent.card().widgets(), as: 'widget'} --> | ||
<!-- ko component: { | ||
name: widget.widgetLookup[widget.get("widget_id")()].name, | ||
params: { | ||
config: widget.configJSON, | ||
label: widget.label(), | ||
node: widget.node, | ||
value: $parent.data[widget.node_id()], | ||
state: "report" | ||
} | ||
} --><!-- /ko --> | ||
<!-- /ko --> | ||
</div> | ||
</div> | ||
<div> | ||
<div data-bind="click: function(){$parent.remove(tile)}"><span><i class="fa fa-times-circle"></i></span><span>Remove</span></div> | ||
<div data-bind="click: function(){$parent.edit(tile);}"><span><i class="fa fa-pencil"></i></span><span>Edit</span></div> | ||
</div> | ||
</div> | ||
<!-- /ko --> | ||
</div> | ||
<!-- /ko --> | ||
</div> | ||
<!-- /ko --> | ||
<!-- /ko --> |