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