Moved views out of private folder
This commit is contained in:
22
rpg-docs/client/views/user/profile/profile.html
Normal file
22
rpg-docs/client/views/user/profile/profile.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<template name="profile">
|
||||
{{#with currentUser}}
|
||||
<app-toolbar class="blue-grey white-text">
|
||||
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
|
||||
<div id="username" class="clickable" flex>
|
||||
{{profileName}}
|
||||
</div>
|
||||
</app-toolbar>
|
||||
<div id="userProfile" class="padded">
|
||||
<div>
|
||||
<h2>Email</h2>
|
||||
{{#each emails}}
|
||||
<div layout horizontal>
|
||||
<p>{{address}}</p>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
{{> atForm}}
|
||||
{{> atNavButton }}
|
||||
{{/with}}
|
||||
</template>
|
||||
28
rpg-docs/client/views/user/profile/profile.js
Normal file
28
rpg-docs/client/views/user/profile/profile.js
Normal file
@@ -0,0 +1,28 @@
|
||||
Template.profile.helpers({
|
||||
profileName: function() {
|
||||
var user = Meteor.user();
|
||||
return user.profile && user.profile.username ||
|
||||
user.username ||
|
||||
"Tap to set username";
|
||||
}
|
||||
});
|
||||
|
||||
Template.profile.events({
|
||||
"tap #username": function(){
|
||||
if (this._id === Meteor.userId()){
|
||||
GlobalUI.showDialog({
|
||||
heading: "Change Username",
|
||||
template: "usernameDialog",
|
||||
});
|
||||
}
|
||||
},
|
||||
"tap #verifyEmail": function(event, instance){
|
||||
if (!Meteor.user()) return;
|
||||
Accounts.sendVerificationEmail(Meteor.userId(), this.address);
|
||||
GlobalUI.toast({
|
||||
text: "Email verification sent to " + this.address,
|
||||
template: "",
|
||||
data: {},
|
||||
});
|
||||
},
|
||||
});
|
||||
8
rpg-docs/client/views/user/profile/usernameDialog.html
Normal file
8
rpg-docs/client/views/user/profile/usernameDialog.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<template name="usernameDialog">
|
||||
<div>
|
||||
<paper-input id="usernameInput" label="Username" value={{profileName}}></paper-input>
|
||||
</div>
|
||||
<div style="color: red;" class="vertMargin">{{errorMessage}}</div>
|
||||
<paper-button id="cancelButton" affirmative> Cancel </paper-button>
|
||||
<paper-button id="changeButton" disabled={{invalid}} affirmative> Change Username </paper-button>
|
||||
</template>
|
||||
49
rpg-docs/client/views/user/profile/usernameDialog.js
Normal file
49
rpg-docs/client/views/user/profile/usernameDialog.js
Normal file
@@ -0,0 +1,49 @@
|
||||
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("");
|
||||
});
|
||||
}
|
||||
},
|
||||
"tap #changeButton": function(event, instance){
|
||||
var username = instance.find("#usernameInput").value;
|
||||
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}}
|
||||
);
|
||||
},
|
||||
});
|
||||
58
rpg-docs/client/views/user/signIn/signIn.html
Normal file
58
rpg-docs/client/views/user/signIn/signIn.html
Normal 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>
|
||||
21
rpg-docs/client/views/user/signIn/signIn.js
Normal file
21
rpg-docs/client/views/user/signIn/signIn.js
Normal 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);
|
||||
},
|
||||
});
|
||||
13
rpg-docs/client/views/user/titledAtForm/titledAtForm.html
Normal file
13
rpg-docs/client/views/user/titledAtForm/titledAtForm.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<template name="titledAtForm">
|
||||
<app-toolbar class="app-grey white-text">
|
||||
<paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
|
||||
<div flex>
|
||||
|
||||
</div>
|
||||
</app-toolbar>
|
||||
<div class="scroll-y padded" fit layout vertical center center-justified>
|
||||
<paper-material class="white" style="max-width: 400px;">
|
||||
{{> atForm}}
|
||||
</paper-material>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user