Updated Features UI to include use limits
This commit is contained in:
@@ -19,6 +19,20 @@
|
||||
<textarea id="featureDescriptionInput" placeholder aria-label="Description" value={{description}}></textarea>
|
||||
</paper-autogrow-textarea>
|
||||
</paper-input-decorator>
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
<div layout horizontal center>
|
||||
<div class="caption">Limit Uses <paper-toggle-button id="limitUseCheck"
|
||||
checked={{usesSet}}
|
||||
role="button"
|
||||
aria-pressed="false"
|
||||
tabindex="0"
|
||||
touch-action="pan-y">
|
||||
</paper-toggle-button>
|
||||
{{#if usesSet}}
|
||||
<paper-input id="usesInput" label="Uses" floatinglabel value={{uses}}></paper-input>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{#if effects}}
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
<div id="effects">
|
||||
|
||||
@@ -40,7 +40,21 @@ Template.featureDialog.events({
|
||||
"change #featureDescriptionInput": function(event){
|
||||
var description = Template.instance().find("#featureDescriptionInput").value;
|
||||
Features.update(this._id, {$set: {description: description}});
|
||||
}
|
||||
},
|
||||
"change #limitUseCheck": function(event){
|
||||
var currentUses = this.uses;
|
||||
var featureId = this._id;
|
||||
if( event.target.checked && !_.isString(currentUses) ){
|
||||
Features.update(featureId, {$set: {uses: ""}}, {removeEmptyStrings: false});
|
||||
} else if (!event.target.checked && _.isString(currentUses)){
|
||||
Features.update(featureId, {$unset: {uses: ""}});
|
||||
}
|
||||
},
|
||||
"change #usesInput, input #quantityInput": function(event){
|
||||
var value = event.target.value;
|
||||
var featureId = this._id;
|
||||
Features.update(featureId, {$set: {uses: value}});
|
||||
},
|
||||
});
|
||||
|
||||
Template.featureDialog.helpers({
|
||||
@@ -50,5 +64,8 @@ Template.featureDialog.helpers({
|
||||
effects: function(){
|
||||
var cursor = Effects.find({sourceId: this._id, type: "feature"})
|
||||
return cursor;
|
||||
},
|
||||
usesSet: function(){
|
||||
return _.isString(this.uses);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user