+
+
+
+
+ Verbal
+
+
+ Somatic
+
+
+
+
+
+ class="flex"
+ >
+
+ Concentration
+
-
-
-
-
-
-
-
+
+
{{> attackEditList parentId=_id parentCollection="Spells" charId=charId enabled=true name=name}}
diff --git a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js
index 9b2c7ad9..601b67a2 100644
--- a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js
+++ b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js
@@ -24,7 +24,7 @@ Template.spellDialog.events({
"tap #deleteButton": function(event, instance){
Spells.softRemoveNode(instance.data.spellId);
GlobalUI.deletedToast(instance.data.spellId, "Spells", "Spell");
- GlobalUI.closeDetail();
+ popDialogStack();
},
});
@@ -47,10 +47,6 @@ Template.spellDetails.helpers({
},
});
-Template.spellEdit.onRendered(function(){
- updatePolymerInputs(this);
-});
-
Template.spellEdit.helpers({
spellLists: function(){
return SpellLists.find({charId: this.charId}, {fields: {name: 1}});
@@ -70,55 +66,92 @@ Template.spellEdit.helpers({
},
});
+const debounce = (f) => _.debounce(f, 300);
+
Template.spellEdit.events({
- "change #spellNameInput, input #spellNameInput": function(event){
+ "change #spellNameInput, input #spellNameInput": debounce(function(event){
+ const input = event.currentTarget;
+ var value = input.value;
+ if (!value){
+ input.invalid = true;
+ input.errorMessage = "Name is required";
+ } else {
+ input.invalid = false;
+ Spells.update(this._id, {
+ $set: {name: value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }
+ }),
+ "change #castingTimeInput, input #castingTimeInput": debounce(function(event){
var value = event.currentTarget.value;
- Spells.update(this._id, {$set: {name: value}});
- },
- "change #castingTimeInput": function(event){
+ Spells.update(this._id, {
+ $set: {castingTime: value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }),
+ "change #rangeInput, input #rangeInput": debounce(function(event){
var value = event.currentTarget.value;
- Spells.update(this._id, {$set: {castingTime: value}});
- },
- "change #rangeInput": function(event){
+ Spells.update(this._id, {
+ $set: {range: value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }),
+ "change #durationInput, input #durationInput": debounce(function(event){
var value = event.currentTarget.value;
- Spells.update(this._id, {$set: {range: value}});
- },
- "change #durationInput": function(event){
+ Spells.update(this._id, {
+ $set: {duration: value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }),
+ "change #materialInput, input #materialInput": debounce(function(event){
var value = event.currentTarget.value;
- Spells.update(this._id, {$set: {duration: value}});
- },
- "change #materialInput": function(event){
+ Spells.update(this._id, {
+ $set: {"components.material": value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }),
+ "input #descriptionInput": debounce(function(event){
var value = event.currentTarget.value;
- Spells.update(this._id, {$set: {"components.material": value}});
- },
- "change #descriptionInput": function(event){
- var value = event.currentTarget.value;
- Spells.update(this._id, {$set: {"description": value}});
- },
- "core-select #listDropdown": function(event){
+ Spells.update(this._id, {
+ $set: {"description": value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }),
+ "iron-select #listDropdown": function(event){
var detail = event.originalEvent.detail;
- if (!detail.isSelected) return;
var value = detail.item.getAttribute("name");
if (value == this.parent.id) return;
- Spells.update(this._id, {$set: {"parent.id": value}});
+ Spells.update(this._id, {
+ $set: {"parent.id": value}
+ });
},
- "core-select #levelDropdown": function(event){
+ "iron-select #levelDropdown": function(event){
var detail = event.originalEvent.detail;
- if (!detail.isSelected) return;
var value = detail.item.getAttribute("name");
if (value == this.level) return;
Spells.update(this._id, {$set: {level: value}});
},
- "core-select #schoolDropdown": function(event){
+ "iron-select #schoolDropdown": function(event){
var detail = event.originalEvent.detail;
- if (!detail.isSelected) return;
var value = detail.item.getAttribute("name");
if (value == this.school) return;
Spells.update(this._id, {$set: {school: value}});
},
- "core-select #preparedDropdown": function(event){
+ "iron-select #preparedDropdown": function(event){
var detail = event.originalEvent.detail;
- if (!detail.isSelected) return;
var value = detail.item.getAttribute("name");
if (value == this.school) return;
Spells.update(this._id, {$set: {prepared: value}});
diff --git a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html
index 3bed65e6..8063d957 100644
--- a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html
+++ b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html
@@ -2,10 +2,10 @@
{{#with spellList}}
{{#baseDialog title=name class=colorClass startEditing=../startEditing}}
-
+
{{#if attackBonus}}
- Attack Bonus: {{evaluate charId attackBonus}}
+ Attack Bonus: {{evaluateSigned charId attackBonus}}
{{/if}}
{{#if saveDC}}
@@ -15,7 +15,7 @@
{{/if}}
{{#if maxPrepared}}
- Max Prepared: {{evaluateSigned charId maxPrepared}}
+ Max Prepared Spells: {{evaluate charId maxPrepared}}
{{/if}}
@@ -23,36 +23,26 @@
{{#markdown}}{{evaluateString charId description}}{{/markdown}}
{{else}}
+
-
+
+
-
+
+ {{> formulaSuffix}}
+
-
+
+ {{> formulaSuffix}}
+
-
+
+ {{> formulaSuffix}}
+
-
-
-
-
-
+
+
+
{{/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 60065831..c967d72c 100644
--- a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.js
+++ b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.js
@@ -1,48 +1,80 @@
-Template.spellListDialog.onRendered(function(){
- updatePolymerInputs(this);
+Template.spellListDialog.helpers({
+ spellList: function(){
+ return SpellLists.findOne(this.spellListId);
+ }
});
+const debounce = (f) => _.debounce(f, 300);
+
Template.spellListDialog.events({
"color-change": function(event, instance){
SpellLists.update(instance.data.spellListId, {$set: {color: event.color}});
},
- "tap #deleteButton": function(event, instance){
+ "click #deleteButton": function(event, instance){
SpellLists.softRemoveNode(instance.data.spellListId);
GlobalUI.deletedToast(
instance.data.spellListId,
"SpellLists",
"Spell list and contents"
);
- GlobalUI.closeDetail();
+ popDialogStack();
},
//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 #spellListNameInput, input #spellListNameInput": function(event){
+ "change #spellListNameInput, input #spellListNameInput":
+ debounce(function(event){
+ const input = event.currentTarget;
+ var value = input.value;
+ if (!value){
+ input.invalid = true;
+ input.errorMessage = "Name is required";
+ } else {
+ input.invalid = false;
+ SpellLists.update(this._id, {
+ $set: {name: value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }
+ }),
+ "change #spellListSaveDCInput, input #spellListSaveDCInput":
+ debounce(function(event){
var value = event.currentTarget.value;
- SpellLists.update(this._id, {$set: {name: value}});
- },
- "change #spellListSaveDCInput, input #spellListSaveDCInput": function(event){
- var value = event.currentTarget.value;
- SpellLists.update(this._id, {$set: {saveDC: value}});
- },
+ SpellLists.update(this._id, {
+ $set: {saveDC: value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }),
"change #spellListAttackBonusInput, input #spellListAttackBonusInput":
- function(event){
+ debounce(function(event){
var value = event.currentTarget.value;
- SpellLists.update(this._id, {$set: {attackBonus: value}});
- },
+ SpellLists.update(this._id, {
+ $set: {attackBonus: value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }),
"change #spellListMaxPreparedInput, input #spellListMaxPreparedInput":
- function(event){
+ debounce(function(event){
var value = event.currentTarget.value;
- SpellLists.update(this._id, {$set: {maxPrepared: value}});
- },
- "change #spellListDescriptionInput": function(event){
+ SpellLists.update(this._id, {
+ $set: {maxPrepared: value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }),
+ "input #spellListDescriptionInput": debounce(function(event){
var value = event.currentTarget.value;
- SpellLists.update(this._id, {$set: {description: value}});
- },
-});
-
-Template.spellListDialog.helpers({
- spellList: function(){
- return SpellLists.findOne(this.spellListId);
- }
+ SpellLists.update(this._id, {
+ $set: {description: value}
+ }, {
+ removeEmptyStrings: false,
+ trimStrings: false,
+ });
+ }),
});
diff --git a/rpg-docs/client/views/character/spells/spells.css b/rpg-docs/client/views/character/spells/spells.css
index 4fe22baa..148d2d0f 100644
--- a/rpg-docs/client/views/character/spells/spells.css
+++ b/rpg-docs/client/views/character/spells/spells.css
@@ -67,17 +67,15 @@
margin: 4px;
}
-.spellList .containerMain {
- -ms-column-width: 300px;
- -webkit-column-width: 300px;
- -moz-column-width: 300px;
+.spellList.card .bottom.list {
column-width: 300px;
- -ms-column-gap: 8px;
- -webkit-column-gap: 8px;
- -moz-column-gap: 8px;
column-gap: 8px;
- -moz-column-fill: balance;
column-fill: balance;
+ padding: 16px 4px;
+}
+
+.spellList .bottom .paper-font-subhead {
+ margin-left: 16px;
}
.spellLevel {
diff --git a/rpg-docs/client/views/character/spells/spells.html b/rpg-docs/client/views/character/spells/spells.html
index 7ea409f8..35c0736e 100644
--- a/rpg-docs/client/views/character/spells/spells.html
+++ b/rpg-docs/client/views/character/spells/spells.html
@@ -1,147 +1,145 @@
-