From 01535a414cecb02b3a056c9e162738dbcb816c30 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Mon, 16 Jan 2017 13:48:18 +0200 Subject: [PATCH] Updated character lists to Polymer 1 --- rpg-docs/Routes/Routes.js | 7 +- .../views/characterList/characterList.css | 36 ++++++-- .../views/characterList/characterList.html | 90 ++++++++++++------- .../views/characterList/characterList.js | 32 ++++--- .../views/characterList/characterSideList.css | 24 ++--- .../characterList/characterSideList.html | 14 +-- .../views/characterList/characterSideList.js | 2 +- rpg-docs/client/views/layout/layout.html | 47 ++++++---- rpg-docs/client/views/layout/layout.js | 19 +--- .../client/views/layout/polymerImports.html | 7 +- .../public/custom_components/app-theme.html | 10 ++- rpg-docs/server/publications/characterList.js | 1 + 12 files changed, 165 insertions(+), 124 deletions(-) diff --git a/rpg-docs/Routes/Routes.js b/rpg-docs/Routes/Routes.js index 14f64014..6d2b61ac 100644 --- a/rpg-docs/Routes/Routes.js +++ b/rpg-docs/Routes/Routes.js @@ -34,13 +34,8 @@ Router.map(function() { waitOn: function(){ return subsManager.subscribe("characterList", Meteor.userId()); }, - data: { - characters: function(){ - return Characters.find({}, {fields: {_id: 1}, sort: {name: 1}}); - } - }, onAfterAction: function() { - document.title = appName; + document.title = appName + " - Characters"; }, fastRender: true, }); diff --git a/rpg-docs/client/views/characterList/characterList.css b/rpg-docs/client/views/characterList/characterList.css index e457e32e..63e43913 100644 --- a/rpg-docs/client/views/characterList/characterList.css +++ b/rpg-docs/client/views/characterList/characterList.css @@ -1,10 +1,32 @@ -.characterCards { - padding: 4px; +.character-card{ + background-color: #fff; + height: 300px; + min-width: 250px; + max-width: 500px; + flex-basis: 300px; + margin: 4px; + position: relative; } -.characterCard{ - width: 272px; - margin: 4px; - min-width: 272px; - flex-grow: 1; +.character-card .image { + position: relative; +} + +.character-card .initials { + font-size: 100px; + color: rgba(255,255,255,0.1); + background: linear-gradient(-8deg, rgba(0,0,0,0.7), rgba(0,0,0,0)); +} + +.character-card paper-item { + margin-top: 8px; + margin-bottom: 8px; +} + +.character-card .name { + font-weight: 500; +} + +.character-card paper-ripple { + color: #fff ; } diff --git a/rpg-docs/client/views/characterList/characterList.html b/rpg-docs/client/views/characterList/characterList.html index 1ceaa1d7..fd53d2d6 100644 --- a/rpg-docs/client/views/characterList/characterList.html +++ b/rpg-docs/client/views/characterList/characterList.html @@ -1,39 +1,61 @@ \ No newline at end of file +
+ + + + diff --git a/rpg-docs/client/views/characterList/characterList.js b/rpg-docs/client/views/characterList/characterList.js index a25628f2..825a6fb7 100644 --- a/rpg-docs/client/views/characterList/characterList.js +++ b/rpg-docs/client/views/characterList/characterList.js @@ -1,20 +1,26 @@ Template.characterList.helpers({ - characterDetails: function(){ - var char = Characters.findOne( - this._id, - {fields: {name: 1, gender: 1, alignment: 1, race:1, color: 1}} + characters(){ + var userId = Meteor.userId(); + return Characters.find( + { + $or: [ + {readers: userId}, + {writers: userId}, + {owner: userId}, + ] + }, + { + fields: {name: 1, picture: 1, color: 1, race: 1, alignment: 1, gender: 1}, + sort: {name: 1}, + } ); - char.title = char.name; - char.field = "base"; - char.class = "characterCard"; - return char; - } -}); + }, + initials(name){ + return name.replace(/[^A-Z]/g, ""); + }, +}) Template.characterList.events({ - "tap .characterCard": function(event, instance){ - Router.go("characterSheet", {_id: this._id}); - }, "tap .addCharacter": function(event, template) { GlobalUI.showDialog({ heading: "New Character", diff --git a/rpg-docs/client/views/characterList/characterSideList.css b/rpg-docs/client/views/characterList/characterSideList.css index 29272c1a..e48e0b94 100644 --- a/rpg-docs/client/views/characterList/characterSideList.css +++ b/rpg-docs/client/views/characterList/characterSideList.css @@ -1,23 +1,9 @@ -.singleLineItem { - color: black; - color: rgba(0, 0, 0, 0.870588); - cursor: pointer; - overflow: hidden; - padding: 8px 0 8px 16px; - text-overflow: ellipsis; - white-space: nowrap; - text-decoration: none; -} +/* + prevent character names from wrapping + */ -.singleLineItem iron-icon { - height: 8px; - margin-right: 8px; - width: 8px; -} - -.singleLineItem div { - text-overflow: ellipsis; - /* Required for text-overflow to do anything */ +.character-name { white-space: nowrap; overflow: hidden; + text-overflow: ellipsis; } diff --git a/rpg-docs/client/views/characterList/characterSideList.html b/rpg-docs/client/views/characterList/characterSideList.html index f07e4771..5ba80b22 100644 --- a/rpg-docs/client/views/characterList/characterSideList.html +++ b/rpg-docs/client/views/characterList/characterSideList.html @@ -1,13 +1,13 @@