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"}}
{{/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'>
<button {{action save this}} {{bindAttr disabled="disableSave"}} class='btn'>{{i18n admin.customize.save}}</button>
{{#unless automatic}}

View File

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

View File

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

View File

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

View File

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

View File

@ -47,13 +47,13 @@
<div class='input-prepend input-append' style="margin-top: 10px;">
<span class='color-title'>{{i18n category.background_color}}:</span>
<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 class='input-prepend input-append'>
<span class='color-title'>{{i18n category.foreground_color}}:</span>
<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>
</section>
@ -85,7 +85,7 @@
</div>
<div {{bindAttr class=":modal-tab :options-tab view.settingsSelected::invisible"}}>
<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 class='field'>

View File

@ -10,7 +10,9 @@
{{/if}}
{{#if view.editingTopic}}
<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-small' {{action cancelEdit target="view"}}><i class='icon-remove'></i></button>
{{else}}

View File

@ -52,7 +52,7 @@
<div class="control-group">
<label class="control-label">{{i18n user.bio}}</label>
<div class="controls">
{{view Discourse.PagedownEditor valueBinding="bio_raw"}}
{{pagedown value=bio_raw}}
</div>
</div>

View File

@ -18,4 +18,6 @@ Discourse.AutoCloseFormView = Ember.View.extend({
this.set('autoCloseDays', this.get('autoCloseDays').replace(/[^\d]/g, '') )
}
}.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
@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);

View File

@ -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);

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;
}
});
Discourse.Utilities.registerViewHelper('userSelector', Discourse.UserSelector);

View File

@ -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