Moved views out of private folder
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<template name="classDialog">
|
||||
{{#with class}}
|
||||
{{#baseDialog title=name class=colorClass startEditing=../startEditing}}
|
||||
<div layout vertical center>
|
||||
<div class="display2">
|
||||
{{level}}
|
||||
</div>
|
||||
<div>
|
||||
level
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{> effectsViewList charId=charId parentId=_id}}
|
||||
{{> proficiencyViewList charId=charId parentId=_id}}
|
||||
{{else}}
|
||||
<!--Name-->
|
||||
<paper-input id="classNameInput" label="Class Name" floatinglabel value={{name}}></paper-input>
|
||||
<!--Level-->
|
||||
<paper-input id="levelValueInput" label="Level" floatinglabel value={{level}}></paper-input>
|
||||
<!--Effects-->
|
||||
{{> effectsEditList parentId=_id parentCollection="Classes" charId=charId}}
|
||||
{{> proficiencyEditList parentId=_id parentCollection="Classes" charId=charId}}
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
@@ -0,0 +1,28 @@
|
||||
Template.classDialog.onRendered(function(){
|
||||
updatePolymerInputs(this);
|
||||
});
|
||||
|
||||
Template.classDialog.events({
|
||||
"color-change": function(event, instance){
|
||||
Classes.update(instance.data.classId, {$set: {color: event.color}});
|
||||
},
|
||||
"tap #deleteButton": function(event, instance){
|
||||
Classes.softRemoveNode(instance.data.classId);
|
||||
GlobalUI.deletedToast(instance.data.classId, "Classes", "Class");
|
||||
GlobalUI.closeDetail();
|
||||
},
|
||||
"change #classNameInput": function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Classes.update(this._id, {$set: {name: value}});
|
||||
},
|
||||
"change #levelValueInput": function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Classes.update(this._id, {$set: {level: value}});
|
||||
},
|
||||
});
|
||||
|
||||
Template.classDialog.helpers({
|
||||
class: function(){
|
||||
return Classes.findOne(this.classId);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
.noteDialog .colorDropdown {
|
||||
top: 0;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<template name="experienceDialog">
|
||||
{{#with experience}}
|
||||
{{#baseDialog title=name class=color hideColor="true" startEditing=../startEditing}}
|
||||
<div horizontal layout center-justified class= "display2">
|
||||
{{value}}
|
||||
</div>
|
||||
{{#if description}}
|
||||
<hr class="vertMargin">
|
||||
<div>{{#markdown}}{{description}}{{/markdown}}</div>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{> experienceEdit}}
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="experienceEdit">
|
||||
<div horizontal layout>
|
||||
<!--Name-->
|
||||
<paper-input id="experienceNameInput" label="Name" floatinglabel value={{name}} flex></paper-input>
|
||||
<!--Value-->
|
||||
<paper-input-decorator label="Value" floatinglabel>
|
||||
<input id="valueInput" type="number" value={{value}}>
|
||||
</paper-input-decorator>
|
||||
</div>
|
||||
<!--Description-->
|
||||
<paper-input-decorator label="Description" floatinglabel layout vertical>
|
||||
<paper-autogrow-textarea>
|
||||
<textarea id="experienceDescriptionInput" placeholder value={{description}}></textarea>
|
||||
</paper-autogrow-textarea>
|
||||
</paper-input-decorator>
|
||||
</template>
|
||||
@@ -0,0 +1,40 @@
|
||||
Template.experienceEdit.onRendered(function(){
|
||||
updatePolymerInputs(this);
|
||||
});
|
||||
|
||||
Template.experienceDialog.helpers({
|
||||
experience: function(){
|
||||
Experiences.findOne(this.experienceId);
|
||||
return Experiences.findOne(this.experienceId);
|
||||
},
|
||||
color: function() {
|
||||
var char = Characters.findOne(this.charId, {fields: {color: 1}});
|
||||
if (char) return getColorClass(char.color);
|
||||
},
|
||||
});
|
||||
|
||||
Template.experienceDialog.events({
|
||||
"tap #deleteButton": function(event, instance){
|
||||
Experiences.softRemove(instance.data.experienceId);
|
||||
GlobalUI.deletedToast(
|
||||
instance.data.experienceId,
|
||||
"Experiences", "Experience"
|
||||
);
|
||||
GlobalUI.closeDetail();
|
||||
},
|
||||
});
|
||||
|
||||
Template.experienceEdit.events({
|
||||
"change #experienceNameInput": function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Experiences.update(this._id, {$set: {name: value}});
|
||||
},
|
||||
"change #valueInput": function(event){
|
||||
var value = +event.currentTarget.value;
|
||||
Experiences.update(this._id, {$set: {value: value}});
|
||||
},
|
||||
"change #experienceDescriptionInput": function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Experiences.update(this._id, {$set: {description: value}});
|
||||
},
|
||||
});
|
||||
7
rpg-docs/client/views/character/journal/journal.css
Normal file
7
rpg-docs/client/views/character/journal/journal.css
Normal file
@@ -0,0 +1,7 @@
|
||||
.experiences {
|
||||
padding: 0 0 16px 0;
|
||||
}
|
||||
|
||||
.experience {
|
||||
height: 48px;
|
||||
}
|
||||
108
rpg-docs/client/views/character/journal/journal.html
Normal file
108
rpg-docs/client/views/character/journal/journal.html
Normal file
@@ -0,0 +1,108 @@
|
||||
<template name="journal">
|
||||
<div fit>
|
||||
<div id="journal" class="scroll-y" fit>
|
||||
<div class="column-container">
|
||||
<!--Experience Table-->
|
||||
<div><paper-material class="card experiencesCard"
|
||||
hero-id="main" {{detailHero}}>
|
||||
<div class="top white subhead"
|
||||
hero-id="toolbar" {{detailHero}}
|
||||
layout horizontal center>
|
||||
<div flex>Experience</div>
|
||||
<div >{{characterCalculate "experience" _id}} XP</div>
|
||||
<paper-icon-button class="black54" id="addXP" icon="add"
|
||||
disabled={{#unless canEditCharacter _id}}true{{/unless}}></paper-icon-button>
|
||||
</div>
|
||||
<div class="bottom list">
|
||||
{{#each experiences}}
|
||||
<div class="item-slot">
|
||||
<div class="item experience"
|
||||
hero-id="main" {{detailHero}}
|
||||
layout horizontal center>
|
||||
<div flex>{{name}}</div>
|
||||
<div class="xpValue">{{value}}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{#if moreExperiencesOrCollapse}}
|
||||
<div layout horizontal center end-justified>
|
||||
<paper-button id="moreExperiences"
|
||||
disabled={{notMoreExperiences}}>
|
||||
Load More
|
||||
</paper-button>
|
||||
<paper-button id="lessExperiences"
|
||||
disabled={{cantCollapse}}>
|
||||
Collapse
|
||||
</paper-button>
|
||||
</div>
|
||||
{{/if}}
|
||||
</paper-material></div>
|
||||
<!--Class Table-->
|
||||
<div><paper-material class="card"
|
||||
hero-id="main" {{detailHero}}>
|
||||
<div class="white top"
|
||||
hero-id="toolbar" {{detailHero}}
|
||||
layout horizontal center>
|
||||
<div flex>
|
||||
<div class="containerName subhead">
|
||||
Level {{characterCalculate "level" _id}}
|
||||
</div>
|
||||
{{#if nextLevelXP}}
|
||||
<div class="caption">
|
||||
Next Level: {{nextLevelXP}}XP
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<paper-icon-button class="black54"
|
||||
id="addClassButton"
|
||||
icon="add"
|
||||
disabled={{#unless canEditCharacter _id}}true{{/unless}}>
|
||||
</paper-icon-button>
|
||||
</div>
|
||||
<div class="bottom list">
|
||||
<div class="item-slot">
|
||||
<div class="item race"
|
||||
hero-id="main" {{detailHero "race" _id}}
|
||||
layout horizontal center>
|
||||
{{race}}
|
||||
</div>
|
||||
</div>
|
||||
{{#each classes}}
|
||||
<div class="item-slot">
|
||||
<div class="item class"
|
||||
hero-id="main" {{detailHero}}
|
||||
layout horizontal center>
|
||||
{{name}} {{level}}
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</paper-material></div>
|
||||
<!--Notes-->
|
||||
{{#each notes}}
|
||||
<div>
|
||||
<paper-material class="card" hero-id="main" {{detailHero}}>
|
||||
<div class="top {{colorClass}} noteTop subhead"
|
||||
hero-id="toolbar" {{detailHero}}
|
||||
layout horizontal center>
|
||||
{{name}}
|
||||
</div>
|
||||
<div class="bottom">{{#markdown}}{{description}}{{/markdown}}</div>
|
||||
</paper-material>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="fab-buffer"></div>
|
||||
</div>
|
||||
</div>
|
||||
{{#if canEditCharacter _id}}
|
||||
<paper-fab id="addNote"
|
||||
class="floatyButton"
|
||||
icon="add"
|
||||
title="Add"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
hero-id="main"></paper-fab>
|
||||
{{/if}}
|
||||
</template>
|
||||
153
rpg-docs/client/views/character/journal/journal.js
Normal file
153
rpg-docs/client/views/character/journal/journal.js
Normal file
@@ -0,0 +1,153 @@
|
||||
Template.journal.created = function(){
|
||||
var self = this;
|
||||
self.experiencesLimit = new ReactiveVar(
|
||||
self.data.settings && self.data.settings.experiencesInc || 10
|
||||
);
|
||||
};
|
||||
|
||||
Template.journal.helpers({
|
||||
notes: function(){
|
||||
return Notes.find({charId: this._id}, {sort: {color: 1, name: 1}});
|
||||
},
|
||||
experiences: function(){
|
||||
return Experiences.find(
|
||||
{charId: this._id},
|
||||
{
|
||||
sort: {dateAdded: -1},
|
||||
limit: Template.instance().experiencesLimit.get(),
|
||||
}
|
||||
);
|
||||
},
|
||||
notMoreExperiences: function(){
|
||||
return Experiences.find(
|
||||
{charId: this._id}
|
||||
).count() < Template.instance().experiencesLimit.get();
|
||||
},
|
||||
cantCollapse: function(){
|
||||
return Template.instance().experiencesLimit.get() <=
|
||||
(this.settings && this.settings.experiencesInc || 10);
|
||||
},
|
||||
moreExperiencesOrCollapse: function(){
|
||||
var allShown = Experiences.find({charId: this._id}).count() <
|
||||
Template.instance().experiencesLimit.get();
|
||||
var canCollapse = Template.instance().experiencesLimit.get() >
|
||||
(this.settings && this.settings.experiencesInc || 10);
|
||||
return !allShown || canCollapse;
|
||||
},
|
||||
classes: function(){
|
||||
return Classes.find({charId: this._id}, {sort: {createdAt: 1}});
|
||||
},
|
||||
levels: function(charId){
|
||||
return Levels.find({charId: charId, classId: this._id}, {sort: {value: 1}});
|
||||
},
|
||||
nextLevelXP: function(){
|
||||
var currentLevel = Characters.calculate.level(this._id);
|
||||
if (currentLevel < 20){
|
||||
return XP_TABLE[currentLevel];
|
||||
}
|
||||
},
|
||||
race: function(){
|
||||
var char = Characters.findOne(this._id, {fields: {race: 1}});
|
||||
return char && char.race;
|
||||
},
|
||||
});
|
||||
|
||||
Template.journal.events({
|
||||
"tap .noteTop": function(event){
|
||||
GlobalUI.setDetail({
|
||||
template: "noteDialog",
|
||||
data: {noteId: this._id, charId: this.charId},
|
||||
heroId: this._id,
|
||||
});
|
||||
},
|
||||
"tap .experience": function(event){
|
||||
GlobalUI.setDetail({
|
||||
template: "experienceDialog",
|
||||
data: {experienceId: this._id, charId: this.charId},
|
||||
heroId: this._id,
|
||||
});
|
||||
},
|
||||
"tap .class": function(event){
|
||||
GlobalUI.setDetail({
|
||||
template: "classDialog",
|
||||
data: {classId: this._id, charId: this.charId},
|
||||
heroId: this._id,
|
||||
});
|
||||
},
|
||||
"tap .race": function(event){
|
||||
GlobalUI.setDetail({
|
||||
template: "raceDialog",
|
||||
data: {charId: this._id},
|
||||
heroId: this._id + "race",
|
||||
});
|
||||
},
|
||||
"tap #addNote": function(event){
|
||||
var charId = this._id;
|
||||
Notes.insert({
|
||||
name: "New Note",
|
||||
charId: charId,
|
||||
}, function(error, id){
|
||||
if (!error){
|
||||
GlobalUI.setDetail({
|
||||
template: "noteDialog",
|
||||
data: {noteId: id, charId: charId, startEditing: true},
|
||||
heroId: id,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
"tap #addXP": function(event){
|
||||
var charId = this._id;
|
||||
Experiences.insert({
|
||||
charId: charId
|
||||
}, function(error, id){
|
||||
if (!error){
|
||||
GlobalUI.setDetail({
|
||||
template: "experienceDialog",
|
||||
data: {experienceId: id, charId: charId, startEditing: true},
|
||||
heroId: id,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
"tap #addClassButton":function(event){
|
||||
var charId = this._id;
|
||||
Classes.insert({
|
||||
charId: charId,
|
||||
name: "new Class",
|
||||
level: 1,
|
||||
}, function(error, id){
|
||||
if (!error){
|
||||
GlobalUI.setDetail({
|
||||
template: "classDialog",
|
||||
data: {classId: id, charId: charId, startEditing: true},
|
||||
heroId: id,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
"tap #moreExperiences": function(event){
|
||||
var inst = Template.instance();
|
||||
inst.experiencesLimit.set(
|
||||
inst.experiencesLimit.get() +
|
||||
(this.settings && this.settings.experiencesInc || 10)
|
||||
);
|
||||
},
|
||||
"tap #lessExperiences": function(event){
|
||||
var inst = Template.instance();
|
||||
inst.experiencesLimit.set(
|
||||
this.settings && this.settings.experiencesInc || 10
|
||||
);
|
||||
//scroll to the top of the div
|
||||
inst.$(".scroll-y").animate({
|
||||
scrollTop: (
|
||||
inst.$(".scroll-y").scrollTop() +
|
||||
inst.$(".experiencesCard").position().top -
|
||||
8
|
||||
)
|
||||
}, 300);
|
||||
//HACK giggle the columns :( to workaround chrome bug that stops .containers height from updating
|
||||
var cs = inst.$(".containers").removeClass("containers");
|
||||
_.defer(function(){cs.addClass("containers");});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
.noteDialog .colorDropdown {
|
||||
top: 0;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<template name="noteDialog">
|
||||
{{#with note}}
|
||||
{{#baseDialog title=name class=colorClass startEditing=../startEditing}}
|
||||
<div>{{#markdown}}{{description}}{{/markdown}}</div>
|
||||
{{else}}
|
||||
{{> noteDialogEdit}}
|
||||
{{/baseDialog}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="noteDialogEdit">
|
||||
<!--Name-->
|
||||
<div horizontal layout>
|
||||
<paper-input id="noteNameInput"
|
||||
label="Name"
|
||||
floatinglabel
|
||||
value={{name}}
|
||||
flex>
|
||||
</paper-input>
|
||||
</div>
|
||||
<!--Description, formatting this nicely breaks it, leave it as is-->
|
||||
<paper-input-decorator label="Description"
|
||||
floatinglabel
|
||||
layout vertical>
|
||||
<paper-autogrow-textarea>
|
||||
<textarea id="noteDescriptionInput"
|
||||
value={{description}}></textarea>
|
||||
</paper-autogrow-textarea>
|
||||
</paper-input-decorator>
|
||||
</template>
|
||||
@@ -0,0 +1,31 @@
|
||||
Template.noteDialog.helpers({
|
||||
note: function(){
|
||||
return Notes.findOne(this.noteId);
|
||||
}
|
||||
});
|
||||
|
||||
Template.noteDialog.events({
|
||||
"color-change": function(event, instance){
|
||||
Notes.update(instance.data.noteId, {$set: {color: event.color}});
|
||||
},
|
||||
"tap #deleteButton": function(event, instance){
|
||||
Notes.softRemove(instance.data.noteId);
|
||||
GlobalUI.deletedToast(instance.data.noteId, "Notes", "Note");
|
||||
GlobalUI.closeDetail();
|
||||
},
|
||||
});
|
||||
|
||||
Template.noteDialogEdit.onRendered(function(){
|
||||
updatePolymerInputs(this);
|
||||
});
|
||||
|
||||
Template.noteDialogEdit.events({
|
||||
"change #noteNameInput, input #noteNameInput": function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Notes.update(this._id, {$set: {name: value}});
|
||||
},
|
||||
"change #noteDescriptionInput": function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Notes.update(this._id, {$set: {description: value}});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
<template name="raceDialog">
|
||||
{{#baseDialog title="Race" class=color hideColor="true" hideDelete="true" startEditing=startEditing}}
|
||||
<div horizontal layout center-justified class= "display2">
|
||||
{{race}}
|
||||
</div>
|
||||
{{> effectsViewList charId=charId parentId=charId parentGroup="racial"}}
|
||||
{{> proficiencyViewList charId=charId parentId=charId parentGroup="racial"}}
|
||||
{{else}}
|
||||
<paper-input id="raceInput" label="Race" floatinglabel value={{race}}></paper-input>
|
||||
{{> effectsEditList parentId=charId parentCollection="Characters" charId=charId parentGroup="racial"}}
|
||||
{{> proficiencyEditList parentId=charId parentCollection="Characters" charId=charId parentGroup="racial"}}
|
||||
{{/baseDialog}}
|
||||
</template>
|
||||
@@ -0,0 +1,21 @@
|
||||
Template.raceDialog.onRendered(function(){
|
||||
updatePolymerInputs(this);
|
||||
});
|
||||
|
||||
Template.raceDialog.events({
|
||||
"change #raceInput": function(event){
|
||||
var value = event.currentTarget.value;
|
||||
Characters.update(this.charId, {$set: {race: value}});
|
||||
}
|
||||
});
|
||||
|
||||
Template.raceDialog.helpers({
|
||||
race: function(){
|
||||
var char = Characters.findOne(this.charId, {fields: {race: 1}});
|
||||
return char && char.race;
|
||||
},
|
||||
color: function() {
|
||||
var char = Characters.findOne(this.charId, {fields: {color: 1}});
|
||||
if (char) return getColorClass(char.color);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user