Moved views out of private folder

This commit is contained in:
Stefan Zermatten
2017-01-12 15:28:59 +02:00
parent 37268495ae
commit 38ea89995a
162 changed files with 6 additions and 3 deletions

View File

@@ -0,0 +1,46 @@
<template name="containerDialog">
{{#with container}}
{{#baseDialog title=name class=colorClass startEditing=../startEditing}}
{{> containerView}}
{{else}}
{{> containerEdit}}
{{/baseDialog}}
{{/with}}
</template>
<template name="containerEdit">
<paper-input id="containerNameInput"
label="Name"
floatinglabel
value={{name}}></paper-input>
<div layout horizontal around-justified wrap>
<paper-input-decorator label="Weight" floatinglabel>
<input id="weightInput" type="number" value={{weight}}>
</paper-input-decorator>
<paper-input-decorator label="Value" floatinglabel>
<input id="valueInput" type="number" value={{value}}>
</paper-input-decorator>
</div>
<hr class="vertMargin">
<paper-input-decorator label="Description" floatinglabel layout vertical>
<paper-autogrow-textarea>
<textarea id="containerDescriptionInput" placeholder aria-label="Description" value={{description}}></textarea>
</paper-autogrow-textarea>
</paper-input-decorator>
</template>
<template name="containerView">
<div layout horizontal wrap center justified>
<table class="summaryTable fullwidth">
<tr><td>Container</td><td>{{round weight}}lbs</td><td>{{longValueString value}}</td></tr>
<tr><td>Contents</td><td>{{round contentsWeight}}lbs</td><td>{{longValueString contentsValue}}</td></tr>
<tr class="body2"><td>Total</td><td>{{round totalWeight}}lbs</td><td>{{longValueString totalValue}}</td></tr>
</table>
</div>
{{#if description}}
<hr class="vertMargin">
<div>{{#markdown}}{{evaluateString charId description}}{{/markdown}}</div>
{{/if}}
</template>

View File

@@ -0,0 +1,43 @@
Template.containerDialog.helpers({
container: function(){
return Containers.findOne(this.containerId);
}
});
Template.containerDialog.events({
"color-change": function(event, instance){
Containers.update(instance.data.containerId, {$set: {color: event.color}});
},
"tap #deleteButton": function(event, instance){
Containers.softRemoveNode(instance.data.containerId);
GlobalUI.deletedToast(
instance.data.containerId,
"Containers", "Container and contents"
);
GlobalUI.closeDetail();
},
});
Template.containerEdit.onRendered(function(){
updatePolymerInputs(this);
});
Template.containerEdit.events({
//TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
"change #containerNameInput": function(event){
var name = Template.instance().find("#containerNameInput").value;
Containers.update(this._id, {$set: {name: name}});
},
"change #weightInput, input #weightInput": function(event){
var weight = +Template.instance().find("#weightInput").value;
Containers.update(this._id, {$set: {weight: weight}});
},
"change #valueInput, input #valueInput": function(event){
var value = +Template.instance().find("#valueInput").value;
Containers.update(this._id, {$set: {value: value}});
},
"change #containerDescriptionInput": function(event, instance){
var description = instance.find("#containerDescriptionInput").value;
Containers.update(this._id, {$set: {description: description}});
},
});