From 580a1bf8b0f1fb47dd1cfbb52db5c65668cbf47b Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 10 Jun 2014 11:54:38 -0400 Subject: [PATCH] ES6: Migrated and deprecated a bunch of views --- .../admin_github_commits_controller.js | 2 +- ...n_logs_screened_ip_addresses_controller.js | 2 +- .../controllers/admin_reports_controller.js | 2 +- .../admin_site_content_edit_controller.js | 2 +- .../admin/helpers/report_helpers.js | 2 +- .../admin/routes/admin_customize_route.js | 2 +- .../admin/routes/admin_logs_routes.js | 2 +- .../admin/routes/admin_reports_route.js | 2 +- .../templates/customize_colors.js.handlebars | 4 +- .../customize_css_html.js.handlebars | 2 +- .../admin/templates/email_all.js.handlebars | 8 +- .../admin/templates/email_index.js.handlebars | 2 +- .../admin/templates/email_sent.js.handlebars | 8 +- .../templates/email_skipped.js.handlebars | 8 +- .../admin/templates/group.js.handlebars | 4 +- ...eened_ip_addresses_list_item.js.handlebars | 2 +- .../modal/admin_suspend_user.js.handlebars | 4 +- .../templates/site_settings.js.handlebars | 2 +- .../setting_string.js.handlebars | 2 +- .../admin/templates/user.js.handlebars | 2 +- .../admin/templates/user_index.js.handlebars | 2 +- .../admin/templates/users_list.js.handlebars | 2 +- .../views/report/admin_report_counts_view.js | 2 +- .../discourse/ember/event_dispatcher.js | 2 +- .../discourse/helpers/grouped_each.js | 2 +- .../initializers/deprecations.js.es6 | 4 +- .../initializers/view-helpers.js.es6 | 6 +- .../javascripts/discourse/mixins/scrolling.js | 2 +- .../discourse/models/composer_message.js | 2 +- .../discourse/models/trust_level.js | 2 +- .../discourse/routes/user_invited_route.js | 2 +- ...tegory_notification_dropdown.js.handlebars | 2 +- .../templates/choose_topic.js.handlebars | 2 +- .../components/auto-close-form.js.handlebars | 2 +- .../components/color-input.js.handlebars | 2 +- .../screened-ip-address-form.handlebars | 2 +- .../templates/composer.js.handlebars | 20 +- .../mobile/modal/login.js.handlebars | 4 +- .../modal/change_owner.js.handlebars | 2 +- .../modal/create_account.js.handlebars | 2 +- .../modal/edit_category.js.handlebars | 12 +- .../modal/forgot_password.js.handlebars | 2 +- .../templates/modal/invite.js.handlebars | 2 +- .../modal/invite_private.js.handlebars | 2 +- .../templates/modal/login.js.handlebars | 4 +- .../templates/modal/split_topic.js.handlebars | 2 +- .../discourse/templates/search.js.handlebars | 2 +- .../discourse/templates/topic.js.handlebars | 2 +- .../templates/user/email.js.handlebars | 2 +- .../templates/user/invited.js.handlebars | 2 +- .../templates/user/preferences.js.handlebars | 2 +- .../templates/user/username.js.handlebars | 2 +- .../views/buttons/invite_reply_button.js | 2 +- .../views/buttons/login_reply_button.js | 2 +- .../discourse/views/composer/composer_view.js | 2 +- .../discourse/views/container_view.js | 2 +- ...text_field.js => search-text-field.js.es6} | 8 +- ...course_text_field.js => text-field.js.es6} | 5 +- .../discourse/views/user-selector.js.es6 | 108 +++++++++++ .../discourse/views/user_selector_view.js | 103 ---------- app/assets/javascripts/main_include.js | 1 + test/javascripts/templates/search_test.js | 181 ------------------ .../views/search_text_field_test.js | 4 +- test/javascripts/views/text_field_test.js | 4 +- 64 files changed, 206 insertions(+), 382 deletions(-) rename app/assets/javascripts/discourse/views/{search/search_text_field.js => search-text-field.js.es6} (89%) rename app/assets/javascripts/discourse/views/{discourse_text_field.js => text-field.js.es6} (78%) create mode 100644 app/assets/javascripts/discourse/views/user-selector.js.es6 delete mode 100644 app/assets/javascripts/discourse/views/user_selector_view.js delete mode 100644 test/javascripts/templates/search_test.js diff --git a/app/assets/javascripts/admin/controllers/admin_github_commits_controller.js b/app/assets/javascripts/admin/controllers/admin_github_commits_controller.js index 0a6bd38ea..5e8a7f57c 100644 --- a/app/assets/javascripts/admin/controllers/admin_github_commits_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_github_commits_controller.js @@ -10,4 +10,4 @@ Discourse.AdminGithubCommitsController = Ember.ArrayController.extend({ goToGithub: function() { window.open('https://github.com/discourse/discourse'); } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/admin/controllers/admin_logs_screened_ip_addresses_controller.js b/app/assets/javascripts/admin/controllers/admin_logs_screened_ip_addresses_controller.js index bbf06d699..1e39d95a3 100644 --- a/app/assets/javascripts/admin/controllers/admin_logs_screened_ip_addresses_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_logs_screened_ip_addresses_controller.js @@ -94,4 +94,4 @@ Discourse.AdminLogsScreenedIpAddressController = Ember.ObjectController.extend({ }); } } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/admin/controllers/admin_reports_controller.js b/app/assets/javascripts/admin/controllers/admin_reports_controller.js index 35fb54b74..80252b49e 100644 --- a/app/assets/javascripts/admin/controllers/admin_reports_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_reports_controller.js @@ -16,4 +16,4 @@ Discourse.AdminReportsController = Ember.ObjectController.extend({ } } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/admin/controllers/admin_site_content_edit_controller.js b/app/assets/javascripts/admin/controllers/admin_site_content_edit_controller.js index 68e5b6d3a..185ea0818 100644 --- a/app/assets/javascripts/admin/controllers/admin_site_content_edit_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_site_content_edit_controller.js @@ -25,4 +25,4 @@ Discourse.AdminSiteContentEditController = Discourse.Controller.extend({ } }); -Discourse.AdminSiteContentsController = Ember.ArrayController.extend({}); \ No newline at end of file +Discourse.AdminSiteContentsController = Ember.ArrayController.extend({}); diff --git a/app/assets/javascripts/admin/helpers/report_helpers.js b/app/assets/javascripts/admin/helpers/report_helpers.js index 270adc2c1..5d0ee1ac4 100644 --- a/app/assets/javascripts/admin/helpers/report_helpers.js +++ b/app/assets/javascripts/admin/helpers/report_helpers.js @@ -14,4 +14,4 @@ Handlebars.registerHelper('valueAtTrustLevel', function(property, trustLevel) { return 0; } } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/admin/routes/admin_customize_route.js b/app/assets/javascripts/admin/routes/admin_customize_route.js index 701a03fe5..bb07dd524 100644 --- a/app/assets/javascripts/admin/routes/admin_customize_route.js +++ b/app/assets/javascripts/admin/routes/admin_customize_route.js @@ -10,4 +10,4 @@ Discourse.AdminCustomizeIndexRoute = Discourse.Route.extend({ redirect: function() { this.transitionTo('adminCustomize.colors'); } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/admin/routes/admin_logs_routes.js b/app/assets/javascripts/admin/routes/admin_logs_routes.js index 0ac57941d..2a7dc7230 100644 --- a/app/assets/javascripts/admin/routes/admin_logs_routes.js +++ b/app/assets/javascripts/admin/routes/admin_logs_routes.js @@ -105,4 +105,4 @@ Discourse.AdminLogsScreenedUrlsRoute = Discourse.Route.extend({ setupController: function() { return this.controllerFor('adminLogsScreenedUrls').show(); } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/admin/routes/admin_reports_route.js b/app/assets/javascripts/admin/routes/admin_reports_route.js index 2e9ab9d7c..cdc06720e 100644 --- a/app/assets/javascripts/admin/routes/admin_reports_route.js +++ b/app/assets/javascripts/admin/routes/admin_reports_route.js @@ -10,4 +10,4 @@ Discourse.AdminReportsRoute = Discourse.Route.extend({ model: function(params) { return Discourse.Report.find(params.type); } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/admin/templates/customize_colors.js.handlebars b/app/assets/javascripts/admin/templates/customize_colors.js.handlebars index 006dde6fc..0b9c6e138 100644 --- a/app/assets/javascripts/admin/templates/customize_colors.js.handlebars +++ b/app/assets/javascripts/admin/templates/customize_colors.js.handlebars @@ -14,7 +14,7 @@
{{#with selectedItem}} -

{{textField class="style-name" value=name}}

+

{{text-field class="style-name" value=name}}

@@ -75,4 +75,4 @@
{{else}}

{{i18n admin.customize.colors.about}}

-{{/if}} \ No newline at end of file +{{/if}} diff --git a/app/assets/javascripts/admin/templates/customize_css_html.js.handlebars b/app/assets/javascripts/admin/templates/customize_css_html.js.handlebars index db0cb92bd..3323c13ba 100644 --- a/app/assets/javascripts/admin/templates/customize_css_html.js.handlebars +++ b/app/assets/javascripts/admin/templates/customize_css_html.js.handlebars @@ -12,7 +12,7 @@ {{#if selectedItem}}
{{#with selectedItem}} - {{textField class="style-name" value=name}} + {{text-field class="style-name" value=name}}
- {{textField value=username placeholderKey="username"}} + {{text-field value=username placeholderKey="username"}}
diff --git a/app/assets/javascripts/admin/views/report/admin_report_counts_view.js b/app/assets/javascripts/admin/views/report/admin_report_counts_view.js index 0ef5d9961..fb7bb9c62 100644 --- a/app/assets/javascripts/admin/views/report/admin_report_counts_view.js +++ b/app/assets/javascripts/admin/views/report/admin_report_counts_view.js @@ -1,4 +1,4 @@ Discourse.AdminReportCountsView = Discourse.View.extend({ templateName: 'admin/templates/reports/summed_counts_report', tagName: 'tbody' -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/discourse/ember/event_dispatcher.js b/app/assets/javascripts/discourse/ember/event_dispatcher.js index 700186f31..7e5cea6fc 100644 --- a/app/assets/javascripts/discourse/ember/event_dispatcher.js +++ b/app/assets/javascripts/discourse/ember/event_dispatcher.js @@ -30,4 +30,4 @@ Ember.EventDispatcher.reopen({ drop : 'drop', dragend : 'dragEnd' } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/discourse/helpers/grouped_each.js b/app/assets/javascripts/discourse/helpers/grouped_each.js index 86c3ce13d..d730ede8f 100644 --- a/app/assets/javascripts/discourse/helpers/grouped_each.js +++ b/app/assets/javascripts/discourse/helpers/grouped_each.js @@ -130,4 +130,4 @@ Ember.Handlebars.registerHelper('groupedEach', function(path, options) { options.hash.dataSourceBinding = path; options.data.insideGroup = true; new DiscourseGroupedEach(this, path, options).render(); -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/discourse/initializers/deprecations.js.es6 b/app/assets/javascripts/discourse/initializers/deprecations.js.es6 index 2850b6da4..2bb573313 100644 --- a/app/assets/javascripts/discourse/initializers/deprecations.js.es6 +++ b/app/assets/javascripts/discourse/initializers/deprecations.js.es6 @@ -1,6 +1,8 @@ var deprecatedViewHelpers = { inputTip: 'input-tip', - pagedown: 'pagedown-editor' + pagedown: 'pagedown-editor', + textField: 'text-field', + userSelector: 'user-selector' }; export default { diff --git a/app/assets/javascripts/discourse/initializers/view-helpers.js.es6 b/app/assets/javascripts/discourse/initializers/view-helpers.js.es6 index d4014b32f..2c5d144af 100644 --- a/app/assets/javascripts/discourse/initializers/view-helpers.js.es6 +++ b/app/assets/javascripts/discourse/initializers/view-helpers.js.es6 @@ -1,4 +1,4 @@ -var helpers = ['input-tip', 'pagedown-editor']; +var helpers = ['input-tip', 'pagedown-editor', 'text-field', 'user-selector']; /** Creates view helpers for some views. Many of these should probably be converted @@ -9,8 +9,8 @@ export default { initialize: function(container) { helpers.forEach(function(h) { Ember.Handlebars.registerHelper(h, function(options) { - var helper = container.lookupFactory('view:' + h); - var hash = options.hash, + var helper = container.lookupFactory('view:' + h), + hash = options.hash, types = options.hashTypes; Discourse.Utilities.normalizeHash(hash, types); diff --git a/app/assets/javascripts/discourse/mixins/scrolling.js b/app/assets/javascripts/discourse/mixins/scrolling.js index ff3f1b656..b86631de2 100644 --- a/app/assets/javascripts/discourse/mixins/scrolling.js +++ b/app/assets/javascripts/discourse/mixins/scrolling.js @@ -65,4 +65,4 @@ Discourse.ScrollingDOMMethods = { $(document).unbind('touchmove.discourse-' + name); } -}; \ No newline at end of file +}; diff --git a/app/assets/javascripts/discourse/models/composer_message.js b/app/assets/javascripts/discourse/models/composer_message.js index fc445340e..106a4d12b 100644 --- a/app/assets/javascripts/discourse/models/composer_message.js +++ b/app/assets/javascripts/discourse/models/composer_message.js @@ -32,4 +32,4 @@ Discourse.ComposerMessage.reopenClass({ }); } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/discourse/models/trust_level.js b/app/assets/javascripts/discourse/models/trust_level.js index 673077b40..869401011 100644 --- a/app/assets/javascripts/discourse/models/trust_level.js +++ b/app/assets/javascripts/discourse/models/trust_level.js @@ -8,4 +8,4 @@ **/ Discourse.TrustLevel = Discourse.Model.extend({ detailedName: Discourse.computed.fmt('id', 'name', '%@ - %@') -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/discourse/routes/user_invited_route.js b/app/assets/javascripts/discourse/routes/user_invited_route.js index 98afbdaad..3856e383a 100644 --- a/app/assets/javascripts/discourse/routes/user_invited_route.js +++ b/app/assets/javascripts/discourse/routes/user_invited_route.js @@ -37,4 +37,4 @@ Discourse.UserInvitedRoute = Discourse.Route.extend({ } } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/discourse/templates/category_notification_dropdown.js.handlebars b/app/assets/javascripts/discourse/templates/category_notification_dropdown.js.handlebars index dbf82240a..22d91f0f7 100644 --- a/app/assets/javascripts/discourse/templates/category_notification_dropdown.js.handlebars +++ b/app/assets/javascripts/discourse/templates/category_notification_dropdown.js.handlebars @@ -14,4 +14,4 @@ {{/each}} -
\ No newline at end of file +
diff --git a/app/assets/javascripts/discourse/templates/choose_topic.js.handlebars b/app/assets/javascripts/discourse/templates/choose_topic.js.handlebars index 7f9cbf879..a26ad3767 100644 --- a/app/assets/javascripts/discourse/templates/choose_topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/choose_topic.js.handlebars @@ -1,6 +1,6 @@ -{{textField value=view.topicTitle placeholderKey="choose_topic.title.placeholder" id="choose-topic-title"}} +{{text-field value=view.topicTitle placeholderKey="choose_topic.title.placeholder" id="choose-topic-title"}} {{#if view.loading}}

{{i18n loading}}

diff --git a/app/assets/javascripts/discourse/templates/components/auto-close-form.js.handlebars b/app/assets/javascripts/discourse/templates/components/auto-close-form.js.handlebars index 3493a3d89..11479923a 100644 --- a/app/assets/javascripts/discourse/templates/components/auto-close-form.js.handlebars +++ b/app/assets/javascripts/discourse/templates/components/auto-close-form.js.handlebars @@ -2,7 +2,7 @@
{{label}} - {{textField value=autoCloseTime}} + {{text-field value=autoCloseTime}} {{i18n composer.auto_close_units}}
diff --git a/app/assets/javascripts/discourse/templates/components/color-input.js.handlebars b/app/assets/javascripts/discourse/templates/components/color-input.js.handlebars index 18e2b107c..e69d19d7e 100644 --- a/app/assets/javascripts/discourse/templates/components/color-input.js.handlebars +++ b/app/assets/javascripts/discourse/templates/components/color-input.js.handlebars @@ -1 +1 @@ -{{textField class="hex-input" value=hexValue maxlength="6"}} +{{text-field class="hex-input" value=hexValue maxlength="6"}} diff --git a/app/assets/javascripts/discourse/templates/components/screened-ip-address-form.handlebars b/app/assets/javascripts/discourse/templates/components/screened-ip-address-form.handlebars index 883c21b13..9635dd3e5 100644 --- a/app/assets/javascripts/discourse/templates/components/screened-ip-address-form.handlebars +++ b/app/assets/javascripts/discourse/templates/components/screened-ip-address-form.handlebars @@ -1,4 +1,4 @@ {{i18n admin.logs.screened_ips.form.label}} -{{textField value=ip_address disabled=formSubmitted class="ip-address-input" placeholderKey="admin.logs.screened_ips.form.ip_address" autocorrect="off" autocapitalize="off"}} +{{text-field value=ip_address disabled=formSubmitted class="ip-address-input" placeholderKey="admin.logs.screened_ips.form.ip_address" autocorrect="off" autocapitalize="off"}} {{combobox content=actionNames value=actionName}} diff --git a/app/assets/javascripts/discourse/templates/composer.js.handlebars b/app/assets/javascripts/discourse/templates/composer.js.handlebars index af51ac696..12b3cc8cf 100644 --- a/app/assets/javascripts/discourse/templates/composer.js.handlebars +++ b/app/assets/javascripts/discourse/templates/composer.js.handlebars @@ -16,7 +16,7 @@ {{#if canEdit}} {{#if showEditReason}}
- {{textField value=editReason tabindex="5" id="edit-reason" maxlength="255" placeholderKey="composer.edit_reason_placeholder"}} + {{text-field value=editReason tabindex="5" id="edit-reason" maxlength="255" placeholderKey="composer.edit_reason_placeholder"}}
{{else}} {{i18n composer.show_edit_reason}} @@ -27,18 +27,18 @@ {{#if model.canEditTitle}}
{{#if model.creatingPrivateMessage}} - {{userSelector topicId=controller.controllers.topic.model.id - excludeCurrentUser="true" - id="private-message-users" - include_groups="true" - class="span8" - placeholderKey="composer.users_placeholder" - tabindex="1" - usernames=model.targetUsernames}} + {{user-selector topicId=controller.controllers.topic.model.id + excludeCurrentUser="true" + id="private-message-users" + include_groups="true" + class="span8" + placeholderKey="composer.users_placeholder" + tabindex="1" + usernames=model.targetUsernames}} {{/if}}
- {{textField value=model.title tabindex="2" id="reply-title" maxlength="255" placeholderKey="composer.title_placeholder"}} + {{text-field value=model.title tabindex="2" id="reply-title" maxlength="255" placeholderKey="composer.title_placeholder"}} {{popupInputTip validation=view.titleValidation shownAt=view.showTitleTip}}
diff --git a/app/assets/javascripts/discourse/templates/mobile/modal/login.js.handlebars b/app/assets/javascripts/discourse/templates/mobile/modal/login.js.handlebars index 644dd2221..d9e39cbec 100644 --- a/app/assets/javascripts/discourse/templates/mobile/modal/login.js.handlebars +++ b/app/assets/javascripts/discourse/templates/mobile/modal/login.js.handlebars @@ -19,7 +19,7 @@ - {{textField value=loginName placeholderKey="login.email_placeholder" id="login-account-name" autocorrect="off" autocapitalize="off"}} + {{text-field value=loginName placeholderKey="login.email_placeholder" id="login-account-name" autocorrect="off" autocapitalize="off"}} @@ -27,7 +27,7 @@ - {{textField value=loginPassword type="password" id="login-account-password"}}   + {{text-field value=loginPassword type="password" id="login-account-password"}}   diff --git a/app/assets/javascripts/discourse/templates/modal/change_owner.js.handlebars b/app/assets/javascripts/discourse/templates/modal/change_owner.js.handlebars index bcf7469d0..6a4ebc637 100644 --- a/app/assets/javascripts/discourse/templates/modal/change_owner.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/change_owner.js.handlebars @@ -6,7 +6,7 @@
- {{userSelector single=true usernames=new_user include_groups="false" placeholderKey="topic.change_owner.placeholder"}} + {{user-selector single=true usernames=new_user include_groups="false" placeholderKey="topic.change_owner.placeholder"}}
diff --git a/app/assets/javascripts/discourse/templates/modal/create_account.js.handlebars b/app/assets/javascripts/discourse/templates/modal/create_account.js.handlebars index 17328de77..878d200cd 100644 --- a/app/assets/javascripts/discourse/templates/modal/create_account.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/create_account.js.handlebars @@ -6,7 +6,7 @@ - {{textField value=accountName id="new-account-name" autofocus="autofocus"}} + {{text-field value=accountName id="new-account-name" autofocus="autofocus"}}  {{input-tip validation=nameValidation}} diff --git a/app/assets/javascripts/discourse/templates/modal/edit_category.js.handlebars b/app/assets/javascripts/discourse/templates/modal/edit_category.js.handlebars index 3b8fb414d..29a85c42d 100644 --- a/app/assets/javascripts/discourse/templates/modal/edit_category.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/edit_category.js.handlebars @@ -18,7 +18,7 @@
- {{textField value=name placeholderKey="category.name_placeholder" maxlength="50"}} + {{text-field value=name placeholderKey="category.name_placeholder" maxlength="50"}}
@@ -56,13 +56,13 @@
{{i18n category.background_color}}: - #{{textField value=color placeholderKey="category.color_placeholder" maxlength="6"}} + #{{text-field value=color placeholderKey="category.color_placeholder" maxlength="6"}} {{colorPicker colors=backgroundColors usedColors=usedBackgroundColors value=color}}
{{i18n category.foreground_color}}: - #{{textField value=text_color placeholderKey="category.color_placeholder" maxlength="6"}} + #{{text-field value=text_color placeholderKey="category.color_placeholder" maxlength="6"}} {{colorPicker colors=foregroundColors value=text_color}}
@@ -99,7 +99,7 @@
{{i18n category.auto_close_label}} - {{textField value=auto_close_hours}} + {{text-field value=auto_close_hours}} {{i18n category.auto_close_units}}
@@ -111,7 +111,7 @@
{{i18n category.email_in}} - {{textField value=email_in}} + {{text-field value=email_in}}