ES6: Preferences views
This commit is contained in:
parent
a9342dbf92
commit
3368e23fe4
|
@ -7,7 +7,6 @@
|
|||
@module Discourse
|
||||
**/
|
||||
Discourse.ScrollTop = Em.Mixin.create({
|
||||
|
||||
_scrollTop: function() {
|
||||
Em.run.schedule('afterRender', function() {
|
||||
$(document).scrollTop(0);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
export default Ember.View.extend({
|
||||
templateName: 'user/about',
|
||||
classNames: ['user-preferences'],
|
||||
|
||||
_focusAbout: function() {
|
||||
var self = this;
|
||||
Ember.run.schedule('afterRender', function() {
|
||||
self.$('textarea').focus();
|
||||
});
|
||||
}.on('didInsertElement')
|
||||
});
|
|
@ -0,0 +1,9 @@
|
|||
export default Em.View.extend({
|
||||
templateName: 'user/email',
|
||||
classNames: ['user-preferences'],
|
||||
_focusField: function() {
|
||||
Em.run.schedule('afterRender', function() {
|
||||
$('#change_email').focus();
|
||||
});
|
||||
}.on('didInsertElement')
|
||||
});
|
|
@ -1,18 +1,12 @@
|
|||
/**
|
||||
This view handles rendering of a user's username preferences
|
||||
|
||||
@class PreferencesUsernameView
|
||||
@extends Discourse.View
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.PreferencesUsernameView = Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
templateName: 'user/username',
|
||||
classNames: ['user-preferences'],
|
||||
|
||||
didInsertElement: function() {
|
||||
return $('#change_username').focus();
|
||||
},
|
||||
_focusUsername: function() {
|
||||
Em.run.schedule('afterRender', function() {
|
||||
$('#change_username').focus();
|
||||
});
|
||||
}.on('didInsertElement'),
|
||||
|
||||
keyDown: function(e) {
|
||||
if (e.keyCode === 13) {
|
||||
|
@ -24,7 +18,4 @@ Discourse.PreferencesUsernameView = Discourse.View.extend({
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
Discourse.PreferencesView = Discourse.View.extend({
|
||||
export default Ember.View.extend({
|
||||
templateName: 'user/preferences',
|
||||
classNames: ['user-preferences']
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
export default Ember.View.extend({
|
||||
templateName: 'user/invited'
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
export default Ember.View.extend(Discourse.ScrollTop, {
|
||||
templateName: 'user/user',
|
||||
userBinding: 'controller.content',
|
||||
|
||||
updateTitle: function() {
|
||||
var username = this.get('user.username');
|
||||
if (username) {
|
||||
Discourse.set('title', "" + (I18n.t("user.profile")) + " - " + username);
|
||||
}
|
||||
}.observes('user.loaded', 'user.username')
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
This view handles rendering of a user's bio editor
|
||||
|
||||
@class PreferencesAboutView
|
||||
@extends Discourse.View
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.PreferencesAboutView = Discourse.View.extend({
|
||||
templateName: 'user/about',
|
||||
classNames: ['user-preferences'],
|
||||
|
||||
didInsertElement: function() {
|
||||
this.$('textarea').focus();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
This view handles rendering of a user's email preferences
|
||||
|
||||
@class PreferencesEmailView
|
||||
@extends Discourse.View
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.PreferencesEmailView = Discourse.View.extend({
|
||||
templateName: 'user/email',
|
||||
classNames: ['user-preferences'],
|
||||
didInsertElement: function() {
|
||||
return $('#change_email').focus();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
/**
|
||||
This view handles rendering of a user's invited list
|
||||
|
||||
@class UserInvitedView
|
||||
@extends Discourse.View
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.UserInvitedView = Discourse.View.extend({
|
||||
templateName: 'user/invited'
|
||||
});
|
||||
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
This view handles rendering of a user including the navigational menu
|
||||
|
||||
@class UserView
|
||||
@extends Discourse.View
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.UserView = Discourse.View.extend({
|
||||
templateName: 'user/user',
|
||||
userBinding: 'controller.content',
|
||||
|
||||
updateTitle: function() {
|
||||
var username;
|
||||
username = this.get('user.username');
|
||||
if (username) {
|
||||
return Discourse.set('title', "" + (I18n.t("user.profile")) + " - " + username);
|
||||
}
|
||||
}.observes('user.loaded', 'user.username'),
|
||||
|
||||
didInsertElement: function() {
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue