mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
ES6: Convert a couple view helpers. They should probably be components
evnetually!
This commit is contained in:
parent
18489ba83a
commit
f822491886
17 changed files with 30 additions and 25 deletions
|
@ -18,7 +18,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">{{i18n groups.alias_levels.title}}</label>
|
<label class="control-label">{{i18n groups.alias_levels.title}}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
{{combobox valueAttribute="value" value=alias_level content=aliasLevelOptions}}
|
{{combo-box valueAttribute="value" value=alias_level content=aliasLevelOptions}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<h3>{{unbound settingName}}</h3>
|
<h3>{{unbound settingName}}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combobox valueAttribute="value" content=validValues value=value none=allowsNone}}
|
{{combo-box valueAttribute="value" content=validValues value=value none=allowsNone}}
|
||||||
<div class='desc'>{{unbound description}}</div>
|
<div class='desc'>{{unbound description}}</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if dirty}}
|
{{#if dirty}}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<p>{{i18n admin.badges.no_badges}}</p>
|
<p>{{i18n admin.badges.no_badges}}</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
<br>
|
<br>
|
||||||
{{combobox valueAttribute="id" value=controller.selectedBadgeId content=controller.grantableBadges}}
|
{{combo-box valueAttribute="id" value=controller.selectedBadgeId content=controller.grantableBadges}}
|
||||||
<button class='btn btn-primary' {{action grantBadge controller.selectedBadgeId}}>{{i18n admin.badges.grant}}</button>
|
<button class='btn btn-primary' {{action grantBadge controller.selectedBadgeId}}>{{i18n admin.badges.grant}}</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
<div class='field'>{{i18n admin.groups.primary}}</div>
|
<div class='field'>{{i18n admin.groups.primary}}</div>
|
||||||
<div class='value'>
|
<div class='value'>
|
||||||
{{#if custom_groups}}
|
{{#if custom_groups}}
|
||||||
{{combobox content=custom_groups value=primary_group_id nameProperty="name" none="admin.groups.no_primary"}}
|
{{combo-box content=custom_groups value=primary_group_id nameProperty="name" none="admin.groups.no_primary"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
—
|
—
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -229,7 +229,7 @@
|
||||||
<div class='display-row'>
|
<div class='display-row'>
|
||||||
<div class='field'>{{i18n trust_level}}</div>
|
<div class='field'>{{i18n trust_level}}</div>
|
||||||
<div class="value">
|
<div class="value">
|
||||||
{{combobox content=trustLevels value=trust_level nameProperty="detailedName"}}
|
{{combo-box content=trustLevels value=trust_level nameProperty="detailedName"}}
|
||||||
</div>
|
</div>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
{{#if leaderRequirements}}
|
{{#if leaderRequirements}}
|
||||||
|
|
|
@ -2,7 +2,9 @@ var deprecatedViewHelpers = {
|
||||||
inputTip: 'input-tip',
|
inputTip: 'input-tip',
|
||||||
pagedown: 'pagedown-editor',
|
pagedown: 'pagedown-editor',
|
||||||
textField: 'text-field',
|
textField: 'text-field',
|
||||||
userSelector: 'user-selector'
|
userSelector: 'user-selector',
|
||||||
|
combobox: 'combo-box',
|
||||||
|
categoryChooser: 'category-chooser'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
var helpers = ['input-tip', 'pagedown-editor', 'text-field', 'user-selector'];
|
var helpers = ['input-tip',
|
||||||
|
'pagedown-editor',
|
||||||
|
'text-field',
|
||||||
|
'user-selector',
|
||||||
|
'category-chooser',
|
||||||
|
'combo-box'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates view helpers for some views. Many of these should probably be converted
|
Creates view helpers for some views. Many of these should probably be converted
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<b>{{i18n admin.logs.screened_ips.form.label}}</b>
|
<b>{{i18n admin.logs.screened_ips.form.label}}</b>
|
||||||
{{text-field 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}}
|
{{combo-box content=actionNames value=actionName}}
|
||||||
<button class="btn btn-small" {{action submit target="view"}} {{bind-attr disabled="formSubmitted"}}>{{i18n admin.logs.screened_ips.form.add}}</button>
|
<button class="btn btn-small" {{action submit target="view"}} {{bind-attr disabled="formSubmitted"}}>{{i18n admin.logs.screened_ips.form.add}}</button>
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
{{#unless model.privateMessage}}
|
{{#unless model.privateMessage}}
|
||||||
<div class="category-input">
|
<div class="category-input">
|
||||||
{{categoryChooser valueAttribute="id" value=model.categoryId}}
|
{{category-chooser valueAttribute="id" value=model.categoryId}}
|
||||||
{{popupInputTip validation=view.categoryValidation shownAt=view.showCategoryTip}}
|
{{popupInputTip validation=view.categoryValidation shownAt=view.showCategoryTip}}
|
||||||
</div>
|
</div>
|
||||||
{{#if model.archetype.hasOptions}}
|
{{#if model.archetype.hasOptions}}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<p>Choose the new category for the topics:</p>
|
<p>Choose the new category for the topics:</p>
|
||||||
|
|
||||||
<p>{{categoryChooser value=newCategoryId}}</p>
|
<p>{{category-chooser value=newCategoryId}}</p>
|
||||||
|
|
||||||
{{#if loading}}
|
{{#if loading}}
|
||||||
<div class='loading'>{{i18n loading}}</div>
|
<div class='loading'>{{i18n loading}}</div>
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<label>{{i18n category.parent}}</label>
|
<label>{{i18n category.parent}}</label>
|
||||||
{{categoryChooser valueAttribute="id" value=parent_category_id categories=parentCategories rootNone=true}}
|
{{category-chooser valueAttribute="id" value=parent_category_id categories=parentCategories rootNone=true}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
{{text-field value=topicName placeholderKey="composer.title_placeholder" elementId='split-topic-name'}}
|
{{text-field value=topicName placeholderKey="composer.title_placeholder" elementId='split-topic-name'}}
|
||||||
|
|
||||||
<label>{{i18n categories.category}}</label>
|
<label>{{i18n categories.category}}</label>
|
||||||
{{categoryChooser value=categoryId}}
|
{{category-chooser value=categoryId}}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
{{#if isPrivateMessage}}
|
{{#if isPrivateMessage}}
|
||||||
<span class="private-message-glyph"><i class='fa fa-envelope'></i></span>
|
<span class="private-message-glyph"><i class='fa fa-envelope'></i></span>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{categoryChooser valueAttribute="id" value=newCategoryId source=category_id}}
|
{{category-chooser valueAttribute="id" value=newCategoryId source=category_id}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{text-field id='edit-title' value=newTitle}}
|
{{text-field id='edit-title' value=newTitle}}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">{{i18n badges.title}}</label>
|
<label class="control-label">{{i18n badges.title}}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
{{combobox valueAttribute="id" value=selectedUserBadgeId nameProperty="badge.name" content=selectableUserBadges}}
|
{{combo-box valueAttribute="id" value=selectedUserBadgeId nameProperty="badge.name" content=selectableUserBadges}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">{{i18n user.locale.title}}</label>
|
<label class="control-label">{{i18n user.locale.title}}</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
{{combobox valueAttribute="value" content=availableLocales value=locale none="user.locale.default"}}
|
{{combo-box valueAttribute="value" content=availableLocales value=locale none="user.locale.default"}}
|
||||||
</div>
|
</div>
|
||||||
<div class='instructions'>
|
<div class='instructions'>
|
||||||
{{i18n user.locale.instructions}}
|
{{i18n user.locale.instructions}}
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
{{preference-checkbox labelKey="user.email_digests.title" checked=email_digests}}
|
{{preference-checkbox labelKey="user.email_digests.title" checked=email_digests}}
|
||||||
{{#if email_digests}}
|
{{#if email_digests}}
|
||||||
<div class='controls controls-dropdown'>
|
<div class='controls controls-dropdown'>
|
||||||
{{combobox valueAttribute="value" content=digestFrequencies value=digest_after_days}}
|
{{combo-box valueAttribute="value" content=digestFrequencies value=digest_after_days}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{preference-checkbox labelKey="user.email_private_messages" checked=email_private_messages}}
|
{{preference-checkbox labelKey="user.email_private_messages" checked=email_private_messages}}
|
||||||
|
@ -163,12 +163,12 @@
|
||||||
<label class="control-label">{{i18n user.other_settings}}</label>
|
<label class="control-label">{{i18n user.other_settings}}</label>
|
||||||
<div class="controls controls-dropdown">
|
<div class="controls controls-dropdown">
|
||||||
<label>{{i18n user.auto_track_topics}}</label>
|
<label>{{i18n user.auto_track_topics}}</label>
|
||||||
{{combobox valueAttribute="value" content=autoTrackDurations value=auto_track_topics_after_msecs}}
|
{{combo-box valueAttribute="value" content=autoTrackDurations value=auto_track_topics_after_msecs}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="controls controls-dropdown">
|
<div class="controls controls-dropdown">
|
||||||
<label>{{i18n user.new_topic_duration.label}}</label>
|
<label>{{i18n user.new_topic_duration.label}}</label>
|
||||||
{{combobox valueAttribute="value" content=considerNewTopicOptions value=new_topic_duration_minutes}}
|
{{combo-box valueAttribute="value" content=considerNewTopicOptions value=new_topic_duration_minutes}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{preference-checkbox labelKey="user.external_links_in_new_tab" checked=external_links_in_new_tab}}
|
{{preference-checkbox labelKey="user.external_links_in_new_tab" checked=external_links_in_new_tab}}
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
@namespace Discourse
|
@namespace Discourse
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.CategoryChooserView = Discourse.ComboboxView.extend({
|
import ComboboxView from 'discourse/views/combo-box';
|
||||||
|
|
||||||
|
export default ComboboxView.extend({
|
||||||
classNames: ['combobox category-combobox'],
|
classNames: ['combobox category-combobox'],
|
||||||
overrideWidths: true,
|
overrideWidths: true,
|
||||||
dataAttributes: ['id', 'description_text'],
|
dataAttributes: ['id', 'description_text'],
|
||||||
|
@ -57,5 +59,3 @@ Discourse.CategoryChooserView = Discourse.ComboboxView.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Discourse.View.registerHelper('categoryChooser', Discourse.CategoryChooserView);
|
|
|
@ -6,7 +6,7 @@
|
||||||
@namespace Discourse
|
@namespace Discourse
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.ComboboxView = Discourse.View.extend({
|
export default Discourse.View.extend({
|
||||||
tagName: 'select',
|
tagName: 'select',
|
||||||
classNames: ['combobox'],
|
classNames: ['combobox'],
|
||||||
valueAttribute: 'id',
|
valueAttribute: 'id',
|
||||||
|
@ -79,5 +79,3 @@ Discourse.ComboboxView = Discourse.View.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Discourse.View.registerHelper('combobox', Discourse.ComboboxView);
|
|
|
@ -22,7 +22,7 @@
|
||||||
//= require ./discourse/views/text-field
|
//= require ./discourse/views/text-field
|
||||||
//= require ./discourse/views/modal/modal_body_view
|
//= require ./discourse/views/modal/modal_body_view
|
||||||
//= require ./discourse/views/modal/flag_view
|
//= require ./discourse/views/modal/flag_view
|
||||||
//= require ./discourse/views/combobox_view
|
//= require ./discourse/views/combo-box
|
||||||
//= require ./discourse/views/buttons/button_view
|
//= require ./discourse/views/buttons/button_view
|
||||||
//= require ./discourse/views/buttons/dropdown_button_view
|
//= require ./discourse/views/buttons/dropdown_button_view
|
||||||
//= require ./discourse/views/buttons/notifications_button
|
//= require ./discourse/views/buttons/notifications_button
|
||||||
|
|
Loading…
Reference in a new issue