Added User profiles so users can change their username
This commit is contained in:
24
rpg-docs/client/views/user/profile/profile.html
Normal file
24
rpg-docs/client/views/user/profile/profile.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<template name="profile">
|
||||
{{#with currentUser}}
|
||||
<core-toolbar class="blue-grey white-text">
|
||||
<core-icon-button icon="menu" core-drawer-toggle></core-icon-button>
|
||||
<div id="username" class="clickable" flex>
|
||||
{{#if username}}
|
||||
{{username}}
|
||||
{{else}}
|
||||
Tap to set username
|
||||
{{/if}}
|
||||
</div>
|
||||
</core-toolbar>
|
||||
<div id="userProfile" class="padded">
|
||||
<div>
|
||||
<h2>Email</h2>
|
||||
{{#each emails}}
|
||||
<div layout horizontal>
|
||||
<p>{{address}}</p>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
{{/with}}
|
||||
</template>
|
||||
19
rpg-docs/client/views/user/profile/profile.js
Normal file
19
rpg-docs/client/views/user/profile/profile.js
Normal file
@@ -0,0 +1,19 @@
|
||||
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: {}
|
||||
});
|
||||
}
|
||||
});
|
||||
9
rpg-docs/client/views/user/profile/usernameDialog.html
Normal file
9
rpg-docs/client/views/user/profile/usernameDialog.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<template name="usernameDialog">
|
||||
{{#with currentUser}}
|
||||
<div>
|
||||
<paper-input id="usernameInput" label="Username" value={{username}}></paper-input>
|
||||
</div>
|
||||
{{/with}}
|
||||
<paper-button id="cancelButton" affirmative> Cancel </paper-button>
|
||||
<paper-button id="changeButton" affirmative> Change Username </paper-button>
|
||||
</template>
|
||||
5
rpg-docs/client/views/user/profile/usernameDialog.js
Normal file
5
rpg-docs/client/views/user/profile/usernameDialog.js
Normal file
@@ -0,0 +1,5 @@
|
||||
Template.usernameDialog.events({
|
||||
"tap #changeButton": function(event, instance){
|
||||
Meteor.users.update(Meteor.userId(), {$set: {username: instance.find("#usernameInput").value}});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user