-
-
-
- {{> colorDropdown}}
-
-
-
-
-
-
-
-
-
-
Limit Uses
-
-
- {{#if usesSet}}
-
- {{/if}}
-
- {{#if effects}}
-
-
-
Effects
- {{#each effects}}
- {{>effectEdit}}
- {{/each}}
-
+ {{#baseDialog title=name class=colorClass}}
+
+
+
+
+
+
+
+
+
+
+
+
Limit Uses
+
+
+ {{#if usesSet}}
+
{{/if}}
-
-
+ {{> effectsEditList sourceId=_id charId=charId type="feature"}}
+ {{/baseDialog}}
{{/with}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/features/featureDialog/featureDialog.js b/rpg-docs/client/views/character/features/featureDialog/featureDialog.js
index 49ec5654..6770f9d1 100644
--- a/rpg-docs/client/views/character/features/featureDialog/featureDialog.js
+++ b/rpg-docs/client/views/character/features/featureDialog/featureDialog.js
@@ -1,38 +1,11 @@
-Template.featureDialog.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.featureDialog.events({
- "tap #backButton": function(){
- GlobalUI.closeDetail()
+ "color-change": function(event, instance){
+ Features.update(instance.data.featureId, {$set: {color: event.color}});
},
- "tap #deleteFeature": function(){
- Features.remove(this._id);
+ "tap #deleteButton": function(event, instance){
+ Features.remove(instance.data.featureId);
GlobalUI.closeDetail()
},
- "tap #addEffectButton": function(){
- Effects.insert({
- charId: Template.currentData().charId,
- sourceId: this._id,
- operation: "add",
- type: "feature"
- });
- },
"change #featureNameInput": function(event){
var name = Template.instance().find("#featureNameInput").value;
Features.update(this._id, {$set: {name: name}});
@@ -54,12 +27,6 @@ Template.featureDialog.events({
var value = event.target.value;
var featureId = this._id;
Features.update(featureId, {$set: {uses: value}});
- },
- "core-select .colorDropdown": function(event){
- var detail = event.originalEvent.detail;
- if(!detail.isSelected) return;
- var value = detail.item.getAttribute("name");
- Features.update(this._id, {$set: {color: value}});
}
});
@@ -67,10 +34,6 @@ Template.featureDialog.helpers({
feature: function(){
return Features.findOne(this.featureId);
},
- effects: function(){
- var cursor = Effects.find({sourceId: this._id, type: "feature"})
- return cursor;
- },
usesSet: function(){
return _.isString(this.uses);
},
diff --git a/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html b/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html
index a50afaa0..5b13c831 100644
--- a/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html
+++ b/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html
@@ -1,36 +1,22 @@
{{#with container}}
-
-
-
- {{name}}
-
-
-
-
+ {{#baseDialog title=name class=colorClass}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{/baseDialog}}
{{/with}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.js b/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.js
index 24c763b4..2c4647e5 100644
--- a/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.js
+++ b/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.js
@@ -1,31 +1,17 @@
-Template.containerDialog.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.containerDialog.helpers({
+ container: function(){
+ return Containers.findOne(this.containerId);
}
-}
+});
Template.containerDialog.events({
- "tap #backButton": function(){
- GlobalUI.closeDetail();
+ "color-change": function(event, instance){
+ Containers.update(instance.data.containerId, {$set: {color: event.color}});
},
- "tap #deleteContainer": function(){
- Containers.remove(this._id);
- GlobalUI.closeDetail();
+ "tap #deleteButton": function(event, instance){
+ Containers.remove(instance.data.containerId);
+ GlobalUI.closeDetail()
},
- //TODO clean up String -> num here so they don't need casting by Schema.clean
//TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
"change #containerNameInput, input #containerNameInput": function(event){
console.log("changed Nameinput")
@@ -33,30 +19,15 @@ Template.containerDialog.events({
Containers.update(this._id, {$set: {name: name}});
},
"change #weightInput, input #weightInput": function(event){
- var weight = Template.instance().find("#weightInput").value;
+ 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;
+ var value = +Template.instance().find("#valueInput").value;
Containers.update(this._id, {$set: {value: value}});
},
"change #containerDescriptionInput": function(event){
var description = Template.instance().find("#containerDescriptionInput").value;
Containers.update(this._id, {$set: {description: description}});
- },
- "core-select .colorDropdown": function(event){
- var detail = event.originalEvent.detail;
- if(!detail.isSelected) return;
- var value = detail.item.getAttribute("name");
- Containers.update(this._id, {$set: {color: value}});
}
});
-
-Template.containerDialog.helpers({
- container: function(){
- return Containers.findOne(this.containerId);
- },
- colorClass: function(){
- return getColorClass(this.color)
- }
-});
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html
index 26a70993..b27839ea 100644
--- a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html
+++ b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html
@@ -1,84 +1,62 @@
{{#with item}}
-
-
-
- {{name}}
-
-
-
-
-
- {{# if ne1 quantity}}
{{/if}}
-
- {{# if canEquip}}
-
- {{/if}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{#if effects}}
-
-
-
Effects
- {{#each effects}}
- {{>effectEdit}}
+ {{#baseDialog title=name class=colorClass}}
+
+
+ {{# if ne1 quantity}}
{{/if}}
+
+
+
+
- {{/if}}
-
Add Effect
-
-
+
+
+
+
+
+
+
+
+
+
+ {{# if canEquip}}
+
+ {{/if}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{> effectsEditList sourceId=_id charId=charId type="equipment"}}
+ {{/baseDialog}}
{{/with}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js
index b31804e6..34d5fbb1 100644
--- a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js
+++ b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js
@@ -1,39 +1,51 @@
-Template.itemDialog.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;
+var getContainers = function(charId){
+ return Containers.find({charId: charId}, {sort: {name: 1, _id: 1}, fields: {name: 1}}).fetch();
+};
+
+var equipmentSlots = [
+ {name: "None", value: "none"},
+ {name: "Held", value: "held"},
+ {name: "Armor", value: "armor"},
+ {name: "Head", value: "head"},
+ {name: "Arms", value: "arms"},
+ {name: "Hands", value: "hands"},
+ {name: "Feet", value: "feet"}
+];
+
+Template.itemDialog.helpers({
+ item: function(){
+ return Items.findOne(this.itemId);
+ },
+ containers: function(){
+ return getContainers(this.charId);
+ },
+ containerIndex: function(){
+ var containers = getContainers(this.charId);
+ var containerIds = _.pluck(containers, "_id");
+ return _.indexOf(containerIds, this.container);
+ },
+ equipmentSlots: function(){
+ return equipmentSlots;
+ },
+ equipmentSlotIndex: function(){
+ return _.indexOf(_.pluck(equipmentSlots, "value"), this.equipmentSlot);
+ },
+ canEquip: function(){
+ return this.equipmentSlot !== "none";
+ },
+ ne1: function(num){
+ return num != 1;
}
-}
+});
Template.itemDialog.events({
- "tap #backButton": function(){
- GlobalUI.closeDetail();
+ "color-change": function(event, instance){
+ Items.update(instance.data.itemId, {$set: {color: event.color}});
},
- "tap #deleteItem": function(){
- Items.remove(this._id);
- GlobalUI.closeDetail();
+ "tap #deleteButton": function(event, instance){
+ Items.remove(instance.data.itemId);
+ GlobalUI.closeDetail()
},
- "tap #addEffectButton": function(){
- Effects.insert({
- charId: Template.currentData().charId,
- sourceId: this._id,
- operation: "add",
- type: "equipment"
- });
- },
- //TODO clean up String -> num here so they don't need casting by Schema.clean
//TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
"change #itemNameInput, input #itemNameInput": function(event){
console.log("changed Nameinput")
@@ -45,15 +57,15 @@ Template.itemDialog.events({
Items.update(this._id, {$set: {plural: plural}});
},
"change #quantityInput, input #quantityInput": function(event){
- var quantity = Template.instance().find("#quantityInput").value;
+ var quantity = +Template.instance().find("#quantityInput").value;
Items.update(this._id, {$set: {quantity: quantity}});
},
"change #weightInput, input #weightInput": function(event){
- var weight = Template.instance().find("#weightInput").value;
+ var weight = +Template.instance().find("#weightInput").value;
Items.update(this._id, {$set: {weight: weight}});
},
"change #valueInput, input #valueInput": function(event){
- var value = Template.instance().find("#valueInput").value;
+ var value = +Template.instance().find("#valueInput").value;
Items.update(this._id, {$set: {value: value}});
},
"change #itemDescriptionInput": function(event){
@@ -77,47 +89,3 @@ Template.itemDialog.events({
Items.update(Template.currentData().itemId, {$set: {equipmentSlot: value}});
}
});
-
-var getContainers = function(charId){
- return Containers.find({charId: charId}, {sort: {name: 1, _id: 1}, fields: {name: 1}}).fetch();
-};
-
-var equipmentSlots = [
- {name: "None", value: "none"},
- {name: "Held", value: "held"},
- {name: "Armor", value: "armor"},
- {name: "Head", value: "head"},
- {name: "Arms", value: "arms"},
- {name: "Hands", value: "hands"},
- {name: "Feet", value: "feet"}
-];
-
-Template.itemDialog.helpers({
- item: function(){
- return Items.findOne(this.itemId);
- },
- effects: function(){
- var cursor = Effects.find({charId: this.charId, type: "equipment", sourceId: this._id})
- return cursor;
- },
- containers: function(){
- return getContainers(this.charId);
- },
- containerIndex: function(){
- var containers = getContainers(this.charId);
- var containerIds = _.pluck(containers, "_id");
- return _.indexOf(containerIds, this.container);
- },
- equipmentSlots: function(){
- return equipmentSlots;
- },
- equipmentSlotIndex: function(){
- return _.indexOf(_.pluck(equipmentSlots, "value"), this.equipmentSlot);
- },
- canEquip: function(){
- return this.equipmentSlot !== "none";
- },
- ne1: function(num){
- return num != 1;
- }
-});
diff --git a/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.html b/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.html
index 7f4ac9f9..453bbee4 100644
--- a/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.html
+++ b/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.html
@@ -1,32 +1,20 @@
{{#with experience}}
-
-
-
- {{name}}
-
-
-
-
-
-
-
-
-
+ {{#baseDialog title=name class=colorClass hideColor="true"}}
+
-
+
+
+
+
+
+
+ {{/baseDialog}}
{{/with}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.js b/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.js
index 1d862535..1e52a691 100644
--- a/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.js
+++ b/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.js
@@ -1,38 +1,15 @@
-Template.experienceDialog.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.experienceDialog.events({
- "tap #backButton": function(){
- GlobalUI.closeDetail();
+ "tap #deleteButton": function(event, instance){
+ Experiences.remove(instance.data.experienceId);
+ GlobalUI.closeDetail()
},
- "tap #deleteExperience": function(){
- Experiences.remove(this._id);
- GlobalUI.closeDetail();
- },
- //TODO clean up String -> num here so they don't need casting by Schema.clean
//TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
"change #experienceNameInput, input #experienceNameInput": function(event){
var value = event.currentTarget.value
Experiences.update(this._id, {$set: {name: value}});
},
"change #valueInput": function(event){
- var value = event.currentTarget.value
+ var value = +event.currentTarget.value
Experiences.update(this._id, {$set: {value: value}});
},
"change #experienceDescriptionInput": function(event){
diff --git a/rpg-docs/client/views/character/journal/levelDialog/levelDialog.html b/rpg-docs/client/views/character/journal/levelDialog/levelDialog.html
index b1468007..ddb6280f 100644
--- a/rpg-docs/client/views/character/journal/levelDialog/levelDialog.html
+++ b/rpg-docs/client/views/character/journal/levelDialog/levelDialog.html
@@ -1,32 +1,10 @@
{{#with level}}
-
-
-
- {{name}}
-
-
-
-
-
- {{#if effects}}
-
-
-
Effects
- {{#each effects}}
- {{>effectEdit}}
- {{/each}}
-
- {{/if}}
-
-
-
+ {{#baseDialog title=name class=colorClass hideColor="true"}}
+
+
+
+ {{> effectsEditList sourceId=_id charId=charId type="level"}}
+ {{/baseDialog}}
{{/with}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/journal/levelDialog/levelDialog.js b/rpg-docs/client/views/character/journal/levelDialog/levelDialog.js
index 8193c26f..c24fdc62 100644
--- a/rpg-docs/client/views/character/journal/levelDialog/levelDialog.js
+++ b/rpg-docs/client/views/character/journal/levelDialog/levelDialog.js
@@ -1,38 +1,8 @@
-Template.levelDialog.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.levelDialog.events({
- "tap #backButton": function(){
+ "tap #deleteButton": function(event, instance){
+ Levels.remove(instance.data.levelId);
GlobalUI.closeDetail()
},
- "tap #deleteLevel": function(){
- Levels.remove(this._id);
- GlobalUI.closeDetail()
- },
- "tap #addEffectButton": function(){
- Effects.insert({
- charId: this.charId,
- sourceId: this._id,
- operation: "add",
- type: "level"
- });
- },
"change #levelValueInput": function(event){
var value = event.currentTarget.value;
Levels.update(this._id, {$set: {value: value}});
@@ -42,8 +12,5 @@ Template.levelDialog.events({
Template.levelDialog.helpers({
level: function(){
return Levels.findOne(this.levelId);
- },
- effects: function(){
- return Effects.find({sourceId: this._id, type: "level"});
}
});
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/journal/noteDialog/noteDialog.html b/rpg-docs/client/views/character/journal/noteDialog/noteDialog.html
index cf596e5d..158fb930 100644
--- a/rpg-docs/client/views/character/journal/noteDialog/noteDialog.html
+++ b/rpg-docs/client/views/character/journal/noteDialog/noteDialog.html
@@ -1,30 +1,16 @@
{{#with note}}
-
-
-
- {{name}}
-
-
-
-
-
-
-
- {{> colorDropdown}}
-
-
-
-
-
-
-
+ {{#baseDialog title=name class=colorClass}}
+
+
-
+
+
+
+
+
+
+ {{/baseDialog}}
{{/with}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/journal/noteDialog/noteDialog.js b/rpg-docs/client/views/character/journal/noteDialog/noteDialog.js
index 85a0184c..2bd9177f 100644
--- a/rpg-docs/client/views/character/journal/noteDialog/noteDialog.js
+++ b/rpg-docs/client/views/character/journal/noteDialog/noteDialog.js
@@ -1,32 +1,11 @@
-Template.noteDialog.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.noteDialog.events({
- "tap #backButton": function(){
- GlobalUI.closeDetail();
+ "color-change": function(event, instance){
+ Notes.update(instance.data.noteId, {$set: {color: event.color}});
},
- "tap #deleteNote": function(){
- Notes.remove(this._id);
- GlobalUI.closeDetail();
+ "tap #deleteButton": function(event, instance){
+ Notes.remove(instance.data.noteId);
+ GlobalUI.closeDetail()
},
- //TODO clean up String -> num here so they don't need casting by Schema.clean
- //TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
"change #noteNameInput, input #noteNameInput": function(event){
var value = event.currentTarget.value
Notes.update(this._id, {$set: {name: value}});
@@ -34,12 +13,6 @@ Template.noteDialog.events({
"change #noteDescriptionInput": function(event){
var value = event.currentTarget.value
Notes.update(this._id, {$set: {description: value}});
- },
- "core-select .colorDropdown": function(event){
- var detail = event.originalEvent.detail;
- if(!detail.isSelected) return;
- var value = detail.item.getAttribute("name");
- Notes.update(this._id, {$set: {color: value}});
}
});
diff --git a/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html b/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html
index 6d7368d8..4565800e 100644
--- a/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html
+++ b/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html
@@ -1,23 +1,6 @@
-
-
-
- {{race}}
-
-
-
- {{#if effects}}
-
-
-
Effects
- {{#each effects}}
- {{>effectEdit}}
- {{/each}}
-
- {{/if}}
-
-
-
+ {{#baseDialog title="Race" class=colorClass hideColor="true" hideDelete="true"}}
+
+ {{> effectsEditList sourceId=_id charId=charId type="racial"}}
+ {{/baseDialog}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/journal/raceDialog/raceDialog.js b/rpg-docs/client/views/character/journal/raceDialog/raceDialog.js
index e6baa0ad..d53dc1e9 100644
--- a/rpg-docs/client/views/character/journal/raceDialog/raceDialog.js
+++ b/rpg-docs/client/views/character/journal/raceDialog/raceDialog.js
@@ -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;
diff --git a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html
index 8e7b3c72..e5951e44 100644
--- a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html
+++ b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html
@@ -1,18 +1,12 @@
-
-
-
- {{name}}
-
-
-
+ {{#baseDialog title=name class="deep-purple white-text" hideColor="true" hideDelete="true"}}
+
+
+
+
+
+
+
+
+ {{/baseDialog}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js
index d9163631..05258d8c 100644
--- a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js
+++ b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js
@@ -1,30 +1,4 @@
-Template.personaDetailsDialog.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.personaDetailsDialog.helpers({
-
-});
-
Template.personaDetailsDialog.events({
- "tap #backButton": function(){
- GlobalUI.closeDetail()
- },
"change #nameInput": function(event){
var input = event.currentTarget.value;
Characters.update( this.charId, {$set: {name: input}} );
diff --git a/rpg-docs/client/views/character/persona/textDialog/textDialog.html b/rpg-docs/client/views/character/persona/textDialog/textDialog.html
index 7d280fd3..99613b8a 100644
--- a/rpg-docs/client/views/character/persona/textDialog/textDialog.html
+++ b/rpg-docs/client/views/character/persona/textDialog/textDialog.html
@@ -1,16 +1,9 @@
-
-
-
- {{title}}
-
-
-
+ {{#baseDialog title=title class=colorClass hideColor="true" hideDelete="true"}}
+
+
+
+
+
+ {{/baseDialog}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/persona/textDialog/textDialog.js b/rpg-docs/client/views/character/persona/textDialog/textDialog.js
index 2fcca539..2e054e47 100644
--- a/rpg-docs/client/views/character/persona/textDialog/textDialog.js
+++ b/rpg-docs/client/views/character/persona/textDialog/textDialog.js
@@ -1,22 +1,3 @@
-Template.textDialog.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.textDialog.helpers({
value: function(){
var fieldSelector = {fields: {}};
@@ -32,8 +13,5 @@ Template.textDialog.events({
var setter = {$set: {}};
setter.$set[this.field] = input;
Characters.update(this.charId, setter);
- },
- "tap #backButton": function(){
- GlobalUI.closeDetail()
- },
+ }
});
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html
index 82a9335a..2b532073 100644
--- a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html
+++ b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html
@@ -1,89 +1,75 @@
{{#with spell}}
-
-
-
- {{name}}
-
-
-
-
-
-
-
- {{> colorDropdown}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Verbal:
-
-
Somatic:
-
-
Concentration:
-
-
-
Ritual:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ {{#baseDialog title=name class=colorClass}}
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Verbal:
+
+
Somatic:
+
+
Concentration:
+
+
+
Ritual:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{/baseDialog}}
{{/with}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js
index 32e38117..a57487fa 100644
--- a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js
+++ b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js
@@ -11,35 +11,36 @@ var spellLevels = [
{ name: "Level 9", level: 9 },
];
-Template.spellDialog.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.spellDialog.helpers({
+ spell: function(){
+ return Spells.findOne(this.spellId);
+ },
+ spellLists: function(){
+ return SpellLists.find({charId: this.charId}, {fields: {name: 1}});
+ },
+ magicSchools: function(){
+ return magicSchools;
+ },
+ spellLevels: function(){
+ return spellLevels;
+ },
+ preparedOptions: function(){
+ return [
+ {name: "Prepared", value: "prepared"},
+ {name: "Unprepared", value: "unprepared"},
+ {name: "Always Prepared", value: "always"}
+ ];
}
-}
+});
Template.spellDialog.events({
- "tap #backButton": function(){
- GlobalUI.closeDetail();
+ "color-change": function(event, instance){
+ Spells.update(instance.data.spellId, {$set: {color: event.color}});
},
- "tap #deleteSpell": function(){
- Spells.remove(this._id);
- GlobalUI.closeDetail();
+ "tap #deleteButton": function(event, instance){
+ Spells.remove(instance.data.spellId);
+ GlobalUI.closeDetail()
},
- //TODO clean up String -> num here so they don't need casting by Schema.clean
- //TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
"change #spellNameInput, input #spellNameInput": function(event){
var value = event.currentTarget.value
Spells.update(this._id, {$set: {name: value}});
@@ -92,13 +93,6 @@ Template.spellDialog.events({
if(value == this.school) return;
Spells.update(this._id, {$set: {prepared: value}});
},
- "core-select .colorDropdown": function(event){
- var detail = event.originalEvent.detail;
- if(!detail.isSelected) return;
- var value = detail.item.getAttribute("name");
- if(value == this.color) return;
- Spells.update(this._id, {$set: {color: value}});
- },
"change #verbalCheckbox": function(event){
var value = event.currentTarget.checked;
Spells.update(this._id, {$set: {"components.verbal": value}});
@@ -116,28 +110,3 @@ Template.spellDialog.events({
Spells.update(this._id, {$set: {"ritual": value}});
},
});
-
-Template.spellDialog.helpers({
- spell: function(){
- return Spells.findOne(this.spellId);
- },
- colorClass: function(){
- return getColorClass(this.color)
- },
- spellLists: function(){
- return SpellLists.find({charId: this.charId}, {fields: {name: 1}});
- },
- magicSchools: function(){
- return magicSchools;
- },
- spellLevels: function(){
- return spellLevels;
- },
- preparedOptions: function(){
- return [
- {name: "Prepared", value: "prepared"},
- {name: "Unprepared", value: "unprepared"},
- {name: "Always Prepared", value: "always"}
- ];
- }
-});
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html
index fd4301b1..baabd527 100644
--- a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html
+++ b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html
@@ -1,48 +1,34 @@
{{#with spellList}}
-
-
-
- {{name}}
-
-
-
-
-
-
-
- {{> colorDropdown}}
-
-
-
-
-
-
-
-
-
-
-
-
-
+ {{#baseDialog title=name class=colorClass}}
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+ {{/baseDialog}}
{{/with}}
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.js b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.js
index 3d5d9110..9c17d93a 100644
--- a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.js
+++ b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.js
@@ -1,29 +1,10 @@
-Template.spellListDialog.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.spellListDialog.events({
- "tap #backButton": function(){
- GlobalUI.closeDetail();
+ "color-change": function(event, instance){
+ SpellLists.update(instance.data.spellListId, {$set: {color: event.color}});
},
- "tap #deleteSpellList": function(){
- SpellLists.remove(this._id);
- GlobalUI.closeDetail();
+ "tap #deleteButton": function(event, instance){
+ SpellLists.remove(instance.data.spellListId);
+ GlobalUI.closeDetail()
},
//TODO clean up String -> num here so they don't need casting by Schema.clean
//TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
@@ -43,20 +24,14 @@ Template.spellListDialog.events({
var value = event.currentTarget.value
SpellLists.update(this._id, {$set: {maxPrepared: value}});
},
- //TODO change #spellListDescription
- "core-select .colorDropdown": function(event){
- var detail = event.originalEvent.detail;
- if(!detail.isSelected) return;
- var value = detail.item.getAttribute("name");
- SpellLists.update(this._id, {$set: {color: value}});
- }
+ "change #spellListDescriptionInput": function(event){
+ var value = event.currentTarget.value
+ SpellLists.update(this._id, {$set: {description: value}});
+ },
});
Template.spellListDialog.helpers({
spellList: function(){
return SpellLists.findOne(this.spellListId);
- },
- colorClass: function(){
- return getColorClass(this.color)
}
});
\ No newline at end of file
diff --git a/rpg-docs/client/views/character/stats/healthCard/healthCard.js b/rpg-docs/client/views/character/stats/healthCard/healthCard.js
index e64b964a..005611ff 100644
--- a/rpg-docs/client/views/character/stats/healthCard/healthCard.js
+++ b/rpg-docs/client/views/character/stats/healthCard/healthCard.js
@@ -7,7 +7,6 @@ Template.healthCard.helpers({
return char && char.deathSave;
},
failIcon: function(num){
- console.log("checking ", num, " against fail", this)
if(num <= this.fail) return "radio-button-on";
else return "radio-button-off";
},
diff --git a/rpg-docs/client/views/layout/imports.html b/rpg-docs/client/views/layout/imports.html
index 85bf3772..2f2c53ff 100644
--- a/rpg-docs/client/views/layout/imports.html
+++ b/rpg-docs/client/views/layout/imports.html
@@ -5,6 +5,7 @@
+
diff --git a/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.html b/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.html
new file mode 100644
index 00000000..20f587ef
--- /dev/null
+++ b/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.html
@@ -0,0 +1,23 @@
+
+
+
+
+ {{title}}
+ {{#if hideColor}}{{else}}
+
+ {{> colorDropdown}}
+ {{/if}}
+ {{#if hideDelete}}{{else}}
+
+ {{/if}}
+
+
+ {{> UI.contentBlock}}
+
+
+
\ No newline at end of file
diff --git a/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js b/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js
new file mode 100644
index 00000000..2aa8b367
--- /dev/null
+++ b/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js
@@ -0,0 +1,24 @@
+Template.baseDialog.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.baseDialog.events({
+ "tap #backButton": function(){
+ GlobalUI.closeDetail()
+ }
+});
diff --git a/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.html b/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.html
index 25b235c0..f0d52e17 100644
--- a/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.html
+++ b/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.html
@@ -1,4 +1,4 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.js b/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.js
index d62ef2f1..b1f134ec 100644
--- a/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.js
+++ b/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.js
@@ -3,3 +3,13 @@ Template.colorDropdown.helpers({
return colorOptions;
}
});
+
+Template.colorDropdown.events({
+ "tap .colorMenuItem": function(event, instance){
+ var color = event.currentTarget.getAttribute("name");
+ instance.$("#colorDropdown").trigger({
+ type: "color-change",
+ color: color
+ });
+ }
+})