Moved views out of private folder

This commit is contained in:
Stefan Zermatten
2017-01-12 15:28:59 +02:00
parent 37268495ae
commit 38ea89995a
162 changed files with 6 additions and 3 deletions

View File

@@ -0,0 +1,46 @@
<template name="proficiencyEdit">
<div layout horizontal around-justified>
<paper-dropdown-menu class="typeDropDown" label="Stat Group" flex>
<paper-dropdown layered class="dropdown">
<core-menu class="menu typeMenu" selected={{type}}>
{{#each proficiencyTypes}}
<paper-item class="statGroupSelect" name={{type}}>{{name}}</paper-item>
{{/each}}
</core-menu>
</paper-dropdown>
</paper-dropdown-menu>
{{> UI.dynamic template=nameInputTemplate}}
<paper-dropdown-menu class="valueDropDown" label="Proficiency" flex>
<paper-dropdown layered class="dropdown">
<core-menu class="menu valueMenu" selected={{value}}>
<paper-item name="1">Proficient</paper-item>
<paper-item name="0.5">Half Prof. Bonus</paper-item>
<paper-item name="2">Double Prof. Bonus</paper-item>
</core-menu>
</paper-dropdown>
</paper-dropdown-menu>
<paper-icon-button class="deleteProficiency"
icon="delete">
</paper-icon-button>
</div>
</template>
<template name="nameDropdown">
<paper-dropdown-menu class="nameDropDown sideMargin" label="Proficiency" flex>
<paper-dropdown layered class="dropdown">
<core-menu class="menu nameMenu" selected={{name}}>
{{#each nameDropdownItems}}
<paper-item name={{stat}}>{{name}}</paper-item>
{{/each}}
</core-menu>
</paper-dropdown>
</paper-dropdown-menu>
</template>
<template name="nameInput">
<paper-input class="nameInput sideMargin"
label="Name"
floatinglabel
value={{name}}
flex></paper-input>
</template>

View File

@@ -0,0 +1,90 @@
var profTypes = [
{type: "skill", name: "Skill"},
{type: "save", name: "Saving Throw"},
{type: "weapon", name: "Weapon"},
{type: "armor", name: "Armor"},
{type: "tool", name: "Tool"},
{type: "language", name: "Language"},
];
var saves = [
{name: "Strength Save", stat: "strengthSave"},
{name: "Dexterity Save", stat: "dexteritySave"},
{name: "Constitution Save", stat: "constitutionSave"},
{name: "Intelligence Save", stat: "intelligenceSave"},
{name: "Wisdom Save", stat: "wisdomSave"},
{name: "Charisma Save", stat: "charismaSave"},
];
var skills = [
{name: "Acrobatics", stat: "acrobatics"},
{name: "Animal Handling", stat: "animalHandling"},
{name: "Arcana", stat: "arcana"},
{name: "Athletics", stat: "athletics"},
{name: "Deception", stat: "deception"},
{name: "History", stat: "history"},
{name: "Insight", stat: "insight"},
{name: "Intimidation", stat: "intimidation"},
{name: "Investigation", stat: "investigation"},
{name: "Medicine", stat: "medicine"},
{name: "Nature", stat: "nature"},
{name: "Perception", stat: "perception"},
{name: "Performance", stat: "performance"},
{name: "Persuasion", stat: "persuasion"},
{name: "Religion", stat: "religion"},
{name: "Sleight of Hand", stat: "sleightOfHand"},
{name: "Stealth", stat: "stealth"},
{name: "Survival", stat: "survival"},
{name: "Initiative", stat: "initiative"},
];
Template.proficiencyEdit.helpers({
proficiencyTypes: function(){
return profTypes;
},
nameInputTemplate: function(){
if (!this.type) return null;
if (this.type === "skill" ||
this.type === "save") return "nameDropdown";
return "nameInput";
},
});
Template.proficiencyEdit.events({
"tap .deleteProficiency": function(event){
Proficiencies.softRemoveNode(this._id);
GlobalUI.deletedToast(this._id, "Proficiencies", "Proficiency");
},
"core-select .typeDropDown": function(event){
var detail = event.originalEvent.detail;
if (!detail.isSelected) return;
var type = detail.item.getAttribute("name");
if (type == this.type) return;
Proficiencies.update(this._id, {$set: {type: type}});
},
"core-select .valueDropDown": function(event){
var detail = event.originalEvent.detail;
if (!detail.isSelected) return;
var value = +detail.item.getAttribute("name");
if (value == this.value) return;
Proficiencies.update(this._id, {$set: {value: value}});
},
"core-select .nameDropDown": function(event){
var detail = event.originalEvent.detail;
if (!detail.isSelected) return;
var name = detail.item.getAttribute("name");
if (name == this.name) return;
Proficiencies.update(this._id, {$set: {name: name}});
},
"change .nameInput": function(event){
var name = event.currentTarget.value;
Proficiencies.update(this._id, {$set: {name: name}});
},
});
Template.nameDropdown.helpers({
nameDropdownItems: function(){
if (this.type === "skill") return skills;
if (this.type === "save") return saves;
}
});

View File

@@ -0,0 +1,18 @@
<!--needs to be given charId, parentId and parentCollection-->
<template name="proficiencyEditList">
{{#if proficiencies.count}}
<hr class="vertMargin">
<div id="proficiencies">
<h2>Proficiencies</h2>
{{#each proficiencies}}
{{>proficiencyEdit}}
{{/each}}
</div>
{{/if}}
<paper-button id="addProficiencyButton"
class="red-button"
raised>
Add Proficiency
</paper-button>
</template>

View File

@@ -0,0 +1,31 @@
Template.proficiencyEditList.helpers({
proficiencies: function(){
var selector = {
"parent.id": this.parentId,
"charId": this.charId,
};
if (this.parentGroup){
selector["parent.group"] = this.parentGroup;
}
return Proficiencies.find(selector);
}
});
Template.proficiencyEditList.events({
"tap #addProficiencyButton": function(){
if (!_.isBoolean(this.enabled)) {
this.enabled = true;
}
Proficiencies.insert({
charId: this.charId,
parent: {
id: this.parentId,
collection: this.parentCollection,
group: this.parentGroup,
},
enabled: this.enabled,
value: 1,
type: "skill",
});
},
});

View File

@@ -0,0 +1,11 @@
<template name="proficiencyListItem">
<div class="item-slot">
<div class="proficiency item small"
hero-id="main" {{detailHero}}
layout horizontal center>
<iron-icon icon="{{profIcon}}"
style="margin-right: 16px;"></iron-icon>
<div flex>{{getName}}</div>
</div>
</div>
</template>

View File

@@ -0,0 +1,20 @@
Template.proficiencyListItem.helpers({
profIcon: function(){
var prof = this.value;
if (prof > 0 && prof < 1) return "image:brightness-2";
if (prof === 1) return "image:brightness-1";
if (prof > 1) return "av:album";
return "radio-button-off";
},
getName: function(){
if (this.type === "skill") return skills[this.name];
if (this.type === "save") return saves[this.name];
return this.name;
},
});
Template.proficiencyListItem.events({
"tap .proficiency": function(event, instance){
openParentDialog(this.parent, this.charId, this._id);
}
});

View File

@@ -0,0 +1,10 @@
<template name="proficiencyView">
<div class="proficiencyView item small"
style="padding: 0;"
layout horizontal center>
<iron-icon icon="{{profIcon}}" style="margin-right: 16px;"></iron-icon>
<div>{{getName}}</div>
</div>
</template>

View File

@@ -0,0 +1,45 @@
var saves = {
strengthSave: "Strength Save",
dexteritySave: "Dexterity Save",
constitutionSave: "Constitution Save",
intelligenceSave: "Intelligence Save",
wisdomSave: "Wisdom Save",
charismaSave: "Charisma Save",
};
var skills = {
acrobatics: "Acrobatics",
animalHandling: "Animal Handling",
arcana: "Arcana",
athletics: "Athletics",
deception: "Deception",
history: "History",
insight: "Insight",
intimidation: "Intimidation",
investigation: "Investigation",
medicine: "Medicine",
nature: "Nature",
perception: "Perception",
performance: "Performance",
persuasion: "Persuasion",
religion: "Religion",
sleightOfHand: "Sleight of Hand",
stealth: "Stealth",
survival: "Survival",
initiative: "Initiative",
};
Template.proficiencyView.helpers({
profIcon: function(){
var prof = this.value;
if (prof > 0 && prof < 1) return "image:brightness-2";
if (prof === 1) return "image:brightness-1";
if (prof > 1) return "av:album";
return "radio-button-off";
},
getName: function(){
if (this.type === "skill") return skills[this.name];
if (this.type === "save") return saves[this.name];
return this.name;
},
});

View File

@@ -0,0 +1,11 @@
<template name="proficiencyViewList">
{{#if proficiencies.count}}
<hr class="vertMargin">
<div class="proficiencies">
<h2 style="margin-bottom: 8px;">Proficiencies</h2>
{{#each proficiencies}}
{{> proficiencyView}}
{{/each}}
</div>
{{/if}}
</template>

View File

@@ -0,0 +1,12 @@
Template.proficiencyViewList.helpers({
proficiencies: function(){
var selector = {
"parent.id": this.parentId,
"charId": this.charId,
};
if (this.parentGroup){
selector["parent.group"] = this.parentGroup;
}
return Proficiencies.find(selector);
}
});