Made unprepared spells hidable
This commit is contained in:
@@ -6,7 +6,7 @@ Schemas.Spell = new SimpleSchema({
|
|||||||
prepared: {type: String, defaultValue: "unprepared", allowedValues: ["prepared","unprepared","always"]},
|
prepared: {type: String, defaultValue: "unprepared", allowedValues: ["prepared","unprepared","always"]},
|
||||||
name: {type: String},
|
name: {type: String},
|
||||||
description: {type: String, optional: true},
|
description: {type: String, optional: true},
|
||||||
castingTime: {type: String, defaultValue: "action"},
|
castingTime: {type: String, optional: true, defaultValue: "action"},
|
||||||
range: {type: String, optional: true},
|
range: {type: String, optional: true},
|
||||||
duration: {type: String, optional: true},
|
duration: {type: String, optional: true},
|
||||||
"components.verbal": {type: Boolean, defaultValue: false},
|
"components.verbal": {type: Boolean, defaultValue: false},
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ body /deep/ #proficiencyDropDown {
|
|||||||
width: 120px;
|
width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
html /deep/ paper-input {
|
html /deep/ .effectEdit paper-input {
|
||||||
margin-bottom: 1px;
|
position: relative;
|
||||||
|
bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
html /deep/ .effectEdit {
|
html /deep/ .effectEdit {
|
||||||
|
|||||||
@@ -6,3 +6,11 @@
|
|||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#spells .inventoryItem paper-checkbox{
|
||||||
|
pointer-events: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
#spells paper-checkbox /deep/ #ink {
|
||||||
|
color: #009688;
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,30 +17,37 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if maxPrepared}}<div class="subhead">{{numPrepared}} / {{maxPrepared}}</div>{{/if}}
|
{{#if settings.showUnprepared}}
|
||||||
|
{{#if maxPrepared}}<div class="subhead">{{numPrepared}} / {{maxPrepared}}</div>{{/if}}
|
||||||
|
<paper-icon-button class="finishPrep" icon="done"></paper-icon-button>
|
||||||
|
{{else}}
|
||||||
|
<paper-icon-button class="prepSpells" icon="book"></paper-icon-button>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="containerMain">
|
<div class="containerMain">
|
||||||
{{#each levels}}
|
{{#each levels}}
|
||||||
{{#if spellCount ../_id ../../_id}}
|
{{#if spellCount .. ../../_id}}
|
||||||
<div class="list-subhead" layout horizontal center>{{name}}</div>
|
<div class="list-subhead" layout horizontal center>{{name}}</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#each spells ../_id ../../_id}}
|
{{#each spells ../_id ../../_id}}
|
||||||
<div class="itemSlot">
|
{{#if showSpell ../../settings.showUnprepared}}
|
||||||
<paper-item class="inventoryItem spell" hero-id="main" {{detailHero}} layout horizontal center>
|
<div class="itemSlot">
|
||||||
<core-icon icon="social:whatshot" style="color: {{hexColor color}};"></core-icon>
|
<paper-item class="inventoryItem spell" hero-id="main" {{detailHero}} layout horizontal center>
|
||||||
<div flex layout vertical>
|
<core-icon icon="social:whatshot" style="color: {{hexColor color}};"></core-icon>
|
||||||
<div>{{name}}</div>
|
<div flex layout vertical>
|
||||||
<div class="caption">
|
<div>{{name}}</div>
|
||||||
{{school}} {{castingTime}}{{#if ritual}} (ritual){{/if}} - {{spellComponents}}
|
<div class="caption">
|
||||||
|
{{school}} {{castingTime}}{{#if ritual}} (ritual){{/if}} - {{spellComponents}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{#if ../../settings.showUnprepared}}
|
||||||
{{#if ../../settings.showUnprepared}}
|
<paper-checkbox class="preparedCheckbox" checked={{isPrepared}} disabled={{cantUnprepare}}></paper-checkbox>
|
||||||
<paper-checkbox class="preparedCheckbox" checked={{isPrepared}} disabled={{cantUnprepare}}></paper-checkbox>
|
{{else}}
|
||||||
{{else}}
|
<!--<paper-icon-button class="castButton" icon="send"></paper-icon-button>-->
|
||||||
<paper-icon-button class="castButton" icon="send"></paper-icon-button>
|
{{/if}}
|
||||||
{{/if}}
|
</paper-item>
|
||||||
</paper-item>
|
</div>
|
||||||
</div>
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,8 +15,14 @@ Template.spells.helpers({
|
|||||||
spellLists: function(){
|
spellLists: function(){
|
||||||
return SpellLists.find({charId: this._id});
|
return SpellLists.find({charId: this._id});
|
||||||
},
|
},
|
||||||
spellCount: function(listId, charId){
|
spellCount: function(list, charId){
|
||||||
return Spells.find( {charId: charId, listId: listId, level: this.level}, {fields: {_id: 1, level: 1}} ).count() > 0;
|
if(list.settings.showUnprepared){
|
||||||
|
return Spells.find( {charId: charId, listId: list._id, level: this.level},
|
||||||
|
{fields: {_id: 1, level: 1}} ).count() > 0;
|
||||||
|
} else{
|
||||||
|
return Spells.find( {charId: charId, listId: list._id, level: this.level, prepared: {$in: ["prepared", "always"]} },
|
||||||
|
{fields: {_id: 1, level: 1}} ).count() > 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
spells: function(listId, charId){
|
spells: function(listId, charId){
|
||||||
return Spells.find( {charId: charId, listId: listId, level: this.level} );
|
return Spells.find( {charId: charId, listId: listId, level: this.level} );
|
||||||
@@ -50,6 +56,13 @@ Template.spells.helpers({
|
|||||||
isPrepared: function(){
|
isPrepared: function(){
|
||||||
return this.prepared === "prepared" || this.prepared === "always";
|
return this.prepared === "prepared" || this.prepared === "always";
|
||||||
},
|
},
|
||||||
|
showSpell: function(listShowPrepped){
|
||||||
|
if(listShowPrepped) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return this.prepared === "prepared" || this.prepared === "always";
|
||||||
|
}
|
||||||
|
},
|
||||||
cantUnprepare: function(){
|
cantUnprepare: function(){
|
||||||
return this.prepared === "always";
|
return this.prepared === "always";
|
||||||
}
|
}
|
||||||
@@ -113,5 +126,13 @@ Template.spells.events({
|
|||||||
Spells.update(this._id, {$set: {prepared: "prepared"}});
|
Spells.update(this._id, {$set: {prepared: "prepared"}});
|
||||||
else if(this.prepared === "prepared" && !value)
|
else if(this.prepared === "prepared" && !value)
|
||||||
Spells.update(this._id, {$set: {prepared: "unprepared"}});
|
Spells.update(this._id, {$set: {prepared: "unprepared"}});
|
||||||
}
|
},
|
||||||
|
"tap .prepSpells": function(event){
|
||||||
|
SpellLists.update(this._id, {$set: {"settings.showUnprepared": true}});
|
||||||
|
event.stopPropagation();
|
||||||
|
},
|
||||||
|
"tap .finishPrep": function(event){
|
||||||
|
SpellLists.update(this._id, {$set: {"settings.showUnprepared": false}});
|
||||||
|
event.stopPropagation();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user