Site setting to support showing real names in posts. Also put back in type to search on site settings

This commit is contained in:
Robin Ward
2013-11-01 16:32:12 -04:00
parent 04aa1690e2
commit 52c3457133
24 changed files with 35 additions and 14 deletions

View File

@@ -26,7 +26,9 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P
} }
var adminSettingsController = this; var adminSettingsController = this;
return this.get('content').filter(function(item, index, enumerable) {
var maxResults = Em.isNone(filter) ? this.get('content.length') : 20;
return _.first(this.get('content').filter(function(item, index, enumerable) {
if (adminSettingsController.get('onlyOverridden') && !item.get('overridden')) return false; if (adminSettingsController.get('onlyOverridden') && !item.get('overridden')) return false;
if (filter) { if (filter) {
if (item.get('setting').toLowerCase().indexOf(filter) > -1) return true; if (item.get('setting').toLowerCase().indexOf(filter) > -1) return true;
@@ -36,20 +38,11 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P
} }
return true; return true;
}); }), maxResults);
}.property('filter', 'content.@each', 'onlyOverridden'), }.property('filter', 'content.@each', 'onlyOverridden'),
actions: { actions: {
/**
Changes the currently active filter
@method changeFilter
**/
changeFilter: function() {
this.set('filter', this.get('newFilter'));
},
/** /**
Reset a setting to its default value Reset a setting to its default value

View File

@@ -6,8 +6,7 @@
</label> </label>
</div> </div>
<div class='controls'> <div class='controls'>
{{textField value=newFilter}} {{textField value=filter placeholderKey="type_to_filter"}}
<button class="btn btn-primary" {{action changeFilter}}>{{i18n filter}}</button>
</div> </div>
</div> </div>

View File

@@ -32,6 +32,11 @@ Discourse.Post = Discourse.Model.extend({
notDeleted: Em.computed.not('deleted'), notDeleted: Em.computed.not('deleted'),
userDeleted: Em.computed.empty('user_id'), userDeleted: Em.computed.empty('user_id'),
showName: function() {
var name = this.get('name');
return name && (name !== this.get('username')) && Discourse.SiteSettings.display_name_on_posts;
}.property('name', 'username'),
postDeletedBy: function() { postDeletedBy: function() {
if (this.get('firstPost')) { return this.get('topic.deleted_by'); } if (this.get('firstPost')) { return this.get('topic.deleted_by'); }
return this.get('deleted_by'); return this.get('deleted_by');

View File

@@ -21,6 +21,11 @@
<div {{bindAttr class=":contents byTopicCreator:topic-creator :trigger-expansion"}}> <div {{bindAttr class=":contents byTopicCreator:topic-creator :trigger-expansion"}}>
<a href='{{unbound usernameUrl}}' {{action showPosterExpansion this}}>{{avatar this imageSize="large"}}</a> <a href='{{unbound usernameUrl}}' {{action showPosterExpansion this}}>{{avatar this imageSize="large"}}</a>
<h3 {{bindAttr class="staff new_user"}}><a href='{{unbound usernameUrl}}' {{action showPosterExpansion this}}>{{breakUp username}}</a></h3> <h3 {{bindAttr class="staff new_user"}}><a href='{{unbound usernameUrl}}' {{action showPosterExpansion this}}>{{breakUp username}}</a></h3>
{{#if showName}}
<h3><a href='{{unbound usernameUrl}}' {{action showPosterExpansion this}}>{{breakUp name}}</a></h3>
{{/if}}
{{#if user_title}}<div class="user-title" {{action showPosterExpansion this}}>{{user_title}}</div>{{/if}} {{#if user_title}}<div class="user-title" {{action showPosterExpansion this}}>{{user_title}}</div>{{/if}}
</div> </div>
{{else}} {{else}}

View File

@@ -270,6 +270,7 @@ class SiteSetting < ActiveRecord::Base
# hidden setting only used by system # hidden setting only used by system
setting(:uncategorized_category_id, -1, hidden: true) setting(:uncategorized_category_id, -1, hidden: true)
client_setting(:display_name_on_posts, false)
client_setting(:enable_names, true) client_setting(:enable_names, true)
def self.call_discourse_hub? def self.call_discourse_hub?

View File

@@ -1062,6 +1062,7 @@ cs:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "zadejte text pro filtrování..."
admin: admin:
title: 'Discourse Administrace' title: 'Discourse Administrace'

View File

@@ -683,6 +683,7 @@ da:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "type to filter..."
admin: admin:
title: 'Discourse Admin' title: 'Discourse Admin'

View File

@@ -1049,6 +1049,7 @@ de:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "Tippe etwas ein, um zu filtern..."
admin: admin:
title: 'Discourse Administrator' title: 'Discourse Administrator'

View File

@@ -1074,7 +1074,7 @@ en:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
filter: "filter" type_to_filter: "type to filter..."
admin: admin:
title: 'Discourse Admin' title: 'Discourse Admin'

View File

@@ -793,6 +793,7 @@ es:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "type to filter..."
admin: admin:
title: 'Administrador' title: 'Administrador'

View File

@@ -1032,6 +1032,7 @@ fr:
create_post: "Répondre / Voir" create_post: "Répondre / Voir"
readonly: "Voir" readonly: "Voir"
admin_js: admin_js:
type_to_filter: "Commencez à taper pour filtrer..."
admin: admin:
title: 'Administation Discourse' title: 'Administation Discourse'
moderator: 'Modérateur' moderator: 'Modérateur'

View File

@@ -638,6 +638,7 @@ id:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "type to filter..."
admin: admin:
title: 'Discourse Admin' title: 'Discourse Admin'

View File

@@ -1001,6 +1001,7 @@ it:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "scrivi per filtrare..."
admin: admin:
title: 'Amministrazione Discourse' title: 'Amministrazione Discourse'

View File

@@ -841,6 +841,7 @@ ko:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "필터를 입력하세요"
admin: admin:
title: 'Discourse 관리자' title: 'Discourse 관리자'

View File

@@ -914,6 +914,7 @@ nb_NO:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "skriv for å filtrere..."
admin: admin:
title: 'Discourse Admin' title: 'Discourse Admin'

View File

@@ -1014,6 +1014,7 @@ nl:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: typ om te filteren...
admin: admin:
title: Discourse Beheer title: Discourse Beheer

View File

@@ -969,6 +969,7 @@ pseudo:
ƀřóŵšéř íš ťóó ółď ťó ŵóřǩ óɳ ťĥíš Ďíščóůřšé ƒóřůɱ</á>. Рłéášé <á ĥřéƒ="ĥťťƿ://ƀřóŵšéĥáƿƿý.čóɱ">ůƿǧřáďé ƀřóŵšéř íš ťóó ółď ťó ŵóřǩ óɳ ťĥíš Ďíščóůřšé ƒóřůɱ</á>. Рłéášé <á ĥřéƒ="ĥťťƿ://ƀřóŵšéĥáƿƿý.čóɱ">ůƿǧřáďé
ýóůř ƀřóŵšéř</á>. ]]' ýóůř ƀřóŵšéř</á>. ]]'
admin_js: admin_js:
type_to_filter: '[[ ťýƿé ťó ƒíłťéř... ]]'
admin: admin:
title: '[[ Ďíščóůřšé Áďɱíɳ ]]' title: '[[ Ďíščóůřšé Áďɱíɳ ]]'
moderator: '[[ Ϻóďéřáťóř ]]' moderator: '[[ Ϻóďéřáťóř ]]'

View File

@@ -602,6 +602,7 @@ pt:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "escreve para filtrar..."
admin: admin:
title: 'Discourse Admin' title: 'Discourse Admin'

View File

@@ -1069,6 +1069,7 @@ pt_BR:
# Essa seção é para o javascript para i18n no admin # Essa seção é para o javascript para i18n no admin
admin_js: admin_js:
type_to_filter: "escreva para filtrar..."
admin: admin:
title: 'Discourse Admin' title: 'Discourse Admin'

View File

@@ -1085,6 +1085,7 @@ ru:
create_post: 'Отвечать / Просматривать' create_post: 'Отвечать / Просматривать'
readonly: Просматривать readonly: Просматривать
admin_js: admin_js:
type_to_filter: 'Введите текст для фильтрации...'
admin: admin:
title: 'Discourse Admin' title: 'Discourse Admin'
moderator: Модератор moderator: Модератор

View File

@@ -788,6 +788,7 @@ sv:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "skriv för att filtrera..."
admin: admin:
title: 'Discourse Admin' title: 'Discourse Admin'

View File

@@ -1075,6 +1075,7 @@ zh_CN:
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "输入过滤条件……"
admin: admin:
title: '论道 管理' title: '论道 管理'

View File

@@ -968,6 +968,7 @@ zh_TW:
readonly: "觀看" readonly: "觀看"
# This section is exported to the javascript for i18n in the admin section # This section is exported to the javascript for i18n in the admin section
admin_js: admin_js:
type_to_filter: "輸入過濾條件……"
admin: admin:
title: '論道 管理' title: '論道 管理'

View File

@@ -722,6 +722,7 @@ en:
dominating_topic_minimum_percent: "What percentage of posts a user has to make in a topic before we consider it dominating." dominating_topic_minimum_percent: "What percentage of posts a user has to make in a topic before we consider it dominating."
enable_names: "Allow users to show their full names" enable_names: "Allow users to show their full names"
display_name_on_posts: "Also show a user's full name on their posts"
notification_types: notification_types:
mentioned: "%{display_username} mentioned you in %{link}" mentioned: "%{display_username} mentioned you in %{link}"