Added sharing to anyone with link, changed home page

This commit is contained in:
Stefan Zermatten
2015-06-09 17:06:51 +02:00
parent 4f1376a666
commit 0d75cd5d15
11 changed files with 129 additions and 31 deletions

View File

@@ -176,6 +176,12 @@ Schemas.Character = new SimpleSchema({
"settings.useStandardEncumbrance": {type: Boolean, defaultValue: true},
//hide spellcasting
"settings.hideSpellcasting": {type: Boolean, defaultValue: false},
//show to anyone with link
"settings.viewPermission": {
type: String,
defaultValue: "whitelist",
allowedValues: ["whitelist", "public"],
},
});
Characters.attachSchema(Schemas.Character);

View File

@@ -6,6 +6,7 @@ Router.configure({
Router.plugin("ensureSignedIn", {
except: [
"home",
"characterSheet",
"atSignIn",
"atSignUp",
"atForgotPassword",

View File

@@ -1,5 +1,17 @@
<template name="shareDialog">
<div style="width: 360px;">
<div layout horizontal center>
<div>Who can view this character: </div>
<paper-dropdown-menu class="visibilityDropdown"
label="Visibility">
<paper-dropdown layered class="dropdown">
<core-menu class="menu visibilityMenu" selected={{viewPermission}}>
<paper-item name="whitelist">Only people I share with</paper-item>
<paper-item name="public">Anyone with link</paper-item>
</core-menu>
</paper-dropdown>
</paper-dropdown-menu>
</div>
<div>
{{#if readers.count}}
<div style="font-weight: 500;">
@@ -7,7 +19,7 @@
</div>
{{#each readers}}
<div layout horizontal center>
<div flex>{{username}}</div>
<div flex>{{getUserName}}</div>
<paper-icon-button class="deleteShare" icon="delete"></paper-icon-button>
</div>
{{/each}}

View File

@@ -3,6 +3,10 @@ Template.shareDialog.onCreated(function(){
});
Template.shareDialog.helpers({
viewPermission: function() {
var char = Characters.findOne(this._id, {fields: {settings: 1}});
return char.settings.viewPermission || "whitelist";
},
readers: function(){
var char = Characters.findOne(this._id, {fields: {readers: 1}});
return Meteor.users.find({_id: {$in: char.readers}});
@@ -19,9 +23,20 @@ Template.shareDialog.helpers({
return "User not found";
}
},
getUserName: function() {
return this.username || "user: " + this._id;
}
});
Template.shareDialog.events({
"core-select .visibilityDropdown": function(event){
var detail = event.originalEvent.detail;
if (!detail.isSelected) return;
var value = detail.item.getAttribute("name");
var char = Characters.findOne(this._id, {fields: {settings: 1}});
if (value == char.settings.viewPermission) return;
Characters.update(this._id, {$set: {"settings.viewPermission": value}});
},
"input #userNameOrEmailInput":
function(event, instance){
var userName = instance.find("#userNameOrEmailInput").value;

View File

@@ -1,11 +1,6 @@
<template name="guide">
<div layout vertical center>
<paper-shadow class="wallOfText card" style="padding: 32px; max-width: 800px;">
<h1>Dicecloud Beta</h1>
<p>Welcome to the Dicecloud beta.</p>
<p>The beta is going to start with just the character sheet. You can play D&amp;D without minis and maps, without a pre-written adventure, you can play without a lot of things, but the character sheet is necessary. So I'm starting here and working my way outwards.</p>
<p>Leave any comments, feedback and suggestions on <a href="http://reddit.com/r/dicecloud">this subreddit</a>. If you've never used reddit before, all you need is a username and password to sign up. So it should be pretty accessible.</p>
<p>If you'd like to see a list of known issues and upcoming features, check out the <a href="https://trello.com/b/94M0SCnq/dicecloud-roadmap">DiceCloud Roadmap</a>.</p>
<h2>Character Sheet Philosophy</h2>
<p>Setting up your character on Dicecloud is going to take you a little longer than just filling it in on a paper character sheet would have. The goal of using an online sheet is to make actually playing the game more streamlined, and ultimately more fun. So putting a little extra effort into setting up your character now will pay off over and over again once you're playing.</p>
<p>The idea is to track where each number comes from, and allow you to easily make changes on the fly.</p>

View File

@@ -1,11 +1,28 @@
<template name="home">
<core-toolbar class="blue-grey white-text">
<template name="home">
<core-toolbar class="medium-tall {{colorClass}}">
<core-icon-button icon="menu" core-drawer-toggle></core-icon-button>
<div flex>
DiceCloud
</div>
<div class="bottom fit" horizontal layout>
<paper-tabs flex horizontal center layout selected={{selectedTab}} class="grey white-text homeTabs">
<paper-tab name="stats">Home</paper-tab>
<paper-tab name="features">Guide</paper-tab>
</paper-tabs>
</div>
</core-toolbar>
<div class="scroll-y" style="padding: 16px" fit>
{{> guide}}
<div fit>
<core-animated-pages class="tabPages" selected={{selectedTab}} transitions="slide-from-right" fit>
<section flex name="stats">
<div class="scroll-y" fit>
{{> intro}}
</div>
</section>
<section flex name="features">
<div class="scroll-y" fit>
{{> guide}}
</div>
</section>
</core-animated-pages>
</div>
</template>

View File

@@ -1,25 +1,15 @@
Template.home.helpers({
characterDetails: function(){
var char = Characters.findOne(
this._id,
{fields: {name: 1, gender: 1, alignment: 1, race:1}}
);
char.title = char.name;
char.field = "base";
char.color = "d";
char.class = "characterCard";
return char;
}
selectedTab: function(){
return Session.get("homePage.selectedTab");
},
});
Template.home.events({
"tap .characterCard": function(event, instance){
Router.go("characterSheet", {_id: this._id});
"core-animated-pages-transition-end .tabPages": function(event) {
event.stopPropagation();
},
"tap #addCharacter": function(event, template) {
Characters.insert({owner: Meteor.userId()});
},
"tap #deleteChar": function(event, template){
Characters.remove(this._id);
"tap .homeTabs paper-tab": function(event, instance){
Session.set("homePage.selectedTab",
event.currentTarget.getAttribute("name"));
},
});

View File

@@ -0,0 +1,49 @@
<template name="intro">
<div class="intro">
<div class="fullwidth">
<h1>
Online, realtime, unofficial D&amp;D 5e app.
</h1>
<p>
Spend less time shuffling paper and more time playing the game
</p>
</div>
<div class="fullwidth">
<h1>Open Beta</h1>
<p>Free to use, updates almost every week</p>
</div>
<div class="fullwidth">
<h1>Check out the guide</h1>
<p>Learn how your class gives you features, those features have effects, and those effects determine your stats.</p>
</div>
<div class="fullwidth">
<h1>
Discuss
</h1>
<p>
On the official
<a href="http://reddit.com/r/dicecloud">
DiceCloud subreddit
</a>
</p>
</div>
<div class="fullwidth">
<h1>
Get involved
</h1>
<p>Shape upcoming features and track bugs on the
<a href="https://trello.com/b/94M0SCnq/dicecloud-roadmap">
DiceCloud Trello board
</a>
</p>
</div>
<div class="fullwidth">
<h1>
Send feedback instantly
</h1>
<p>
Use the feedback button in the sidebar to drop the developer a direct message
</p>
</div>
</div>
</template>

View File

@@ -0,0 +1,12 @@
.intro {
.fullwidth {
width: 100%;
padding: 16px;
display: flex;
align-items: center;
flex-direction: column;
p, h1 {
max-width: 450px;
}
}
}

View File

@@ -14,10 +14,11 @@ Template.baseDialog.helpers({
showEdit: function() {
if (this.hideEdit) return false;
var charId = Template.parentData().charId;
var userId = Meteor.userId();
if (!userId) return false;
if (charId){
var char = Characters.findOne(charId);
var userId = Meteor.userId();
if (char && userId)
if (char)
return char.owner === userId ||
_.contains(char.writers, userId);
}

View File

@@ -1,12 +1,12 @@
Meteor.publish("singleCharacter", function(characterId){
userId = this.userId;
if (!userId) return [];
var char = Characters.findOne({
_id: characterId,
$or: [
{readers: userId},
{writers: userId},
{owner: userId},
{"settings.viewPermission": "public"},
],
});
if (char){