rename /rpg-docs to /app
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
.spell-dialog paper-checkbox {
|
||||
margin: 8px;
|
||||
}
|
||||
|
||||
.spell-dialog paper-dropdown-menu, .spell-dialog paper-input {
|
||||
margin: 0 4px;
|
||||
}
|
||||
123
app/client/views/character/spells/spellDialog/spellDialog.html
Normal file
123
app/client/views/character/spells/spellDialog/spellDialog.html
Normal file
@@ -0,0 +1,123 @@
|
||||
<template name="spellDialog">
|
||||
<div class="spell-dialog">
|
||||
{{#with spell}}
|
||||
{{#baseDialog title=name class=colorClass startEditing=../startEditing}}
|
||||
{{> spellDetails}}
|
||||
{{else}}
|
||||
{{> spellEdit}}
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="spellDetails">
|
||||
<div class="paper-font-body2">
|
||||
{{schoolAndLevel}}{{#if ritual}} (ritual){{/if}}, {{preparedString}}
|
||||
</div>
|
||||
<div style="margin: 16px 0 16px 0;">
|
||||
{{#if castingTime}}
|
||||
<div>
|
||||
<span class="paper-font-body2">Casting Time: </span><span>{{castingTime}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if range}}
|
||||
<div>
|
||||
<span class="paper-font-body2">Range: </span><span>{{range}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if getComponents}}
|
||||
<div>
|
||||
<span class="paper-font-body2">Components: </span><span>{{getComponents}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if duration}}
|
||||
<div>
|
||||
<span class="paper-font-body2">Duration: </span><span>{{duration}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div>{{#markdown}}{{evaluateSpellString charId parent.id description}}{{/markdown}}</div>
|
||||
{{> attacksViewList charId=charId parentId=_id}}
|
||||
{{> customBuffViewList charId=charId parentId=_id}}
|
||||
</template>
|
||||
|
||||
<template name="spellEdit">
|
||||
<div class="horizontal layout wrap">
|
||||
<paper-input id="spellNameInput" label="Name" class="flex" value={{name}}></paper-input>
|
||||
<paper-dropdown-menu id="listDropdown" label="Spell List">
|
||||
<dicecloud-selector class="dropdown-content" selected={{parent.id}}>
|
||||
{{#each spellLists}}
|
||||
<paper-item name={{_id}} class="containerMenuItem">{{name}}</paper-item>
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
</div>
|
||||
<div class="layout horizontal center justified wrap">
|
||||
<paper-dropdown-menu id="levelDropdown" label="Level">
|
||||
<dicecloud-selector class="dropdown-content" selected={{level}}>
|
||||
{{#each spellLevels}}
|
||||
<paper-item name={{level}} class="containerMenuItem">{{name}}</paper-item>
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
<paper-dropdown-menu id="schoolDropdown" label="School">
|
||||
<dicecloud-selector class="dropdown-content" selected={{school}}>
|
||||
{{#each magicSchools}}
|
||||
<paper-item name={{this}} class="containerMenuItem">{{this}}</paper-item>
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
<paper-dropdown-menu id="preparedDropdown" label="Prepared">
|
||||
<dicecloud-selector class="dropdown-content" selected={{prepared}}>
|
||||
{{#each preparedOptions}}
|
||||
<paper-item name={{value}} class="containerMenuItem">{{name}}</paper-item>
|
||||
{{/each}}
|
||||
</dicecloud-selector>
|
||||
</paper-dropdown-menu>
|
||||
<paper-checkbox id="ritualCheckbox" class="sideMargin" checked={{ritual}}>
|
||||
Ritual
|
||||
</paper-checkbox>
|
||||
</div>
|
||||
<div class="layout horizontal center justified wrap">
|
||||
<paper-input id="castingTimeInput"
|
||||
label="Casting Time"
|
||||
value={{castingTime}}
|
||||
class="flex"
|
||||
></paper-input>
|
||||
<paper-input id="rangeInput"
|
||||
class="sideMargin flex"
|
||||
label="Range"
|
||||
value={{range}}
|
||||
></paper-input>
|
||||
</div>
|
||||
|
||||
<div class="horizontal layout center justified wrap">
|
||||
<paper-checkbox id="verbalCheckbox" class="sideMargin" checked={{components.verbal}}>
|
||||
Verbal
|
||||
</paper-checkbox>
|
||||
<paper-checkbox id="somaticCheckbox" class="sideMargin" checked={{components.somatic}}>
|
||||
Somatic
|
||||
</paper-checkbox>
|
||||
<paper-input id="materialInput" class="sideMargin flex" label="Material Components" value={{components.material}}>
|
||||
</paper-input>
|
||||
</div>
|
||||
<div class="horizontal laout center justified wrap">
|
||||
<paper-input id="durationInput"
|
||||
label="Duration"
|
||||
value={{duration}}
|
||||
class="flex"
|
||||
></paper-input>
|
||||
<paper-checkbox id="concentrationCheckbox" class="sideMargin" checked={{components.concentration}}>
|
||||
Concentration
|
||||
</paper-checkbox>
|
||||
</div>
|
||||
|
||||
<!--Description-->
|
||||
<div class="description-input layout horizontal end">
|
||||
<paper-textarea id="descriptionInput" label="Description" style="width: calc(100% - 24px)" value={{description}}></paper-textarea>
|
||||
{{> textareaBracketSuffix}}
|
||||
</div>
|
||||
|
||||
{{> customBuffEditList parentId=_id parentCollection="Spells" charId=charId}}
|
||||
{{> attackEditList parentId=_id parentCollection="Spells" charId=charId enabled=true name=name isSpell=true}}
|
||||
</template>
|
||||
182
app/client/views/character/spells/spellDialog/spellDialog.js
Normal file
182
app/client/views/character/spells/spellDialog/spellDialog.js
Normal file
@@ -0,0 +1,182 @@
|
||||
var spellLevels = [
|
||||
{name: "Cantrip", level: 0},
|
||||
{name: "Level 1", level: 1},
|
||||
{name: "Level 2", level: 2},
|
||||
{name: "Level 3", level: 3},
|
||||
{name: "Level 4", level: 4},
|
||||
{name: "Level 5", level: 5},
|
||||
{name: "Level 6", level: 6},
|
||||
{name: "Level 7", level: 7},
|
||||
{name: "Level 8", level: 8},
|
||||
{name: "Level 9", level: 9},
|
||||
];
|
||||
|
||||
Template.spellDialog.helpers({
|
||||
spell: function(){
|
||||
return Spells.findOne(this.spellId);
|
||||
}
|
||||
});
|
||||
|
||||
Template.spellDialog.events({
|
||||
"color-change": function(event, instance){
|
||||
Spells.update(instance.data.spellId, {$set: {color: event.color}});
|
||||
},
|
||||
"tap #deleteButton": function(event, instance){
|
||||
Spells.softRemoveNode(instance.data.spellId);
|
||||
GlobalUI.deletedToast(instance.data.spellId, "Spells", "Spell");
|
||||
popDialogStack();
|
||||
},
|
||||
});
|
||||
|
||||
Template.spellDetails.helpers({
|
||||
schoolAndLevel: function(){
|
||||
if (this.level == 0) {
|
||||
return this.school + " cantrip";
|
||||
} else {
|
||||
return "Level " + this.level + " " + this.school;
|
||||
}
|
||||
},
|
||||
getComponents: function(){
|
||||
var components = "";
|
||||
if (this.components.concentration) components += "C";
|
||||
if (this.components.verbal) components += components.length ? ", V" : "V";
|
||||
if (this.components.somatic) components += components.length ? ", S" : "S";
|
||||
if (this.components.material) {
|
||||
components += components.length ? ", M" : "M";
|
||||
components += " (" + this.components.material + ")";
|
||||
}
|
||||
return components;
|
||||
},
|
||||
preparedString: function(){
|
||||
if (this.prepared === "prepared") return "prepared";
|
||||
if (this.prepared === "unprepared") return "unprepared";
|
||||
if (this.prepared === "always") return "always prepared";
|
||||
},
|
||||
});
|
||||
|
||||
Template.spellEdit.helpers({
|
||||
spellLists: function(){
|
||||
return SpellLists.find({charId: this.charId}, {fields: {name: 1}});
|
||||
},
|
||||
magicSchools: function(){
|
||||
return magicSchools;
|
||||
},
|
||||
spellLevels: function(){
|
||||
return spellLevels;
|
||||
},
|
||||
preparedOptions: function(){
|
||||
return [
|
||||
{name: "Prepared", value: "prepared"},
|
||||
{name: "Unprepared", value: "unprepared"},
|
||||
{name: "Always Prepared", value: "always"},
|
||||
];
|
||||
},
|
||||
});
|
||||
|
||||
const debounce = (f) => _.debounce(f, 300);
|
||||
|
||||
Template.spellEdit.events({
|
||||
"change #spellNameInput, input #spellNameInput": debounce(function(event){
|
||||
const input = event.currentTarget;
|
||||
var value = input.value;
|
||||
if (!value){
|
||||
input.invalid = true;
|
||||
input.errorMessage = "Name is required";
|
||||
} else {
|
||||
input.invalid = false;
|
||||
Spells.update(this._id, {
|
||||
$set: {name: value}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}
|
||||
}),
|
||||
"change #castingTimeInput, input #castingTimeInput": debounce(function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Spells.update(this._id, {
|
||||
$set: {castingTime: value}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}),
|
||||
"change #rangeInput, input #rangeInput": debounce(function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Spells.update(this._id, {
|
||||
$set: {range: value}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}),
|
||||
"change #durationInput, input #durationInput": debounce(function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Spells.update(this._id, {
|
||||
$set: {duration: value}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}),
|
||||
"change #materialInput, input #materialInput": debounce(function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Spells.update(this._id, {
|
||||
$set: {"components.material": value}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}),
|
||||
"input #descriptionInput": debounce(function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Spells.update(this._id, {
|
||||
$set: {"description": value}
|
||||
}, {
|
||||
removeEmptyStrings: false,
|
||||
trimStrings: false,
|
||||
});
|
||||
}),
|
||||
"iron-select #listDropdown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = detail.item.getAttribute("name");
|
||||
if (value == this.parent.id) return;
|
||||
Spells.update(this._id, {
|
||||
$set: {"parent.id": value}
|
||||
});
|
||||
},
|
||||
"iron-select #levelDropdown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = detail.item.getAttribute("name");
|
||||
if (value == this.level) return;
|
||||
Spells.update(this._id, {$set: {level: value}});
|
||||
},
|
||||
"iron-select #schoolDropdown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = detail.item.getAttribute("name");
|
||||
if (value == this.school) return;
|
||||
Spells.update(this._id, {$set: {school: value}});
|
||||
},
|
||||
"iron-select #preparedDropdown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
var value = detail.item.getAttribute("name");
|
||||
if (value == this.school) return;
|
||||
Spells.update(this._id, {$set: {prepared: value}});
|
||||
},
|
||||
"change #verbalCheckbox": function(event){
|
||||
var value = event.currentTarget.checked;
|
||||
Spells.update(this._id, {$set: {"components.verbal": value}});
|
||||
},
|
||||
"change #somaticCheckbox": function(event){
|
||||
var value = event.currentTarget.checked;
|
||||
Spells.update(this._id, {$set: {"components.somatic": value}});
|
||||
},
|
||||
"change #concentrationCheckbox": function(event){
|
||||
var value = event.currentTarget.checked;
|
||||
Spells.update(this._id, {$set: {"components.concentration": value}});
|
||||
},
|
||||
"change #ritualCheckbox": function(event){
|
||||
var value = event.currentTarget.checked;
|
||||
Spells.update(this._id, {$set: {"ritual": value}});
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user