diff --git a/app/assets/javascripts/admin/templates/groups.js.handlebars b/app/assets/javascripts/admin/templates/groups.js.handlebars index ea5070ef174..42969911470 100644 --- a/app/assets/javascripts/admin/templates/groups.js.handlebars +++ b/app/assets/javascripts/admin/templates/groups.js.handlebars @@ -25,7 +25,7 @@ {{textField value=name placeholderKey="admin.groups.name_placeholder"}} {{/if}} - {{view Discourse.UserSelector id="group-users" placeholderKey="admin.groups.selector_placeholder" tabindex="1" usernamesBinding="usernames"}} + {{userSelector usernames=usernames id="group-users" placeholderKey="admin.groups.selector_placeholder" tabindex="1"}}
{{#unless automatic}} diff --git a/app/assets/javascripts/admin/templates/site_content_edit.js.handlebars b/app/assets/javascripts/admin/templates/site_content_edit.js.handlebars index 20a2e3035e7..3add8e4c3f6 100644 --- a/app/assets/javascripts/admin/templates/site_content_edit.js.handlebars +++ b/app/assets/javascripts/admin/templates/site_content_edit.js.handlebars @@ -3,7 +3,7 @@

{{description}}

{{#if markdown}} - {{view Discourse.PagedownEditor valueBinding="model.content"}} + {{pagedown value=model.content}} {{/if}} {{#if plainText}} diff --git a/app/assets/javascripts/admin/views/ace_editor_view.js b/app/assets/javascripts/admin/views/ace_editor_view.js index 9c567f7e333..b5642d46ebe 100644 --- a/app/assets/javascripts/admin/views/ace_editor_view.js +++ b/app/assets/javascripts/admin/views/ace_editor_view.js @@ -57,4 +57,5 @@ Discourse.AceEditorView = Discourse.View.extend({ } }); + Discourse.Utilities.registerViewHelper('aceEditor', Discourse.AceEditorView); \ No newline at end of file diff --git a/app/assets/javascripts/discourse/templates/composer.js.handlebars b/app/assets/javascripts/discourse/templates/composer.js.handlebars index 102ff4b3195..01556f05e54 100644 --- a/app/assets/javascripts/discourse/templates/composer.js.handlebars +++ b/app/assets/javascripts/discourse/templates/composer.js.handlebars @@ -30,7 +30,13 @@ {{#if content.editTitle}}
{{#if content.creatingPrivateMessage}} - {{view Discourse.UserSelector topicIdBinding="controller.controllers.topic.content.id" excludeCurrentUser="true" id="private-message-users" class="span8" placeholderKey="composer.users_placeholder" tabindex="1" usernamesBinding="content.targetUsernames"}} + {{userSelector topicId=controller.controllers.topic.content.id + excludeCurrentUser="true" + id="private-message-users" + class="span8" + placeholderKey="composer.users_placeholder" + tabindex="1" + usernames=content.targetUsernames}} {{/if}}
@@ -40,7 +46,7 @@ {{#unless content.creatingPrivateMessage}}
- {{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="categories" valueBinding="content.categoryName" showUncategorized="true"}} + {{categoryChooser valueAttribute="name" value=content.categoryName showUncategorized="true"}} {{popupInputTip validation=view.categoryValidation shownAt=view.showCategoryTip}}
{{#if content.archetype.hasOptions}} @@ -53,7 +59,7 @@
- {{view Discourse.AutoCloseFormView autoCloseDaysBinding="content.auto_close_days"}} + {{autoCloseForm autoCloseDays=content.auto_close_days}}
{{/if}} diff --git a/app/assets/javascripts/discourse/templates/modal/auto_close.js.handlebars b/app/assets/javascripts/discourse/templates/modal/auto_close.js.handlebars index c43ab628289..5a946635135 100644 --- a/app/assets/javascripts/discourse/templates/modal/auto_close.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/auto_close.js.handlebars @@ -1,6 +1,6 @@ @@ -85,7 +85,7 @@
- {{view Discourse.AutoCloseFormView autoCloseDaysBinding="auto_close_days" labelKey="category.auto_close_label"}} + {{autoCloseForm autoCloseDays=auto_close_days labelKey="category.auto_close_label"}}
diff --git a/app/assets/javascripts/discourse/templates/topic.js.handlebars b/app/assets/javascripts/discourse/templates/topic.js.handlebars index f3444bf35e1..abf40bbfae7 100644 --- a/app/assets/javascripts/discourse/templates/topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/topic.js.handlebars @@ -10,7 +10,9 @@ {{/if}} {{#if view.editingTopic}} - {{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="categories" sourceBinding="view.topic.categoryName"}} + + {{categoryChooser valueAttribute="name" source=view.topic.categoryName}} + {{else}} diff --git a/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars b/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars index 1fc397467e6..fc8b8cd96ea 100644 --- a/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars +++ b/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars @@ -52,7 +52,7 @@
- {{view Discourse.PagedownEditor valueBinding="bio_raw"}} + {{pagedown value=bio_raw}}
diff --git a/app/assets/javascripts/discourse/views/auto_close_form_view.js b/app/assets/javascripts/discourse/views/auto_close_form_view.js index ccbe6a672f5..417b2c55f03 100644 --- a/app/assets/javascripts/discourse/views/auto_close_form_view.js +++ b/app/assets/javascripts/discourse/views/auto_close_form_view.js @@ -18,4 +18,6 @@ Discourse.AutoCloseFormView = Ember.View.extend({ this.set('autoCloseDays', this.get('autoCloseDays').replace(/[^\d]/g, '') ) } }.observes('autoCloseDays') -}); \ No newline at end of file +}); + +Discourse.Utilities.registerViewHelper('autoCloseForm', Discourse.AutoCloseFormView); \ No newline at end of file diff --git a/app/assets/javascripts/discourse/views/combobox_view_category.js b/app/assets/javascripts/discourse/views/category_chooser_view.js similarity index 80% rename from app/assets/javascripts/discourse/views/combobox_view_category.js rename to app/assets/javascripts/discourse/views/category_chooser_view.js index d2ddfdeb08f..7214fd39ca4 100644 --- a/app/assets/javascripts/discourse/views/combobox_view_category.js +++ b/app/assets/javascripts/discourse/views/category_chooser_view.js @@ -1,17 +1,22 @@ /** This view handles rendering of a combobox that can view a category - @class ComboboxViewCategory + @class CategoryChooserView @extends Discourse.ComboboxView @namespace Discourse @module Discourse **/ -Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({ +Discourse.CategoryChooserView = Discourse.ComboboxView.extend({ classNames: ['combobox category-combobox'], overrideWidths: true, dataAttributes: ['name', 'color', 'text_color', 'description', 'topic_count'], valueBinding: Ember.Binding.oneWay('source'), + init: function() { + this._super(); + this.set('content', Discourse.Category.list()); + }, + none: function() { if (Discourse.SiteSettings.allow_uncategorized_topics || this.get('showUncategorized')) return 'category.none'; }.property('showUncategorized'), @@ -29,4 +34,4 @@ Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({ }); - +Discourse.Utilities.registerViewHelper('categoryChooser', Discourse.CategoryChooserView); \ No newline at end of file diff --git a/app/assets/javascripts/discourse/views/modal/colors_view.js b/app/assets/javascripts/discourse/views/modal/color_picker_view.js similarity index 85% rename from app/assets/javascripts/discourse/views/modal/colors_view.js rename to app/assets/javascripts/discourse/views/modal/color_picker_view.js index 26d058c422c..3685a27aae9 100644 --- a/app/assets/javascripts/discourse/views/modal/colors_view.js +++ b/app/assets/javascripts/discourse/views/modal/color_picker_view.js @@ -1,12 +1,12 @@ /** This view shows an array of buttons for selection of a color from a predefined set. - @class ColorsView + @class ColorPickerView @extends Ember.ContainerView @namespace Discourse @module Discourse **/ -Discourse.ColorsView = Ember.ContainerView.extend({ +Discourse.ColorPickerView = Ember.ContainerView.extend({ classNames: 'colors-container', init: function() { @@ -35,3 +35,5 @@ Discourse.ColorsView = Ember.ContainerView.extend({ }); } }); + +Discourse.Utilities.registerViewHelper('colorPicker', Discourse.ColorPickerView); \ No newline at end of file diff --git a/app/assets/javascripts/discourse/views/pagedown_editor.js b/app/assets/javascripts/discourse/views/pagedown_editor.js index 30c3fb7fc68..7627a6acbae 100644 --- a/app/assets/javascripts/discourse/views/pagedown_editor.js +++ b/app/assets/javascripts/discourse/views/pagedown_editor.js @@ -44,4 +44,4 @@ Discourse.PagedownEditor = Ember.ContainerView.extend({ }); - +Discourse.Utilities.registerViewHelper('pagedown', Discourse.PagedownEditor); \ No newline at end of file diff --git a/app/assets/javascripts/discourse/views/user_selector_view.js b/app/assets/javascripts/discourse/views/user_selector_view.js index 3f07e9b3b93..47c78e0a87a 100644 --- a/app/assets/javascripts/discourse/views/user_selector_view.js +++ b/app/assets/javascripts/discourse/views/user_selector_view.js @@ -63,3 +63,5 @@ Discourse.UserSelector.reopenClass({ return this.compiled; } }); + +Discourse.Utilities.registerViewHelper('userSelector', Discourse.UserSelector); \ No newline at end of file diff --git a/app/assets/javascripts/main_include.js b/app/assets/javascripts/main_include.js index e08348face4..9db2985c2d5 100644 --- a/app/assets/javascripts/main_include.js +++ b/app/assets/javascripts/main_include.js @@ -16,6 +16,7 @@ //= require ./discourse/controllers/controller //= require ./discourse/controllers/object_controller //= require ./discourse/views/modal/modal_body_view +//= require ./discourse/views/combobox_view //= require ./discourse/models/model //= require ./discourse/routes/discourse_route //= require ./discourse/routes/discourse_restricted_user_route