Added a side list for characters

This commit is contained in:
Stefan Zermatten
2015-04-29 10:16:12 +02:00
parent bd6c7cd106
commit b95636a8a3
6 changed files with 56 additions and 3 deletions

View File

@@ -0,0 +1,11 @@
.singleLineItem {
color: black;
color: rgba(0, 0, 0, 0.870588);
cursor: pointer;
font-size: 16px;
height: 40px;
overflow: hidden;
padding: 12px 0 12px 0;
text-overflow: ellipsis;
white-space: nowrap;
}

View File

@@ -0,0 +1,10 @@
<template name="characterSideList">
{{#if characters.count}}
<div class="list-subhead">Characters</div>
<div>
{{#each characters}}
<div class="singleLineItem">{{name}}</div>
{{/each}}
</div>
{{/if}}
</template>

View File

@@ -0,0 +1,25 @@
Template.characterSideList.onCreated(function() {
this.subscribe("characterList");
});
Template.characterSideList.helpers({
characters: function() {
var userId = Meteor.userId();
return Characters.find(
{
$or: [
{readers: userId},
{writers: userId},
{owner: userId},
]
},
{fields: {name: 1}}
);
}
});
Template.characterSideList.events({
"tap .singleLineItem": function(event, instance) {
Router.go("characterSheet", {_id: this._id});
}
});

View File

@@ -1,5 +1,5 @@
#accountSummary {
padding-top: 32px;
padding: 16px;
min-height: 146px;
background-image: url(/png/paper-dice-crown.png);
background-repeat: no-repeat;
@@ -11,3 +11,7 @@
#mainContentSection {
display: initial !important;
}
#navPanel {
padding: 16px;
}

View File

@@ -10,7 +10,9 @@
</div>
{{/if}}
</div>
<paper-item id="charactersMenuButton">Characters</paper-item>
<div id="navPanel">
{{> characterSideList}}
</div>
</core-header-panel>
<core-animated-pages main
navigation

View File

@@ -1,4 +1,5 @@
Meteor.publish("characterList", function(userId){
Meteor.publish("characterList", function(){
var userId = this.userId;
if (!userId) {
this.ready();
return;