rename /rpg-docs to /app

This commit is contained in:
Andrew Zhu
2018-06-07 01:07:49 -07:00
parent de93636c7c
commit c099e3173b
420 changed files with 12 additions and 25 deletions

View File

@@ -0,0 +1,3 @@
.profile paper-button, .profile a, .profile #at-nav-button {
color: #d13b2e;
}

View File

@@ -0,0 +1,74 @@
<template name="profile">
{{#with currentUser}}
<app-header-layout has-scrolling-region fullbleed class="profile">
<app-header class="app-grey white-text" fixed effects="waterfall">
<app-toolbar class="app-grey white-text">
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
<div flex>Account</div>
</app-toolbar>
</app-header>
<div class="layout vertical center">
<paper-material style="margin-top: 8px; padding: 16px; background: #fff;">
<table>
<tr>
<td>Username</td>
<td>{{profileName}}</td>
<td>
<paper-icon-button icon="create" class="username-edit" style="background: #fff;">
</paper-icon-button>
</td>
</tr>
<tr>
<td>Email</td>
<td class="layout vertical">
{{#each emails}}
<div>
{{address}}
{{#if verified}}
<span>
<iron-icon icon="check"></iron-icon>
{{#simpleTooltip}}Verified{{/simpleTooltip}}
</span>
{{/if}}
</div>
{{/each}}
</td>
<td></td>
</tr>
<tr>
<td colspan="2">
<a href="/change-password">
<paper-button>Change password</paper-button>
</a>
</td>
</tr>
<tr>
<td>
API Key
</td>
<td class="apiKey">
{{#if apiKey}}
{{#unless showApiKey}}
<paper-button class="showApiKey">
Show
</paper-button>
{{else}}
{{apiKey}}
{{/unless}}
{{else}}
<paper-button class="generateMyApiKey">
Generate
</paper-button>
{{/if}}
</td>
</tr>
</table>
<div style="max-width: 250px">
{{> atForm state="signIn"}}
</div>
{{> atNavButton }}
</paper-material>
</div>
</app-header-layout>
{{/with}}
</template>

View File

@@ -0,0 +1,42 @@
Template.profile.onCreated(function(){
this.showApiKey = new ReactiveVar(false);
});
Template.profile.helpers({
profileName: function() {
var user = Meteor.user();
return user.profile && user.profile.username ||
user.username ||
"Tap to set username";
},
showApiKey: function(){
return Template.instance().showApiKey.get();
},
});
Template.profile.events({
"click .username-edit": function(event, instance){
if (this._id === Meteor.userId()){
pushDialogStack({
template: "usernameDialog",
element: event.currentTarget,
});
}
},
"click #at-resend-verification-email": function(event, instance){
if (!Meteor.user()) return;
Accounts.sendVerificationEmail(Meteor.userId(), this.address);
GlobalUI.toast({
text: "Email verification sent to " + this.address,
template: "",
data: {},
});
},
"click .showApiKey": function(event, instance){
instance.showApiKey.set(!instance.showApiKey.get());
},
"click .generateMyApiKey": function(event, instance){
Meteor.call("generateMyApiKey");
instance.showApiKey.set(true);
},
});

View File

@@ -0,0 +1,24 @@
<template name="usernameDialog">
<div class="fit layout vertical">
<app-header-layout has-scrolling-region class="feedback flex">
<app-header fixed effects="waterfall">
<app-toolbar>
<div main-title>Change Username</div>
</app-toolbar>
</app-header>
<div class="form flex">
<div>
<paper-input id="usernameInput" label="Username" value={{profileName}} invalid={{errorMessage}} error-message={{errorMessage}}></paper-input>
</div>
</div>
</app-header-layout>
<div class="buttons layout horizontal end-justified">
<paper-button id="cancelButton">
Cancel
</paper-button>
<paper-button id="changeButton" disabled={{invalid}}>
Change Username
</paper-button>
</div>
</div>
</template>

View File

@@ -0,0 +1,53 @@
var getUsername = function() {
var user = Meteor.user();
return user.profile && user.profile.username || user.username;
};
Template.usernameDialog.onCreated(function() {
this.errorMessage = new ReactiveVar();
this.username = new ReactiveVar(getUsername());
});
Template.usernameDialog.helpers({
profileName: function() {
return getUsername();
},
invalid: function() {
return !!Template.instance().errorMessage.get();
},
errorMessage: function() {
return Template.instance().errorMessage.get();
},
});
Template.usernameDialog.events({
"change #usernameInput, input #usernameInput": function(event, instance) {
var username = instance.find("#usernameInput").value;
username = username.trim().toLowerCase().replace(/\s+/gm, "");
if (username.length < 3){
instance.errorMessage.set("Username too short");
} else {
instance.errorMessage.set("Validating...");
Meteor.call("getUserId", username, function(err, userId){
if (userId && userId !== Meteor.userId())
instance.errorMessage.set("This username is taken");
else
instance.errorMessage.set();
});
}
},
"click #changeButton": function(event, instance){
var username = instance.find("#usernameInput").value;
popDialogStack();
username = username.trim().replace(/\s+/gm, " ");
var profileName = username;
username = username.toLowerCase().replace(/\s+/gm, "");
Meteor.users.update(
Meteor.userId(),
{$set: {username: username, "profile.username": profileName}}
);
},
"click #cancelButton": function(event, instance){
popDialogStack();
},
});

View File

@@ -0,0 +1,58 @@
<template name="signIn">
<div id="accountSummary" class="padded white-text">
{{#if loggingIn}}
<paper-spinner active alt="Signing In"></paper-spinner>
{{else}}{{#if currentUser}}
{{#with currentUser}}
<div class="body2">
{{username}}
</div>
<div class="body1">
{{#each emails}}
{{address}}
{{/each}}
<paper-menu-button>
<paper-icon-button icon="arrow-drop-down" noink></paper-icon-button>
<paper-dropdown class="dropdown">
<core-menu class="menu">
<paper-item id="signOutButton">Sign Out</paper-item>
</core-menu>
</paper-dropdown>
</paper-menu-button>
</div>
{{/with}}
{{else}}
{{#if session "creatingNewUser"}}
{{> creatingUser}}
{{else}} {{#if session "forgotPassword"}}
{{> forgotPassword}}
{{else}}
{{> signingIn}}
{{/if}}{{/if}}
{{/if}}{{/if}}
</div>
</template>
<template name="signingIn">
<h2>Sign In</h2>
<paper-input class="fullwidth" label="Email" id="emailInput"></paper-input><br>
<paper-input-decorator class="fullwidth" label="Password">
<input class="fullwidth" type="password" is="core-input" id="passwordInput">
</paper-input-decorator><br>
<paper-button raised id="signInButton">Sign In</paper-button>
</template>
<template name="creatingUser">
<h2>New Account</h2>
<paper-input class="fullwidth" label="Email" id="emailInput"></paper-input><br>
<paper-input-decorator class="fullwidth" label="Password">
<input class="fullwidth" type="password" is="core-input" id="passwordInput">
</paper-input-decorator><br>
<paper-button raised id="createAccountButton">Create Account</paper-button>
</template>
<template name="forgotPasswod">
<h2>New Account</h2>
<paper-input class="fullwidth" label="Email" id="emailInput"></paper-input><br><br>
<paper-button raised id="recoverPasswordButton">Reset Password</paper-button>
</template>

View File

@@ -0,0 +1,21 @@
Template.signIn.events({
"tap #signInButton": function(event, instance){
var email = instance.find("#emailInput").value;
var pass = instance.find("#passwordInput").value;
Meteor.loginWithPassword(email, pass);
},
"keypress #emailInput, keypress #passwordInput": function(event, instance) {
if (event.which === 13) {
var email = instance.find("#emailInput").value;
var pass = instance.find("#passwordInput").value;
Meteor.loginWithPassword(email, pass);
}
},
"tap #signOutButton": function(event, instance){
Meteor.logout();
},
"tap #createAccountButton": function(event, instance){
console.warn("not yet implemented");
//Session.set("creatingNewUser", true);
},
});

View File

@@ -0,0 +1,16 @@
<template name="titledAtForm">
<app-header-layout has-scrolling-region fullbleed>
<app-header class="app-grey white-text" fixed effects="waterfall">
<app-toolbar class="app-grey white-text">
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
</app-toolbar>
</app-header>
<div>
<div class="layout vertical center" style="padding: 16px">
<paper-material class="white" style="max-width: 400px;">
{{> atForm}}
</paper-material>
</div>
</div>
</app-header-layout>
</template>