From bb135fafb432134c08b02b4253819fc99d3579df Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 29 Oct 2013 17:03:28 -0400 Subject: [PATCH] Replace slow auto-filter in site settings with a filter button --- .../controllers/admin_site_settings_controller.js | 10 ++++++++++ .../admin/templates/site_settings.js.handlebars | 5 +++-- .../discourse/views/discourse_text_field.js | 1 + app/assets/stylesheets/common/admin/admin_base.scss | 10 +++++++--- config/locales/client.cs.yml | 1 - config/locales/client.da.yml | 1 - config/locales/client.de.yml | 1 - config/locales/client.en.yml | 2 +- config/locales/client.es.yml | 1 - config/locales/client.fr.yml | 1 - config/locales/client.id.yml | 1 - config/locales/client.it.yml | 1 - config/locales/client.ko.yml | 1 - config/locales/client.nb_NO.yml | 1 - config/locales/client.nl.yml | 1 - config/locales/client.pseudo.yml | 1 - config/locales/client.pt.yml | 1 - config/locales/client.pt_BR.yml | 1 - config/locales/client.ru.yml | 1 - config/locales/client.sv.yml | 1 - config/locales/client.zh_CN.yml | 7 +++---- config/locales/client.zh_TW.yml | 1 - 22 files changed, 25 insertions(+), 26 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js index 769865e1365..924654a2ba7 100644 --- a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js @@ -40,6 +40,16 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P }.property('filter', 'content.@each', 'onlyOverridden'), actions: { + + /** + Changes the currently active filter + + @method changeFilter + **/ + changeFilter: function() { + this.set('filter', this.get('newFilter')); + }, + /** Reset a setting to its default value diff --git a/app/assets/javascripts/admin/templates/site_settings.js.handlebars b/app/assets/javascripts/admin/templates/site_settings.js.handlebars index cb8270b8ba3..25885c1572d 100644 --- a/app/assets/javascripts/admin/templates/site_settings.js.handlebars +++ b/app/assets/javascripts/admin/templates/site_settings.js.handlebars @@ -5,8 +5,9 @@ {{i18n admin.site_settings.show_overriden}} - diff --git a/app/assets/javascripts/discourse/views/discourse_text_field.js b/app/assets/javascripts/discourse/views/discourse_text_field.js index a345ae026a3..87d562d4d04 100644 --- a/app/assets/javascripts/discourse/views/discourse_text_field.js +++ b/app/assets/javascripts/discourse/views/discourse_text_field.js @@ -10,6 +10,7 @@ Discourse.TextField = Ember.TextField.extend({ attributeBindings: ['autocorrect', 'autocapitalize', 'autofocus'], placeholder: function() { + if( this.get('placeholderKey') ) { return I18n.t(this.get('placeholderKey')); } else { diff --git a/app/assets/stylesheets/common/admin/admin_base.scss b/app/assets/stylesheets/common/admin/admin_base.scss index 7ed5e07b6b9..33e07ec79c8 100644 --- a/app/assets/stylesheets/common/admin/admin_base.scss +++ b/app/assets/stylesheets/common/admin/admin_base.scss @@ -82,7 +82,7 @@ td {border-bottom: 1px solid #ddd; border-top: 1px solid #ddd;} @include border-radius-all(5px); background-color: darken($white, 5%); border: 1px solid darken($white, 10%); - padding: 5px 10px 3px 0px; + padding: 10px 10px 3px 0px; margin-bottom: 20px; height: 35px; .nav.nav-pills { @@ -102,11 +102,15 @@ td {border-bottom: 1px solid #ddd; border-top: 1px solid #ddd;} color: $darkish_gray; } .controls { - padding-top: 3px; + margin-left: 10px; } button { - float: left; margin-right: 5px; + margin-left: 5px; + } + input[type=text] { + display: inline-block; + float: left; } .result-message { display: inline-block; diff --git a/config/locales/client.cs.yml b/config/locales/client.cs.yml index 7a9df917e57..d23aa6f4f81 100644 --- a/config/locales/client.cs.yml +++ b/config/locales/client.cs.yml @@ -1063,7 +1063,6 @@ cs: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "zadejte text pro filtrování..." admin: title: 'Discourse Administrace' diff --git a/config/locales/client.da.yml b/config/locales/client.da.yml index 38e60bbec35..6d561848d63 100644 --- a/config/locales/client.da.yml +++ b/config/locales/client.da.yml @@ -684,7 +684,6 @@ da: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "type to filter..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.de.yml b/config/locales/client.de.yml index 4e25f34e5d3..87c29305fbe 100644 --- a/config/locales/client.de.yml +++ b/config/locales/client.de.yml @@ -1050,7 +1050,6 @@ de: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "Tippe etwas ein, um zu filtern..." admin: title: 'Discourse Administrator' diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index b4e5b2f0973..8590a93ef07 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1075,7 +1075,7 @@ en: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "type to filter..." + filter: "filter" admin: title: 'Discourse Admin' diff --git a/config/locales/client.es.yml b/config/locales/client.es.yml index e09bcaccd30..e3e70382fd6 100644 --- a/config/locales/client.es.yml +++ b/config/locales/client.es.yml @@ -794,7 +794,6 @@ es: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "type to filter..." admin: title: 'Administrador' diff --git a/config/locales/client.fr.yml b/config/locales/client.fr.yml index 8e2747d9916..b291f9b0d59 100644 --- a/config/locales/client.fr.yml +++ b/config/locales/client.fr.yml @@ -1033,7 +1033,6 @@ fr: create_post: "Répondre / Voir" readonly: "Voir" admin_js: - type_to_filter: "Commencez à taper pour filtrer..." admin: title: 'Administation Discourse' moderator: 'Modérateur' diff --git a/config/locales/client.id.yml b/config/locales/client.id.yml index d11b936eb97..a29dbbbf12e 100644 --- a/config/locales/client.id.yml +++ b/config/locales/client.id.yml @@ -639,7 +639,6 @@ id: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "type to filter..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.it.yml b/config/locales/client.it.yml index 0210be809c7..e498e834815 100644 --- a/config/locales/client.it.yml +++ b/config/locales/client.it.yml @@ -1002,7 +1002,6 @@ it: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "scrivi per filtrare..." admin: title: 'Amministrazione Discourse' diff --git a/config/locales/client.ko.yml b/config/locales/client.ko.yml index d3179c216e6..05baeaf3700 100644 --- a/config/locales/client.ko.yml +++ b/config/locales/client.ko.yml @@ -842,7 +842,6 @@ ko: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "필터를 입력하세요" admin: title: 'Discourse 관리자' diff --git a/config/locales/client.nb_NO.yml b/config/locales/client.nb_NO.yml index ea9aa4f78db..af3980aed4b 100644 --- a/config/locales/client.nb_NO.yml +++ b/config/locales/client.nb_NO.yml @@ -915,7 +915,6 @@ nb_NO: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "skriv for å filtrere..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.nl.yml b/config/locales/client.nl.yml index 5ec41bb05b9..a3e10ba8408 100644 --- a/config/locales/client.nl.yml +++ b/config/locales/client.nl.yml @@ -1015,7 +1015,6 @@ nl: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: typ om te filteren... admin: title: Discourse Beheer diff --git a/config/locales/client.pseudo.yml b/config/locales/client.pseudo.yml index 62d1143e543..0eec9a1fce6 100644 --- a/config/locales/client.pseudo.yml +++ b/config/locales/client.pseudo.yml @@ -970,7 +970,6 @@ pseudo: ƀřóŵšéř íš ťóó ółď ťó ŵóřǩ óɳ ťĥíš Ďíščóůřšé ƒóřůɱ. Рłéášé <á ĥřéƒ="ĥťťƿ://ƀřóŵšéĥáƿƿý.čóɱ">ůƿǧřáďé ýóůř ƀřóŵšéř. ]]' admin_js: - type_to_filter: '[[ ťýƿé ťó ƒíłťéř... ]]' admin: title: '[[ Ďíščóůřšé Áďɱíɳ ]]' moderator: '[[ Ϻóďéřáťóř ]]' diff --git a/config/locales/client.pt.yml b/config/locales/client.pt.yml index 71c4d30f957..aba023ae600 100644 --- a/config/locales/client.pt.yml +++ b/config/locales/client.pt.yml @@ -603,7 +603,6 @@ pt: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "escreve para filtrar..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.pt_BR.yml b/config/locales/client.pt_BR.yml index 6f10542926d..db223e0fa78 100644 --- a/config/locales/client.pt_BR.yml +++ b/config/locales/client.pt_BR.yml @@ -1070,7 +1070,6 @@ pt_BR: # Essa seção é para o javascript para i18n no admin admin_js: - type_to_filter: "escreva para filtrar..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.ru.yml b/config/locales/client.ru.yml index a7f4b838786..0bd03287860 100644 --- a/config/locales/client.ru.yml +++ b/config/locales/client.ru.yml @@ -1086,7 +1086,6 @@ ru: create_post: 'Отвечать / Просматривать' readonly: Просматривать admin_js: - type_to_filter: 'Введите текст для фильтрации...' admin: title: 'Discourse Admin' moderator: Модератор diff --git a/config/locales/client.sv.yml b/config/locales/client.sv.yml index 61d07e4a9df..48902e4ffcb 100644 --- a/config/locales/client.sv.yml +++ b/config/locales/client.sv.yml @@ -789,7 +789,6 @@ sv: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "skriv för att filtrera..." admin: title: 'Discourse Admin' diff --git a/config/locales/client.zh_CN.yml b/config/locales/client.zh_CN.yml index f0ae9982ebc..e11296d5ef0 100644 --- a/config/locales/client.zh_CN.yml +++ b/config/locales/client.zh_CN.yml @@ -213,7 +213,7 @@ zh_CN: moderator: "{{user}} 是版主" admin: "{{user}} 是管理员" deleted: "(已删除)" - + messages: all: "所有" mine: "我的" @@ -535,7 +535,7 @@ zh_CN: remote_tip_with_attachments: "输入图片或文件的网址,格式为:http://example.com/file.ext (支持的格式: {{authorized_extensions}})。" local_tip: "点击从你的设备中选择一张图片。" local_tip_with_attachments: "点击从你的设备中选择图片或文件(支持的格式: {{authorized_extensions}})。" - hint: "(你也可以通过拖放至编辑器的方式来上传)" + hint: "(你也可以通过拖放至编辑器的方式来上传)" hint_for_chrome: "(你也可以通过拖放或复制粘帖至编辑器的方式来上传)" uploading: "上传图片中" @@ -597,7 +597,7 @@ zh_CN: other: '{{count}}个新主题' unread_topics: one: '1个未读主题' - other: '{{count}}个未读主题' + other: '{{count}}个未读主题' title: '主题' loading_more: "载入更多主题中……" loading: '载入主题中……' @@ -1073,7 +1073,6 @@ zh_CN: # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "输入过滤条件……" admin: title: '论道 管理' diff --git a/config/locales/client.zh_TW.yml b/config/locales/client.zh_TW.yml index 560f1fe53b6..eb183dac379 100644 --- a/config/locales/client.zh_TW.yml +++ b/config/locales/client.zh_TW.yml @@ -969,7 +969,6 @@ zh_TW: readonly: "觀看" # This section is exported to the javascript for i18n in the admin section admin_js: - type_to_filter: "輸入過濾條件……" admin: title: '論道 管理'