Generalised some dialogs
This commit is contained in:
@@ -1,23 +1,6 @@
|
||||
<template name="raceDialog">
|
||||
<core-header-panel fit>
|
||||
<core-toolbar class="grey white-text" hero-id="toolbar" hero>
|
||||
<paper-icon-button id="backButton" role="button" tabindex="0" icon="arrow-back" aria-label="close"></paper-icon-button>
|
||||
<div flex>{{race}}</div>
|
||||
</core-toolbar>
|
||||
<div class="detailContent">
|
||||
<paper-input id="raceInput" label="Race" floatinglabel value={{race}}></paper-input>
|
||||
{{#if effects}}
|
||||
<hr style="margin: 16px 0 16px 0;">
|
||||
<div id="effects">
|
||||
<h2>Effects</h2>
|
||||
{{#each effects}}
|
||||
{{>effectEdit}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div layout horizontal end-justified>
|
||||
<paper-button id="addEffectButton" raised>Add Effect</paper-button>
|
||||
</div>
|
||||
</div>
|
||||
</core-header-panel>
|
||||
{{#baseDialog title="Race" class=colorClass hideColor="true" hideDelete="true"}}
|
||||
<paper-input id="raceInput" label="Race" floatinglabel value={{race}}></paper-input>
|
||||
{{> effectsEditList sourceId=_id charId=charId type="racial"}}
|
||||
{{/baseDialog}}
|
||||
</template>
|
||||
@@ -1,33 +1,4 @@
|
||||
Template.raceDialog.rendered = function(){
|
||||
var self = this;
|
||||
//update all autogrows after they've been filled
|
||||
var pata = this.$("paper-autogrow-textarea");
|
||||
pata.each(function(index, el){
|
||||
el.update($(el).children().get(0));
|
||||
})
|
||||
//update all input fields as well
|
||||
var input = this.$("paper-input");
|
||||
input.each(function(index, el){
|
||||
el.valueChanged();
|
||||
})
|
||||
//after the dialog is built, open it
|
||||
if (!this.alreadyRendered){
|
||||
Session.set("global.ui.detailShow", true);
|
||||
this.alreadyRendered = true;
|
||||
}
|
||||
}
|
||||
|
||||
Template.raceDialog.events({
|
||||
"tap #backButton": function(){
|
||||
GlobalUI.closeDetail()
|
||||
},
|
||||
"tap #addEffectButton": function(){
|
||||
Effects.insert({
|
||||
charId: this.charId,
|
||||
operation: "add",
|
||||
type: "racial"
|
||||
});
|
||||
},
|
||||
"change #raceInput": function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Characters.update(this.charId, {$set: {race: value}});
|
||||
@@ -35,9 +6,6 @@ Template.raceDialog.events({
|
||||
});
|
||||
|
||||
Template.raceDialog.helpers({
|
||||
effects: function(){
|
||||
return Effects.find({charId: this.charId, type: "racial"});
|
||||
},
|
||||
race: function(){
|
||||
var char = Characters.findOne(this.charId, {fields: {race: 1}});
|
||||
return char && char.race;
|
||||
|
||||
Reference in New Issue
Block a user