Removed many unnecessary controller. uses in templates.

This commit is contained in:
Robin Ward 2013-05-20 13:42:26 -04:00
parent c7aebbf4d6
commit a79d53c628
21 changed files with 125 additions and 110 deletions

View file

@ -4,7 +4,7 @@
</div> </div>
<div class='span10 controls'> <div class='span10 controls'>
<button class='btn' {{action sendTestEmail}} {{bindAttr disabled="sendTestEmailDisabled"}}>{{i18n admin.email_logs.send_test}}</button> <button class='btn' {{action sendTestEmail}} {{bindAttr disabled="sendTestEmailDisabled"}}>{{i18n admin.email_logs.send_test}}</button>
{{#if controller.sentTestEmail}}<span class='result-message'>{{i18n admin.email_logs.sent_test}}</span>{{/if}} {{#if sentTestEmail}}<span class='result-message'>{{i18n admin.email_logs.sent_test}}</span>{{/if}}
</div> </div>
</div> </div>

View file

@ -7,7 +7,6 @@
</div> </div>
</div> </div>
<table class='admin-flags'> <table class='admin-flags'>
<thead> <thead>
<tr> <tr>
@ -27,7 +26,7 @@
<td class='flaggers'>{{#each flaggers}}{{#linkTo 'adminUser' this}}{{avatar this imageSize="small"}} {{/linkTo}}{{/each}}</td> <td class='flaggers'>{{#each flaggers}}{{#linkTo 'adminUser' this}}{{avatar this imageSize="small"}} {{/linkTo}}{{/each}}</td>
<td class='last-flagged'>{{date lastFlagged}}</td> <td class='last-flagged'>{{date lastFlagged}}</td>
<td class='action'> <td class='action'>
{{#if controller.adminActiveFlagsView}} {{#if adminActiveFlagsView}}
<button title='{{i18n admin.flags.clear_title}}' class='btn' {{action clearFlags this}}>{{i18n admin.flags.clear}}</button> <button title='{{i18n admin.flags.clear_title}}' class='btn' {{action clearFlags this}}>{{i18n admin.flags.clear}}</button>
<button title='{{i18n admin.flags.delete_title}}' class='btn' {{action deletePost this}}>{{i18n admin.flags.delete}}</button> <button title='{{i18n admin.flags.delete_title}}' class='btn' {{action deletePost this}}>{{i18n admin.flags.delete}}</button>
{{/if}} {{/if}}

View file

@ -15,16 +15,16 @@
<th>{{yaxis}}</th> <th>{{yaxis}}</th>
</tr> </tr>
{{#each data}} {{#each row in data}}
<tr> <tr>
<td>{{x}}</td> <td>{{row.x}}</td>
<td> <td>
{{#if controller.viewingTable}} {{#if viewingTable}}
{{y}} {{row.y}}
{{/if}} {{/if}}
{{#if controller.viewingBarChart}} {{#if viewingBarChart}}
<div class='bar-container'> <div class='bar-container'>
<div class='bar' style="width: {{unbound percentage}}%">{{y}}</div> <div class='bar' style="width: {{unbound row.percentage}}%">{{row.y}}</div>
</div> </div>
{{/if}} {{/if}}
</td> </td>

View file

@ -8,6 +8,10 @@
**/ **/
Discourse.PreferencesEmailRoute = Discourse.RestrictedUserRoute.extend({ Discourse.PreferencesEmailRoute = Discourse.RestrictedUserRoute.extend({
model: function() {
return this.modelFor('user');
},
renderTemplate: function() { renderTemplate: function() {
this.render({ into: 'user', outlet: 'userOutlet' }); this.render({ into: 'user', outlet: 'userOutlet' });
}, },
@ -20,10 +24,6 @@ Discourse.PreferencesEmailRoute = Discourse.RestrictedUserRoute.extend({
outlet: 'userOutlet', outlet: 'userOutlet',
controller: 'preferences' controller: 'preferences'
}); });
},
setupController: function(controller) {
controller.set('content', this.controllerFor('user').get('content'));
} }
}); });

View file

@ -8,16 +8,16 @@
**/ **/
Discourse.PreferencesRoute = Discourse.RestrictedUserRoute.extend({ Discourse.PreferencesRoute = Discourse.RestrictedUserRoute.extend({
model: function() {
return this.modelFor('user');
},
renderTemplate: function() { renderTemplate: function() {
this.render('preferences', { this.render('preferences', {
into: 'user', into: 'user',
outlet: 'userOutlet', outlet: 'userOutlet',
controller: 'preferences' controller: 'preferences'
}); });
},
setupController: function(controller) {
controller.set('content', this.controllerFor('user').get('content'));
} }
}); });

View file

@ -8,6 +8,10 @@
**/ **/
Discourse.PreferencesUsernameRoute = Discourse.RestrictedUserRoute.extend({ Discourse.PreferencesUsernameRoute = Discourse.RestrictedUserRoute.extend({
model: function() {
return this.modelFor('user');
},
renderTemplate: function() { renderTemplate: function() {
return this.render({ into: 'user', outlet: 'userOutlet' }); return this.render({ into: 'user', outlet: 'userOutlet' });
}, },
@ -22,10 +26,8 @@ Discourse.PreferencesUsernameRoute = Discourse.RestrictedUserRoute.extend({
}); });
}, },
setupController: function(controller) { setupController: function(controller, user) {
var user = this.controllerFor('user').get('content'); controller.set('newUsername', user.get('username'));
controller.set('content', user);
return controller.set('newUsername', user.get('username'));
} }
}); });

View file

@ -5,7 +5,7 @@
<div class='composer-popup-container'> <div class='composer-popup-container'>
<div id='new-user-education' class='composer-popup' style='display: none'> <div id='new-user-education' class='composer-popup' style='display: none'>
<a href='#' {{action closeEducation}} class='close'><i class='icon icon-remove-sign'></i></a> <a href='#' {{action closeEducation}} class='close'><i class='icon icon-remove-sign'></i></a>
{{{controller.educationContents}}} {{{educationContents}}}
</div> </div>
<div id='similar-topics' class='composer-popup' style='display: none'> <div id='similar-topics' class='composer-popup' style='display: none'>
@ -13,7 +13,7 @@
<h3>{{i18n composer.similar_topics}}<h3> <h3>{{i18n composer.similar_topics}}<h3>
<ul class='topics'> <ul class='topics'>
{{#each controller.similarTopics}} {{#each similarTopics}}
<li>{{{topicLink this}}} <span class='posts-count'>({{{i18n topic.filters.n_posts count="posts_count"}}})</span></li> <li>{{{topicLink this}}} <span class='posts-count'>({{{i18n topic.filters.n_posts count="posts_count"}}})</span></li>
{{/each}} {{/each}}
</ul> </ul>
@ -55,7 +55,7 @@
{{view Discourse.NotifyingTextArea parentBinding="view" tabindex="3" valueBinding="content.reply" id="wmd-input" placeholderKey="composer.reply_placeholder"}} {{view Discourse.NotifyingTextArea parentBinding="view" tabindex="3" valueBinding="content.reply" id="wmd-input" placeholderKey="composer.reply_placeholder"}}
</div> </div>
<div class='preview-wrapper'> <div class='preview-wrapper'>
<div id='wmd-preview' {{bindAttr class="controller.hidePreview:hidden"}}></div> <div id='wmd-preview' {{bindAttr class="hidePreview:hidden"}}></div>
</div> </div>
{{#if Discourse.currentUser}} {{#if Discourse.currentUser}}
<a href="#" {{action togglePreview target="controller"}} class='toggle-preview'>{{{content.toggleText}}}</a> <a href="#" {{action togglePreview target="controller"}} class='toggle-preview'>{{{content.toggleText}}}</a>

View file

@ -5,7 +5,7 @@
{{view Discourse.TopicExtraInfoView}} {{view Discourse.TopicExtraInfoView}}
<div class='panel clearfix'> <div class='panel clearfix'>
{{#unless controller.showExtraInfo}} {{#unless showExtraInfo}}
<div class='current-username'> <div class='current-username'>
{{#if view.currentUser}} {{#if view.currentUser}}
<span class='username'><a {{bindAttr href="view.currentUser.path"}}>{{view.currentUser.name}}</a></span> <span class='username'><a {{bindAttr href="view.currentUser.path"}}>{{view.currentUser.name}}</a></span>

View file

@ -1,20 +1,20 @@
<div id='list-controls'> <div id='list-controls'>
<div class="container"> <div class="container">
<ul class="nav nav-pills" id='category-filter'> <ul class="nav nav-pills" id='category-filter'>
{{#each controller.availableNavItems}} {{#each availableNavItems}}
{{view Discourse.NavItemView contentBinding="this"}} {{view Discourse.NavItemView contentBinding="this"}}
{{/each}} {{/each}}
</ul> </ul>
{{#if controller.canCreateTopic}} {{#if canCreateTopic}}
<button class='btn btn-default' {{action createTopic target="controller"}}><i class='icon icon-plus'></i>{{view.createTopicText}}</button> <button class='btn btn-default' {{action createTopic target="controller"}}><i class='icon icon-plus'></i>{{view.createTopicText}}</button>
{{/if}} {{/if}}
{{#if controller.canEditCategory}} {{#if canEditCategory}}
<button class='btn btn-default' {{action editCategory target="controller"}}>{{i18n category.edit_long}}</button> <button class='btn btn-default' {{action editCategory target="controller"}}>{{i18n category.edit_long}}</button>
{{/if}} {{/if}}
{{#if controller.canCreateCategory}} {{#if canCreateCategory}}
<button class='btn btn-default' {{action createCategory target="controller"}}><i class='icon icon-plus'></i>{{i18n category.create}}</button> <button class='btn btn-default' {{action createCategory target="controller"}}><i class='icon icon-plus'></i>{{i18n category.create}}</button>
{{/if}} {{/if}}
@ -26,7 +26,7 @@
<div class="full-width"> <div class="full-width">
<div id='list-area'> <div id='list-area'>
{{#if controller.loading}} {{#if loading}}
<div class='contents loading'> <div class='contents loading'>
<table id='topic-list'> <table id='topic-list'>
<tr> <tr>

View file

@ -1,7 +1,7 @@
{{#if Discourse.currentUser.id}} {{#if Discourse.currentUser.id}}
<td class='star'> <td class='star'>
<a {{bindAttr class=":star :icon-star starred:starred"}} {{action toggleStar this target="controller"}} href='#' {{bindAttr title="favoriteTooltip"}}></a> <a {{bindAttr class=":star :icon-star starred:starred"}} {{action toggleStar this}} href='#' {{bindAttr title="favoriteTooltip"}}></a>
</td> </td>
{{/if}} {{/if}}
@ -18,7 +18,7 @@
{{/if}} {{/if}}
{{view Discourse.TopicStatusView topicBinding="this"}} {{view Discourse.TopicStatusView topicBinding="this"}}
{{{topicLink this showTagIfPresent="controller.category"}}} {{{topicLink this}}}
{{#if unread}} {{#if unread}}
<a href="{{lastReadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts unread="unread"}}'>{{unread}}</a> <a href="{{lastReadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts unread="unread"}}'>{{unread}}</a>
{{/if}} {{/if}}

View file

@ -1,4 +1,4 @@
{{#unless controller.loading}} {{#unless loading}}
{{#if loaded}} {{#if loaded}}
<div class='contents'> <div class='contents'>
{{#if topics.length}} {{#if topics.length}}
@ -10,7 +10,7 @@
</button> </button>
{{/if}} {{/if}}
<table id='topic-list' {{bindAttr class="controller.category:filter-category"}}> <table id='topic-list'>
<thead> <thead>
<tr> <tr>
{{#if Discourse.currentUser}} {{#if Discourse.currentUser}}
@ -62,7 +62,8 @@
<h3> <h3>
{{view.footerMessage}} {{view.footerMessage}}
{{#if view.allLoaded}} {{#if view.allLoaded}}
{{#if controller.latest}}
{{#if latest}}
{{#if view.canCreateTopic}} {{#if view.canCreateTopic}}
<a href='#' {{action createTopic}}>{{i18n topic.suggest_create_topic}}</a> <a href='#' {{action createTopic}}>{{i18n topic.suggest_create_topic}}</a>
{{/if}} {{/if}}

View file

@ -1,4 +1,4 @@
<p>{{countI18n topic.multi_select.description countBinding="controller.selectedPostsCount"}}</p> <p>{{countI18n topic.multi_select.description countBinding="selectedPostsCount"}}</p>
{{#if canSelectAll}} {{#if canSelectAll}}
<p><a href='#' {{action selectAll}}>select all</a></p> <p><a href='#' {{action selectAll}}>select all</a></p>

View file

@ -1,10 +1,10 @@
<h3>{{view.title}}</h3> <h3>{{view.title}}</h3>
<div><input type='text' /></div> <div><input type='text' /></div>
{{#each controller.shareLinks}} {{#each shareLinks}}
{{view Discourse.ShareLinkView contentBinding="this"}} {{view Discourse.ShareLinkView contentBinding="this"}}
{{/each}} {{/each}}
<div class='link'> <div class='link'>
<a href='#' {{action close target="controller"}} title='{{i18n share.close}}'><i class="icon icon-remove-sign"></i></a> <a href='#' {{action close}} title='{{i18n share.close}}'><i class="icon icon-remove-sign"></i></a>
</div> </div>

View file

@ -73,11 +73,11 @@
{{else}} {{else}}
{{#if view.fullyLoaded}} {{#if view.fullyLoaded}}
{{view Discourse.TopicClosingView topicBinding="controller.content"}} {{view Discourse.TopicClosingView topicBinding="model"}}
{{view Discourse.TopicFooterButtonsView topicBinding="controller.content"}} {{view Discourse.TopicFooterButtonsView topicBinding="model"}}
{{#if controller.content.suggested_topics.length}} {{#if suggested_topics.length}}
<div id='suggested-topics'> <div id='suggested-topics'>
<h3>{{i18n suggested_topics.title}}</h3> <h3>{{i18n suggested_topics.title}}</h3>
@ -95,7 +95,7 @@
<th class='num activity' colspan='2'>{{i18n activity}}</th> <th class='num activity' colspan='2'>{{i18n activity}}</th>
</tr> </tr>
{{each controller.content.suggested_topics itemTagName="tr" itemViewClass="Discourse.SuggestedTopicView"}} {{each suggested_topics itemTagName="tr" itemViewClass="Discourse.SuggestedTopicView"}}
</table> </table>
</div> </div>
<br/> <br/>

View file

@ -1,8 +1,8 @@
<h3><i class='icon icon-bullhorn'></i> {{i18n best_of.title}}</h3> <h3><i class='icon icon-bullhorn'></i> {{i18n best_of.title}}</h3>
{{#if controller.bestOf}} {{#if bestOf}}
<p>{{{i18n best_of.enabled_description}}}</p> <p>{{{i18n best_of.enabled_description}}}</p>
<button class='btn' {{action cancelFilter}}>{{i18n best_of.disable}}</button> <button class='btn' {{action cancelFilter}}>{{i18n best_of.disable}}</button>
{{else}} {{else}}
<p>{{{i18n best_of.description count="controller.content.posts_count"}}}</p> <p>{{{i18n best_of.description count="posts_count"}}}</p>
<button class='btn' {{action enableBestOf}}>{{i18n best_of.enable}}</button> <button class='btn' {{action enableBestOf}}>{{i18n best_of.enable}}</button>
{{/if}} {{/if}}

View file

@ -1,5 +1,5 @@
<nav class='buttons'> <nav class='buttons'>
{{#if controller.summaryCollapsed}} {{#if summaryCollapsed}}
<button class='btn collapsed' {{action toggleSummary}} title="{{i18n topic.toggle_information}}"> <button class='btn collapsed' {{action toggleSummary}} title="{{i18n topic.toggle_information}}">
<i class='icon icon-chevron-down'></i> <i class='icon icon-chevron-down'></i>
</button> </button>
@ -11,7 +11,7 @@
</nav> </nav>
{{#if controller.summaryCollapsed}} {{#if summaryCollapsed}}
<section class='summary collapsed'> <section class='summary collapsed'>
<ul class="clearfix"> <ul class="clearfix">
<li> <li>

View file

@ -1,11 +1,11 @@
<h3><i class='icon icon-envelope-alt'></i> {{i18n private_message_info.title}}</h3> <h3><i class='icon icon-envelope-alt'></i> {{i18n private_message_info.title}}</h3>
<div class='participants clearfix'> <div class='participants clearfix'>
{{#each content.allowed_groups}} {{#each allowed_groups}}
<div class='user group'> <div class='user group'>
#{{unbound name}} #{{unbound name}}
</div> </div>
{{/each}} {{/each}}
{{#each content.allowed_users}} {{#each allowed_users}}
<div class='user'> <div class='user'>
<a href='/users/{{lower username}}'> <a href='/users/{{lower username}}'>
{{avatar this imageSize="small"}} {{avatar this imageSize="small"}}
@ -16,8 +16,8 @@
</div> </div>
{{/each}} {{/each}}
</div> </div>
{{#if controller.content.can_invite_to}} {{#if can_invite_to}}
<div class='controls'> <div class='controls'>
<button class='btn' {{action showPrivateInviteModal target="controller"}}>{{i18n private_message_info.invite}}</button> <button class='btn' {{action showPrivateInviteModal}}>{{i18n private_message_info.invite}}</button>
</div> </div>
{{/if}} {{/if}}

View file

@ -27,7 +27,7 @@
{{textField value=newEmail elementId="change_email" classNames="input-xxlarge"}} {{textField value=newEmail elementId="change_email" classNames="input-xxlarge"}}
</div> </div>
<div class='instructions'> <div class='instructions'>
{{#if controller.taken}} {{#if taken}}
{{i18n user.change_email.taken}} {{i18n user.change_email.taken}}
{{else}} {{else}}
{{i18n user.email.instructions}} {{i18n user.email.instructions}}
@ -38,7 +38,7 @@
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<button {{action changeEmail target="controller"}} {{bindAttr disabled="controller.saveDisabled"}} class="btn btn-primary">{{controller.saveButtonText}}</button> <button {{action changeEmail}} {{bindAttr disabled="saveDisabled"}} class="btn btn-primary">{{saveButtonText}}</button>
</div> </div>
</div> </div>
{{/if}} {{/if}}

View file

@ -3,11 +3,11 @@
<div class="control-group"> <div class="control-group">
<label class="control-label">{{i18n user.username.title}}</label> <label class="control-label">{{i18n user.username.title}}</label>
<div class="controls"> <div class="controls">
<span class='static'>{{content.username}}</span> <span class='static'>{{username}}</span>
{{#linkTo "preferences.username" class="btn pad-left"}}{{i18n user.change_username.action}}{{/linkTo}} {{#linkTo "preferences.username" class="btn pad-left"}}{{i18n user.change_username.action}}{{/linkTo}}
</div> </div>
<div class='instructions'> <div class='instructions'>
{{{i18n user.username.short_instructions username="content.username"}}} {{{i18n user.username.short_instructions username="username"}}}
</div> </div>
</div> </div>
@ -24,7 +24,7 @@
<div class="control-group"> <div class="control-group">
<label class="control-label">{{i18n user.email.title}}</label> <label class="control-label">{{i18n user.email.title}}</label>
<div class="controls"> <div class="controls">
<span class='static'>{{content.email}}</span> <span class='static'>{{email}}</span>
{{#linkTo "preferences.email" class="btn pad-left"}}{{i18n user.change_email.action}}{{/linkTo}} {{#linkTo "preferences.email" class="btn pad-left"}}{{i18n user.change_email.action}}{{/linkTo}}
</div> </div>
<div class='instructions'> <div class='instructions'>
@ -35,24 +35,24 @@
<div class="control-group"> <div class="control-group">
<label class="control-label">{{i18n user.password.title}}</label> <label class="control-label">{{i18n user.password.title}}</label>
<div class="controls"> <div class="controls">
<a href="#" {{action changePassword target="controller"}} class='btn'>{{i18n user.change_password.action}}</a> {{controller.passwordProgress}} <a href="#" {{action changePassword target="controller"}} class='btn'>{{i18n user.change_password.action}}</a> {{passwordProgress}}
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label">{{i18n user.avatar.title}}</label> <label class="control-label">{{i18n user.avatar.title}}</label>
<div class="controls"> <div class="controls">
{{avatar content imageSize="large"}} {{avatar model imageSize="large"}}
</div> </div>
<div class='instructions'> <div class='instructions'>
{{{i18n user.avatar.instructions}}} {{content.email}} {{{i18n user.avatar.instructions}}} {{email}}
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<label class="control-label">{{i18n user.bio}}</label> <label class="control-label">{{i18n user.bio}}</label>
<div class="controls"> <div class="controls">
{{view Discourse.PagedownEditor valueBinding="content.bio_raw"}} {{view Discourse.PagedownEditor valueBinding="bio_raw"}}
</div> </div>
</div> </div>
@ -66,17 +66,17 @@
<div class="control-group"> <div class="control-group">
<label class="control-label">{{i18n user.email_settings}}</label> <label class="control-label">{{i18n user.email_settings}}</label>
<div class="controls"> <div class="controls">
<label>{{view Ember.Checkbox checkedBinding="content.email_digests"}} <label>{{view Ember.Checkbox checkedBinding="email_digests"}}
{{i18n user.email_digests.title}}</label> {{i18n user.email_digests.title}}</label>
{{#if content.email_digests}} {{#if email_digests}}
<div class='control-indent'> <div class='control-indent'>
{{view Discourse.ComboboxView valueAttribute="value" contentBinding="controller.digestFrequencies" valueBinding="content.digest_after_days"}} {{view Discourse.ComboboxView valueAttribute="value" contentBinding="digestFrequencies" valueBinding="digest_after_days"}}
</div> </div>
{{/if}} {{/if}}
<label>{{view Ember.Checkbox checkedBinding="content.email_private_messages"}} <label>{{view Ember.Checkbox checkedBinding="email_private_messages"}}
{{i18n user.email_private_messages}}</label> {{i18n user.email_private_messages}}</label>
<label>{{view Ember.Checkbox checkedBinding="content.email_direct"}} <label>{{view Ember.Checkbox checkedBinding="email_direct"}}
{{i18n user.email_direct}}</label> {{i18n user.email_direct}}</label>
</div> </div>
<div class='instructions'> <div class='instructions'>
@ -88,25 +88,25 @@
<label class="control-label">{{i18n user.other_settings}}</label> <label class="control-label">{{i18n user.other_settings}}</label>
<div class="controls"> <div class="controls">
<label>{{i18n user.auto_track_topics}}</label> <label>{{i18n user.auto_track_topics}}</label>
{{view Discourse.ComboboxView valueAttribute="value" contentBinding="controller.autoTrackDurations" valueBinding="content.auto_track_topics_after_msecs"}} {{view Discourse.ComboboxView valueAttribute="value" contentBinding="autoTrackDurations" valueBinding="auto_track_topics_after_msecs"}}
</div> </div>
<div class="controls"> <div class="controls">
<label>{{i18n user.new_topic_duration.label}}</label> <label>{{i18n user.new_topic_duration.label}}</label>
{{view Discourse.ComboboxView valueAttribute="value" contentBinding="controller.considerNewTopicOptions" valueBinding="content.new_topic_duration_minutes"}} {{view Discourse.ComboboxView valueAttribute="value" contentBinding="considerNewTopicOptions" valueBinding="new_topic_duration_minutes"}}
</div> </div>
<div class="controls"> <div class="controls">
<label>{{view Ember.Checkbox checkedBinding="content.external_links_in_new_tab"}} <label>{{view Ember.Checkbox checkedBinding="external_links_in_new_tab"}}
{{i18n user.external_links_in_new_tab}}</label> {{i18n user.external_links_in_new_tab}}</label>
<label>{{view Ember.Checkbox checkedBinding="content.enable_quoting"}} <label>{{view Ember.Checkbox checkedBinding="enable_quoting"}}
{{i18n user.enable_quoting}}</label> {{i18n user.enable_quoting}}</label>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<button {{action save target="controller"}} {{bindAttr disabled="controller.saveDisabled"}} class="btn btn-primary">{{controller.saveButtonText}}</button> <button {{action save target="controller"}} {{bindAttr disabled="saveDisabled"}} class="btn btn-primary">{{saveButtonText}}</button>
{{#if saved}}{{i18n saved}}{{/if}} {{#if saved}}{{i18n saved}}{{/if}}
</div> </div>
</div> </div>

View file

@ -1,47 +1,47 @@
{{#unless model.loading}} {{#unless loading}}
<div class="user-heading"> <div class="user-heading">
<div class="container"> <div class="container">
<div class="full-width" id='user-menu'> <div class="full-width" id='user-menu'>
<h1>{{model.name}}<span>{{unbound model.username}}{{{unbound model.statusIcon}}}</span></h1> <h1>{{name}}<span>{{unbound username}}{{{unbound statusIcon}}}</span></h1>
{{#if viewingSelf}} {{#if viewingSelf}}
<button {{action "logout" target="Discourse"}} class='btn'>{{i18n user.log_out}}</button> <button {{action "logout" target="Discourse"}} class='btn'>{{i18n user.log_out}}</button>
{{/if}}
{{#if Discourse.currentUser.staff}}
<a href="{{unbound model.adminPath}}" class='btn'><i class="icon-wrench"></i>&nbsp;{{i18n admin.user.show_admin_profile}}</a>
{{/if}}
<ul class="nav nav-pills">
<li>
{{#linkTo 'user.activity'}}{{i18n user.activity_stream}}{{/linkTo}}
</li>
{{#if controller.canSeePrivateMessages}}
<li>
{{#linkTo "user.privateMessages"}}{{i18n user.private_messages}}{{/linkTo}}
</li>
{{/if}} {{/if}}
<li> {{#if Discourse.currentUser.staff}}
{{#linkTo 'user.invited'}}{{i18n user.invited.title}}{{/linkTo}} <a href="{{unbound adminPath}}" class='btn'><i class="icon-wrench"></i>&nbsp;{{i18n admin.user.show_admin_profile}}</a>
</li>
{{#if model.can_edit}}
<li>
{{#linkTo 'preferences'}}{{i18n user.preferences}}{{/linkTo}}
</li>
{{/if}} {{/if}}
</ul> <ul class="nav nav-pills">
<div class='avatar-wrapper'> <li>
{{avatar content imageSize="120"}} {{#linkTo 'user.activity'}}{{i18n user.activity_stream}}{{/linkTo}}
</li>
{{#if canSeePrivateMessages}}
<li>
{{#linkTo "user.privateMessages"}}{{i18n user.private_messages}}{{/linkTo}}
</li>
{{/if}}
<li>
{{#linkTo 'user.invited'}}{{i18n user.invited.title}}{{/linkTo}}
</li>
{{#if can_edit}}
<li>
{{#linkTo 'preferences'}}{{i18n user.preferences}}{{/linkTo}}
</li>
{{/if}}
</ul>
<div class='avatar-wrapper'>
{{avatar model imageSize="120"}}
</div>
</div> </div>
</div> </div>
</div> </div>
</div> <div class="container">
<div class="container"> <div class='user-info clearfix'>
<div class='user-info clearfix'> <div class='about-me'>
<div class='about-me'> {{{bio_excerpt}}}
{{{model.bio_excerpt}}} </div>
</div> </div>
</div>
<div class="container">
{{outlet userOutlet}}
</div> </div>
</div>
<div class="container">
{{outlet userOutlet}}
</div>
{{/unless}} {{/unless}}

View file

@ -12,7 +12,7 @@ Discourse.ComboboxView = Discourse.View.extend({
valueAttribute: 'id', valueAttribute: 'id',
render: function(buffer) { render: function(buffer) {
var selected, _ref, var _ref,
_this = this; _this = this;
// Add none option if required // Add none option if required
@ -20,7 +20,8 @@ Discourse.ComboboxView = Discourse.View.extend({
buffer.push("<option value=\"\">" + (Ember.String.i18n(this.get('none'))) + "</option>"); buffer.push("<option value=\"\">" + (Ember.String.i18n(this.get('none'))) + "</option>");
} }
selected = (_ref = this.get('value')) ? _ref.toString() : void 0; var selected = (_ref = this.get('value')) ? _ref.toString() : void 0;
if (this.get('content')) { if (this.get('content')) {
return this.get('content').each(function(o) { return this.get('content').each(function(o) {
var data, selectedText, val, _ref1; var data, selectedText, val, _ref1;
@ -37,6 +38,17 @@ Discourse.ComboboxView = Discourse.View.extend({
} }
}, },
valueChanged: function() {
var $combo = this.$();
var val = this.get('value');
if (val) {
$combo.val(this.get('value').toString());
} else {
$combo.val(null);
}
$combo.trigger("liszt:updated")
}.observes('value'),
didInsertElement: function() { didInsertElement: function() {
var $elem, var $elem,
_this = this; _this = this;
@ -55,6 +67,7 @@ Discourse.ComboboxView = Discourse.View.extend({
$elem.chosen().next().addClass(c); $elem.chosen().next().addClass(c);
}); });
} }
$elem.change(function(e) { $elem.change(function(e) {
_this.set('value', $(e.target).val()); _this.set('value', $(e.target).val());
}); });