Conditions are now separate from buffs, like in #109
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<template name="conditionView">
|
||||
<div class="item conditionView layout horizontal center">
|
||||
<div class="flex">
|
||||
{{condition.name}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,11 @@
|
||||
Template.conditionView.events({
|
||||
"click .conditionView": function(event){
|
||||
var condition = this.condition;
|
||||
var charId = Template.parentData()._id;
|
||||
pushDialogStack({
|
||||
template: "conditionViewDialog",
|
||||
data: {condition: condition},
|
||||
element: event.currentTarget,
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
<template name="conditionViewDialog">
|
||||
{{#baseDialog title=condition.name class="white" hideColor=true startEditing=true editOnly=true}}}
|
||||
{{> conditionDetails condition=condition}}
|
||||
{{else}}
|
||||
{{> conditionDetails condition=condition}}
|
||||
{{/baseDialog}}
|
||||
</template>
|
||||
|
||||
<template name="conditionDetails">
|
||||
{{#if condition.description}}
|
||||
<div>{{#markdown}}{{evaluateString condition.charId condition.description}}{{/markdown}}</div>
|
||||
{{/if}}
|
||||
{{> effectsViewList charId=condition.charId parentId=condition._id}}
|
||||
</template>
|
||||
@@ -0,0 +1,6 @@
|
||||
Template.conditionViewDialog.events({
|
||||
"click #deleteButton": function(event, instance){
|
||||
Conditions.remove(instance.data.condition._id);
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
@@ -1,31 +1,29 @@
|
||||
<template name="customBuffEdit">
|
||||
{{#with buff}}
|
||||
{{#baseEditDialog title=name hideColor=true}}
|
||||
<!--name-->
|
||||
<paper-input id="buffNameInput" class="fullwidth" label="Name" value={{name}}></paper-input>
|
||||
{{#baseEditDialog title=buff.name hideColor=true}}
|
||||
<!--name-->
|
||||
<paper-input id="buffNameInput" class="fullwidth" label="Name" value={{buff.name}}></paper-input>
|
||||
|
||||
<div class="layout horizontal center wrap justified">
|
||||
<paper-dropdown-menu class=flex label="Target" style="flex-basis: 150px; max-width: 200px;">
|
||||
<dicecloud-selector selected={{target}} class="dropdown-content target-dropdown">
|
||||
<paper-item name="self" style="width: 150px;">
|
||||
Self only
|
||||
</paper-item>
|
||||
<paper-item name="others">
|
||||
Others only
|
||||
</paper-item>
|
||||
<paper-item name="both">
|
||||
Both
|
||||
</paper-item>
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
</div>
|
||||
<div class="layout horizontal center wrap justified">
|
||||
<paper-dropdown-menu class=flex label="Target" style="flex-basis: 150px; max-width: 200px;">
|
||||
<dicecloud-selector selected={{buff.target}} class="dropdown-content target-dropdown">
|
||||
<paper-item name="self" style="width: 150px;">
|
||||
Self only
|
||||
</paper-item>
|
||||
<paper-item name="others">
|
||||
Others only
|
||||
</paper-item>
|
||||
<paper-item name="both">
|
||||
Both
|
||||
</paper-item>
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
</div>
|
||||
|
||||
<!--description-->
|
||||
<paper-textarea label="Description" id="buffDescriptionInput" value={{description}}></paper-textarea>
|
||||
<!--description-->
|
||||
<paper-textarea label="Description" id="buffDescriptionInput" value={{buff.description}}></paper-textarea>
|
||||
|
||||
{{> effectsEditList parentId=_id parentCollection="Buffs" charId=charId name=name enabled=false}}
|
||||
{{> attackEditList parentId=_id parentCollection="Buffs" charId=charId name=name enabled=false}}
|
||||
{{> proficiencyEditList parentId=_id parentCollection="Buffs" charId=charId enabled=false}}
|
||||
{{/baseEditDialog}}
|
||||
{{/with}}
|
||||
{{> effectsEditList parentId=buff._id parentCollection="CustomBuffs" charId=buff.charId name=name enabled=false}}
|
||||
{{> attackEditList parentId=buff._id parentCollection="CustomBuffs" charId=buff.charId name=name enabled=false}}
|
||||
{{> proficiencyEditList parentId=buff._id parentCollection="CustomBuffs" charId=buff.charId enabled=false}}
|
||||
{{/baseEditDialog}}
|
||||
</template>
|
||||
@@ -1,9 +1,3 @@
|
||||
Template.customBuffEdit.helpers({
|
||||
buff: function(){
|
||||
return CustomBuffs.findOne(this.buffId);
|
||||
},
|
||||
});
|
||||
|
||||
const debounce = (f) => _.debounce(f, 300);
|
||||
|
||||
Template.customBuffEdit.events({
|
||||
@@ -15,7 +9,7 @@ Template.customBuffEdit.events({
|
||||
input.errorMessage = "Name is required";
|
||||
} else {
|
||||
input.invalid = false;
|
||||
CustomBuffs.update(this._id, {
|
||||
CustomBuffs.update(this.buff._id, {
|
||||
$set: {name: name}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
@@ -25,7 +19,7 @@ Template.customBuffEdit.events({
|
||||
}),
|
||||
"input #buffDescriptionInput": debounce(function(event){
|
||||
var description = event.currentTarget.value;
|
||||
CustomBuffs.update(this._id, {
|
||||
CustomBuffs.update(this.buff._id, {
|
||||
$set: {description: description}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
@@ -35,7 +29,7 @@ Template.customBuffEdit.events({
|
||||
"iron-select .target-dropdown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = detail.item.getAttribute("name");
|
||||
if (value === this.target) return;
|
||||
CustomBuffs.update(this._id, {$set: {target: value}});
|
||||
if (value === this.buff.target) return;
|
||||
CustomBuffs.update(this.buff._id, {$set: {target: value}});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ Template.customBuffEditListItem.events({
|
||||
"tap .edit-buff": function(event, template){
|
||||
pushDialogStack({
|
||||
template: "customBuffEdit",
|
||||
data: {id: this.buff._id},
|
||||
data: {buff: this.buff},
|
||||
element: event.currentTarget.parentElement.parentElement,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<div flex class="bottom list">
|
||||
<div class="conditionsList">
|
||||
{{#each condition in conditions}}
|
||||
{{>buffListItem buff=condition}}
|
||||
{{>conditionView condition=condition}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{#if buffs.count}}
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
Template.stats.helpers({
|
||||
conditions: function(){
|
||||
var selector = {
|
||||
"charId": this._id,
|
||||
"type": "inate",
|
||||
};
|
||||
return Buffs.find(selector);
|
||||
conditions: function() {
|
||||
return Conditions.find({charId: this._id});
|
||||
},
|
||||
buffs: function(){
|
||||
buffs: function() {
|
||||
var selector = {
|
||||
"charId": this._id,
|
||||
"type": "custom",
|
||||
};
|
||||
return Buffs.find(selector);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user