Merge branch 'enhancement-spell-library-style'

This commit is contained in:
Stefan Zermatten
2017-09-08 09:47:53 +02:00
5 changed files with 20 additions and 38 deletions

View File

@@ -57,7 +57,7 @@ Template.features.helpers({
return removeDuplicateProficiencies(profs);
},
hasCharacters: function(string){
return string.match(/\S/);
return string && string.match(/\S/);
},
});

View File

@@ -291,7 +291,6 @@ Template.spells.events({
Effects.insert(effect);
});
/******[UNCOMMENT ONCE BUFFS ARE ADDED]*******
_.each(rawSpell.buffs, (buff) => {
buff.charId = charId;
buff.parent = {id: spellId, collection: "Spells"};
@@ -314,7 +313,6 @@ Template.spells.events({
Proficiencies.insert(prof);
});
});
*******[UNCOMMENT ONCE BUFFS ARE ADDED]******/
});
},
returnElement: () => $(`[data-id='${spellId}']`).get(0),
@@ -384,4 +382,4 @@ Template.layout.events({
Session.set("spellLists.dragSpellId", null);
}
},
});
});

View File

@@ -1,7 +1,3 @@
.spell-library-dialog .spell.selected {
background-color: #e4e4e4;
}
.spell-library-dialog .category-header {
font-size: 16px;
}
@@ -13,11 +9,3 @@
.spell-library-dialog .category-header iron-icon.open {
transform: rotate(90deg);
}
.spell-library-dialog table {
border-collapse: collapse;
}
.spell-library-dialog .library-spell td {
position: relative;
}

View File

@@ -13,13 +13,11 @@
<div class="spells" style="padding:8px">
{{#if searchTerm}}
{{#if searchSpells.count}}
<table style="width: 100%">
<tbody>
{{#each spell in searchSpells}}
{{>librarySpell spell=spell selected=(isSelected spell)}}
{{/each}}
</tbody>
</table>
<div>
{{#each spell in searchSpells}}
{{>librarySpell spell=spell selected=(isSelected spell)}}
{{/each}}
</div>
{{else}}{{#if searchReady}}
No spells match "{{searchTerm}}"
{{/if}}{{/if}}
@@ -36,13 +34,11 @@
{{name}}
</div>
<iron-collapse opened={{isOpen key}}>
<table style="width: 100%">
<tbody>
{{#each spell in (spellsInCategory key)}}
{{>librarySpell spell=spell selected=(isSelected spell)}}
{{/each}}
</tbody>
</table>
<div>
{{#each spell in (spellsInCategory key)}}
{{>librarySpell spell=spell selected=(isSelected spell)}}
{{/each}}
</div>
{{#unless ready key}}
<paper-spinner active></paper-spinner>
{{/unless}}
@@ -59,10 +55,10 @@
</template>
<template name="librarySpell">
<tr class="spell library-spell {{#if selected}}selected{{/if}}">
<td class="spellName">
<div style="margin: ">
<paper-checkbox class="spell library-spell" checked={{selected}} style="padding: 2px 0 2px 16px; width: 100%;">
{{spell.name}}
<paper-ripple></paper-ripple>
</td>
</tr>
</paper-checkbox>
</div>
</template>

View File

@@ -62,6 +62,10 @@ Template.spellLibraryDialog.helpers({
const selected = Template.instance().selectedSpells.get();
return _.contains(selected, spell._id);
},
selectedCount(){
const selected = Template.instance().selectedSpells.get();
return selected && selected.length;
},
isOpen(key){
const cats = Template.instance().categoriesOpen.get();
return _.contains(cats, key);
@@ -109,10 +113,6 @@ Template.spellLibraryDialog.events({
selected.push(spellId);
}
template.selectedSpells.set(selected);
console.log("selectedSpells", Template.instance().selectedSpells.get());
console.log("spellId", this.spell._id);
},
"click #backButton": function(event, template){
popDialogStack();