Skip to content

Commit

Permalink
Locking critical mobile-survey properties once a survey has been sync…
Browse files Browse the repository at this point in the history
  • Loading branch information
chiatt committed Jan 28, 2019
1 parent 9dc5129 commit 61f3aa6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions arches/app/media/js/viewmodels/mobile-survey.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ define([
}, 200);
};
this.history = params.history;
this.locked = _.keys(this.history.editors) > 0 || false;
this.history.lastsync = moment(this.history.lastsync);
_.each(this.history.editors, function(editor) {
editor.lastsync = moment(editor.lastsync);
Expand Down
17 changes: 11 additions & 6 deletions arches/app/templates/views/mobile-survey-designer.htm
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ <h1 class="page-header text-overflow mobile-designer-title">
<!--ko if: selectedNode().cards -->
<!--ko foreach: {data: selectedNode().cards, as: 'card'} -->
<div class="checkbox">
<label class="form-checkbox form-normal form-primary" data-bind="css: {'active': card.approved}" style="padding-left: 25px; padding-top: 3px;">
<input type="checkbox" data-bind="checked: card.approved"/>
<label class="form-checkbox form-normal form-primary" data-bind="css: {'active': card.approved, 'disabled': $parent.locked}" style="padding-left: 25px; padding-top: 3px;">
<input type="checkbox" data-bind="checked: card.approved, attr: {disabled: $parent.locked}"/>
<span data-bind="text: card.name"></span>
</label>
</div>
Expand All @@ -450,7 +450,7 @@ <h1 class="page-header text-overflow mobile-designer-title">
<input class="" style="display:inline-block;"
data-bind="select2Query: {
select2Config: getSelect2ResourcesConfig()
}">
}, attr: {disabled: locked}">
</div>
</div>

Expand All @@ -472,9 +472,14 @@ <h1 class="page-header text-overflow mobile-designer-title">
<div class="mpm-item-listing-header data-panel">
{% trans 'Allow users to download data' %}
<span class="toggle-container">
<!--ko ifnot: locked-->
<span class="switch switch-small" data-bind="css: {'on': mobilesurvey.datadownloadconfig.download()}, click: function(){
mobilesurvey.datadownloadconfig.download(!mobilesurvey.datadownloadconfig.download());
}"><small></small></span>
<!--/ko-->
<!--ko if: locked-->
<span class="switch switch-small disabled" data-bind="css: {'on': mobilesurvey.datadownloadconfig.download()"><small></small></span>
<!--/ko-->
</span>
</div>

Expand All @@ -498,7 +503,7 @@ <h1 class="page-header text-overflow mobile-designer-title">
<div>
<div class="pad-top">
<label style="display:flex; align-items:center">{% trans 'Limit ' %}
<input type="number" class="form-control" style="width: 100px; margin-left: 7px;" placeholder="Search query URL" data-bind="textInput: mobilesurvey.datadownloadconfig.count, event: {'change': convertCountToInt}"></input>
<input type="number" class="form-control" style="width: 100px; margin-left: 7px;" placeholder="Search query URL" data-bind="textInput: mobilesurvey.datadownloadconfig.count, event: {'change': convertCountToInt}, attr: {disabled: locked}"></input>
</label>
</div>

Expand Down Expand Up @@ -526,7 +531,7 @@ <h1 class="page-header text-overflow mobile-designer-title">
<!-- Inline Checkboxes -->
<div class="checkbox">
<!-- ko foreach: {data:allResources, as: 'resource'} -->
<label class="form-checkbox form-normal form-primary" data-bind="text: resource.name, css: {'form-text' : true, active: _.contains($parent.mobilesurvey.datadownloadconfig.resources(), resource.id), disabled: resource.hasApprovedCards() === false}, click: function(r){if (r.hasApprovedCards()){$parent.mobilesurvey.updateResourceDownloadList(r)}}"><input type="checkbox"></label>
<label class="form-checkbox form-normal form-primary" data-bind="text: resource.name, css: {'form-text' : true, active: _.contains($parent.mobilesurvey.datadownloadconfig.resources(), resource.id), disabled: resource.hasApprovedCards() === false || $parent.locked}, click: function(r){if (r.hasApprovedCards()){$parent.mobilesurvey.updateResourceDownloadList(r)}}"><input type="checkbox"></label>
<!-- /ko -->
</div>
</div>
Expand All @@ -539,7 +544,7 @@ <h1 class="page-header text-overflow mobile-designer-title">
</p>

<div class="form-group">
<input type="text" id="" class="form-control" placeholder="Search query URL" data-bind="textInput: mobilesurvey.datadownloadconfig.custom">
<input type="text" id="" class="form-control" placeholder="Search query URL" data-bind="textInput: mobilesurvey.datadownloadconfig.custom, attr: {disabled: locked}">
</div>
</div>
</div>
Expand Down

0 comments on commit 61f3aa6

Please sign in to comment.