This commit is contained in:
Robin Ward 2013-05-29 15:00:35 -04:00
parent 4d5c145198
commit 57d5355ce8
14 changed files with 39 additions and 18 deletions

View File

@ -25,7 +25,7 @@
{{textField value=name placeholderKey="admin.groups.name_placeholder"}} {{textField value=name placeholderKey="admin.groups.name_placeholder"}}
{{/if}} {{/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"}}
<div class='controls'> <div class='controls'>
<button {{action save this}} {{bindAttr disabled="disableSave"}} class='btn'>{{i18n admin.customize.save}}</button> <button {{action save this}} {{bindAttr disabled="disableSave"}} class='btn'>{{i18n admin.customize.save}}</button>
{{#unless automatic}} {{#unless automatic}}

View File

@ -3,7 +3,7 @@
<p class='description'>{{description}}</p> <p class='description'>{{description}}</p>
{{#if markdown}} {{#if markdown}}
{{view Discourse.PagedownEditor valueBinding="model.content"}} {{pagedown value=model.content}}
{{/if}} {{/if}}
{{#if plainText}} {{#if plainText}}

View File

@ -57,4 +57,5 @@ Discourse.AceEditorView = Discourse.View.extend({
} }
}); });
Discourse.Utilities.registerViewHelper('aceEditor', Discourse.AceEditorView); Discourse.Utilities.registerViewHelper('aceEditor', Discourse.AceEditorView);

View File

@ -30,7 +30,13 @@
{{#if content.editTitle}} {{#if content.editTitle}}
<div class='form-element clearfix'> <div class='form-element clearfix'>
{{#if content.creatingPrivateMessage}} {{#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}} {{/if}}
<div class="title-input"> <div class="title-input">
@ -40,7 +46,7 @@
{{#unless content.creatingPrivateMessage}} {{#unless content.creatingPrivateMessage}}
<div class="category-input"> <div class="category-input">
{{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}} {{popupInputTip validation=view.categoryValidation shownAt=view.showCategoryTip}}
</div> </div>
{{#if content.archetype.hasOptions}} {{#if content.archetype.hasOptions}}
@ -53,7 +59,7 @@
</div> </div>
<div class="admin-options-form"> <div class="admin-options-form">
{{view Discourse.AutoCloseFormView autoCloseDaysBinding="content.auto_close_days"}} {{autoCloseForm autoCloseDays=content.auto_close_days}}
</div> </div>
{{/if}} {{/if}}

View File

@ -1,6 +1,6 @@
<div class="modal-body"> <div class="modal-body">
<form> <form>
{{view Discourse.AutoCloseFormView autoCloseDaysBinding="view.auto_close_days"}} {{autoCloseForm autoCloseDays=view.auto_close_days}}
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">

View File

@ -47,13 +47,13 @@
<div class='input-prepend input-append' style="margin-top: 10px;"> <div class='input-prepend input-append' style="margin-top: 10px;">
<span class='color-title'>{{i18n category.background_color}}:</span> <span class='color-title'>{{i18n category.background_color}}:</span>
<span class='add-on'>#</span>{{textField value=color placeholderKey="category.color_placeholder" maxlength="6"}} <span class='add-on'>#</span>{{textField value=color placeholderKey="category.color_placeholder" maxlength="6"}}
{{view Discourse.ColorsView colorsBinding="view.backgroundColors" usedColorsBinding="view.usedBackgroundColors" valueBinding="color"}} {{colorPicker colors=view.backgroundColors usedColors=view.usedBackgroundColors value=color}}
</div> </div>
<div class='input-prepend input-append'> <div class='input-prepend input-append'>
<span class='color-title'>{{i18n category.foreground_color}}:</span> <span class='color-title'>{{i18n category.foreground_color}}:</span>
<span class='add-on'>#</span>{{textField value=text_color placeholderKey="category.color_placeholder" maxlength="6"}} <span class='add-on'>#</span>{{textField value=text_color placeholderKey="category.color_placeholder" maxlength="6"}}
{{view Discourse.ColorsView colorsBinding="view.foregroundColors" valueBinding="text_color"}} {{colorPicker colors=view.foregroundColors value=text_color}}
</div> </div>
</div> </div>
</section> </section>
@ -85,7 +85,7 @@
</div> </div>
<div {{bindAttr class=":modal-tab :options-tab view.settingsSelected::invisible"}}> <div {{bindAttr class=":modal-tab :options-tab view.settingsSelected::invisible"}}>
<section class='field'> <section class='field'>
{{view Discourse.AutoCloseFormView autoCloseDaysBinding="auto_close_days" labelKey="category.auto_close_label"}} {{autoCloseForm autoCloseDays=auto_close_days labelKey="category.auto_close_label"}}
</section> </section>
<section class='field'> <section class='field'>

View File

@ -10,7 +10,9 @@
{{/if}} {{/if}}
{{#if view.editingTopic}} {{#if view.editingTopic}}
<input id='edit-title' type='text' {{bindAttr value="view.topic.title"}} autofocus> <input id='edit-title' type='text' {{bindAttr value="view.topic.title"}} autofocus>
{{view Discourse.ComboboxViewCategory valueAttribute="name" contentBinding="categories" sourceBinding="view.topic.categoryName"}}
{{categoryChooser valueAttribute="name" source=view.topic.categoryName}}
<button class='btn btn-primary btn-small' {{action finishedEdit target="view"}}><i class='icon-ok'></i></button> <button class='btn btn-primary btn-small' {{action finishedEdit target="view"}}><i class='icon-ok'></i></button>
<button class='btn btn-small' {{action cancelEdit target="view"}}><i class='icon-remove'></i></button> <button class='btn btn-small' {{action cancelEdit target="view"}}><i class='icon-remove'></i></button>
{{else}} {{else}}

View File

@ -52,7 +52,7 @@
<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="bio_raw"}} {{pagedown value=bio_raw}}
</div> </div>
</div> </div>

View File

@ -18,4 +18,6 @@ Discourse.AutoCloseFormView = Ember.View.extend({
this.set('autoCloseDays', this.get('autoCloseDays').replace(/[^\d]/g, '') ) this.set('autoCloseDays', this.get('autoCloseDays').replace(/[^\d]/g, '') )
} }
}.observes('autoCloseDays') }.observes('autoCloseDays')
}); });
Discourse.Utilities.registerViewHelper('autoCloseForm', Discourse.AutoCloseFormView);

View File

@ -1,17 +1,22 @@
/** /**
This view handles rendering of a combobox that can view a category This view handles rendering of a combobox that can view a category
@class ComboboxViewCategory @class CategoryChooserView
@extends Discourse.ComboboxView @extends Discourse.ComboboxView
@namespace Discourse @namespace Discourse
@module Discourse @module Discourse
**/ **/
Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({ Discourse.CategoryChooserView = Discourse.ComboboxView.extend({
classNames: ['combobox category-combobox'], classNames: ['combobox category-combobox'],
overrideWidths: true, overrideWidths: true,
dataAttributes: ['name', 'color', 'text_color', 'description', 'topic_count'], dataAttributes: ['name', 'color', 'text_color', 'description', 'topic_count'],
valueBinding: Ember.Binding.oneWay('source'), valueBinding: Ember.Binding.oneWay('source'),
init: function() {
this._super();
this.set('content', Discourse.Category.list());
},
none: function() { none: function() {
if (Discourse.SiteSettings.allow_uncategorized_topics || this.get('showUncategorized')) return 'category.none'; if (Discourse.SiteSettings.allow_uncategorized_topics || this.get('showUncategorized')) return 'category.none';
}.property('showUncategorized'), }.property('showUncategorized'),
@ -29,4 +34,4 @@ Discourse.ComboboxViewCategory = Discourse.ComboboxView.extend({
}); });
Discourse.Utilities.registerViewHelper('categoryChooser', Discourse.CategoryChooserView);

View File

@ -1,12 +1,12 @@
/** /**
This view shows an array of buttons for selection of a color from a predefined set. This view shows an array of buttons for selection of a color from a predefined set.
@class ColorsView @class ColorPickerView
@extends Ember.ContainerView @extends Ember.ContainerView
@namespace Discourse @namespace Discourse
@module Discourse @module Discourse
**/ **/
Discourse.ColorsView = Ember.ContainerView.extend({ Discourse.ColorPickerView = Ember.ContainerView.extend({
classNames: 'colors-container', classNames: 'colors-container',
init: function() { init: function() {
@ -35,3 +35,5 @@ Discourse.ColorsView = Ember.ContainerView.extend({
}); });
} }
}); });
Discourse.Utilities.registerViewHelper('colorPicker', Discourse.ColorPickerView);

View File

@ -44,4 +44,4 @@ Discourse.PagedownEditor = Ember.ContainerView.extend({
}); });
Discourse.Utilities.registerViewHelper('pagedown', Discourse.PagedownEditor);

View File

@ -63,3 +63,5 @@ Discourse.UserSelector.reopenClass({
return this.compiled; return this.compiled;
} }
}); });
Discourse.Utilities.registerViewHelper('userSelector', Discourse.UserSelector);

View File

@ -16,6 +16,7 @@
//= require ./discourse/controllers/controller //= require ./discourse/controllers/controller
//= require ./discourse/controllers/object_controller //= require ./discourse/controllers/object_controller
//= require ./discourse/views/modal/modal_body_view //= require ./discourse/views/modal/modal_body_view
//= require ./discourse/views/combobox_view
//= require ./discourse/models/model //= require ./discourse/models/model
//= require ./discourse/routes/discourse_route //= require ./discourse/routes/discourse_route
//= require ./discourse/routes/discourse_restricted_user_route //= require ./discourse/routes/discourse_restricted_user_route