Compare commits

...

5 Commits

Author SHA1 Message Date
Stefan Zermatten
0789e4d759 Merge branch 'hotfix-item-libraries' 2019-05-07 09:26:12 +02:00
Stefan Zermatten
39c91f58e4 Swapped weight and value in library item dialog to be consistent with the inventory 2019-05-07 09:25:06 +02:00
Stefan Zermatten
c84342b21a Fixed styling of item library dialog on small screens 2019-05-07 09:19:12 +02:00
Stefan Zermatten
0373feb2ea Fixed issue where effects in libraries would appear editable to subscribers 2019-05-07 09:18:53 +02:00
Stefan Zermatten
0b11595657 Fixed an issue where adding items from libraries didn't get all their properties 2019-05-06 15:55:45 +02:00
5 changed files with 17 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ Template.itemLibraryDialog.onCreated(function(){
if (_.contains(categoryKeys, key)){
handle = librarySubs.subscribe("standardLibraryItems", key);
} else {
handle = librarySubs.subscribe("libraryItems", key);
handle = librarySubs.subscribe("fullLibraryItems", key);
}
this.autorun(() => {
this.readyDict.set(key, handle.ready());

View File

@@ -0,0 +1,3 @@
.library-item-dialog paper-input {
min-width: 160px;
}

View File

@@ -1,5 +1,5 @@
<template name="libraryItemDialog">
<div class="fit base-dialog layout vertical">
<div class="fit base-dialog layout vertical library-item-dialog">
<app-toolbar>
<paper-icon-button id="backButton"
icon="arrow-back">
@@ -24,8 +24,8 @@
</paper-checkbox>
</div>
<div class="layout horizontal center wrap">
<paper-input id="libraryItemValueInput" class="flex" label="Value" type="number" value={{item.value}} disabled="{{cantEdit}}"></paper-input>
<paper-input id="libraryItemWeightInput" class="flex" label="Weight" type="number" value={{item.weight}} disabled="{{cantEdit}}"></paper-input>
<paper-input id="libraryItemValueInput" class="flex" label="Value" type="number" value={{item.value}} disabled="{{cantEdit}}"></paper-input>
<paper-checkbox id="attunementCheckbox" class="flex" checked={{item.requiresAttunement}} disabled="{{cantEdit}}">
Requires Attunement
</paper-checkbox>
@@ -34,7 +34,7 @@
<div style="margin-top: 8px;">
<div class="paper-font-subhead">Effects</div>
{{#each indexedEffects}}
<div class="effect layout horizontal center wrap">
<div class="effect layout horizontal center wrap" style="margin-bottom: 32px;">
<paper-dropdown-menu label="Operation" class="operationMenu" disabled="{{cantEdit}}">
<paper-listbox class="dropdown-content" selected={{operationIndex operation}}>
<paper-item label="Base Value" name="base"> Base Value </paper-item>
@@ -59,7 +59,7 @@
<div style="margin-top: 8px;">
<div class="paper-font-subhead">Attacks</div>
{{#each indexedAttacks}}
<div class="effect layout horizontal center wrap">
<div class="effect layout horizontal center wrap" style="margin-bottom: 32px">
<paper-input class="LibraryItemAttackBonusInput flex" label="Attack Bonus" value={{attackBonus}} disabled="{{cantEdit}}"></paper-input>
<paper-input class="LibraryItemAttackDamageInput flex" label="Damage" value={{damage}} disabled="{{cantEdit}}"></paper-input>
<paper-input class="LibraryItemAttackDetailsInput flex" label="Details" value={{details}} disabled="{{cantEdit}}"></paper-input>

View File

@@ -66,7 +66,9 @@ Template.libraryItemDialog.helpers({
return Template.instance().subscriptionsReady();
},
cantEdit(){
let item = LibraryItems.findOne(this.itemId);
// Get itemId from the top level template data regardless of current context
let itemId = Blaze.getData(Template.instance().view).itemId;
let item = LibraryItems.findOne(itemId);
if (!item) return;
let library = Libraries.findOne(item.library);
if (!library) return;

View File

@@ -63,6 +63,12 @@ Meteor.publish("libraryItems", function(libraryId){
});
});
Meteor.publish("fullLibraryItems", function(libraryId){
return LibraryItems.find({
library: libraryId
});
});
Meteor.publish("libraryItem", function(itemId){
let cursor = LibraryItems.find(itemId);
let item = cursor.fetch()[0];