mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Replaced many global Discourse.SiteSetting calls in templates with
computed properties due to deprecations.
This commit is contained in:
parent
8559bbe508
commit
f322b500a7
9 changed files with 15 additions and 35 deletions
|
@ -19,6 +19,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
hasAuthOptions: Em.computed.notEmpty('authOptions'),
|
||||
canCreateLocal: Discourse.computed.setting('enable_local_logins'),
|
||||
showCreateForm: Em.computed.or('hasAuthOptions', 'canCreateLocal'),
|
||||
maxUsernameLength: Discourse.computed.setting('max_username_length'),
|
||||
|
||||
resetForm: function() {
|
||||
this.setProperties({
|
||||
|
@ -200,7 +201,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
}
|
||||
|
||||
// If too long
|
||||
if (this.get('accountUsername').length > Discourse.SiteSettings.max_username_length) {
|
||||
if (this.get('accountUsername').length > this.get('maxUsernameLength')) {
|
||||
return Discourse.InputValidation.create({
|
||||
failed: true,
|
||||
reason: I18n.t('user.username.too_long')
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
|
||||
import DiscourseController from 'discourse/controllers/controller';
|
||||
|
||||
export default DiscourseController.extend(ModalFunctionality, {
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
/**
|
||||
This controller supports actions related to updating one's preferences
|
||||
|
||||
@class PreferencesController
|
||||
@extends ObjectController
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default ObjectController.extend({
|
||||
|
||||
allowAvatarUpload: Discourse.computed.setting('allow_uploaded_avatars'),
|
||||
allowUserLocale: Discourse.computed.setting('allow_user_locale'),
|
||||
ssoOverridesAvatar: Discourse.computed.setting('sso_overrides_avatar'),
|
||||
allowBackgrounds: Discourse.computed.setting('allow_profile_backgrounds'),
|
||||
editHistoryVisible: Discourse.computed.setting('edit_history_visible_to_public'),
|
||||
|
||||
selectedCategories: function(){
|
||||
return [].concat(this.get("watchedCategories"), this.get("trackedCategories"), this.get("mutedCategories"));
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
/**
|
||||
This controller supports actions related to updating one's username
|
||||
|
||||
@class PreferencesUsernameController
|
||||
@extends ObjectController
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default ObjectController.extend({
|
||||
taken: false,
|
||||
saving: false,
|
||||
|
@ -15,6 +7,7 @@ export default ObjectController.extend({
|
|||
errorMessage: null,
|
||||
newUsername: null,
|
||||
|
||||
maxLength: Discourse.computed.setting('max_username_length'),
|
||||
newUsernameEmpty: Em.computed.empty('newUsername'),
|
||||
saveDisabled: Em.computed.or('saving', 'newUsernameEmpty', 'taken', 'unchanged', 'errorMessage'),
|
||||
unchanged: Discourse.computed.propertyEqual('newUsername', 'username'),
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
<div class="modal-body">
|
||||
{{#if hasAtLeastOneLoginButton}}
|
||||
<div id="login-buttons">
|
||||
{{#each Discourse.LoginMethod.all}}
|
||||
<button class="btn btn-social {{unbound name}}" {{action externalLogin this}}>{{unbound title}}</button>
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_local_logins}}
|
||||
{{login-buttons action="externalLogin"}}
|
||||
{{#if canLoginLocal}}
|
||||
{{#if hasAtLeastOneLoginButton}}
|
||||
<h3 style="text-align:center;">{{i18n login.or}}</h3>
|
||||
{{/if}}
|
||||
|
@ -47,17 +40,17 @@
|
|||
{{#if authenticate}}
|
||||
{{i18n login.authenticating}}
|
||||
{{/if}}
|
||||
{{#if Discourse.SiteSettings.enable_local_logins}}
|
||||
{{#if canLoginLocal}}
|
||||
<button class='btn btn-large btn-primary'
|
||||
{{bind-attr disabled="loginDisabled"}}
|
||||
{{action login}}>
|
||||
<i class="fa fa-unlock"></i> {{loginButtonText}}
|
||||
</button>
|
||||
|
||||
{{#unless Discourse.SiteSettings.invite_only}}
|
||||
{{#if showSignupLink}}
|
||||
<button class="btn btn-large" id="new-account-link" {{action showCreateAccount}}>
|
||||
{{i18n create_account.title}}
|
||||
</button>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="modal-body">
|
||||
<form>
|
||||
{{view Discourse.ArchetypeOptionsView archetypeBinding="view.archetype"}}
|
||||
{{view "archetype-options" archetype=view.archetype}}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<tr class="input">
|
||||
<td class="label"><label for='new-account-username'>{{i18n user.username.title}}</label></td>
|
||||
<td>
|
||||
{{input value=accountUsername id="new-account-username" maxlength=Discourse.SiteSettings.max_username_length}}
|
||||
{{input value=accountUsername id="new-account-username" maxlength=maxUsernameLength}}
|
||||
{{input-tip validation=usernameValidation id="username-validation"}}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{{#if Discourse.SiteSettings.allow_profile_backgrounds}}
|
||||
{{#if allowBackgrounds}}
|
||||
<div class="control-group pref-profile-bg">
|
||||
<label class="control-label">{{i18n user.change_profile_background.title}}</label>
|
||||
<div class="controls">
|
||||
|
@ -167,7 +167,7 @@
|
|||
{{preference-checkbox labelKey="user.enable_quoting" checked=enable_quoting}}
|
||||
{{preference-checkbox labelKey="user.dynamic_favicon" checked=dynamic_favicon}}
|
||||
{{preference-checkbox labelKey="user.disable_jump_reply" checked=disable_jump_reply}}
|
||||
{{#unless Discourse.SiteSettings.edit_history_visible_to_public}}
|
||||
{{#unless editHistoryVisible}}
|
||||
{{preference-checkbox labelKey="user.edit_history_public" checked=edit_history_public}}
|
||||
{{/unless}}
|
||||
{{plugin-outlet "user_custom_preferences"}}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<div class="control-group">
|
||||
<label class="control-label">{{i18n user.username.title}}</label>
|
||||
<div class="controls">
|
||||
{{text-field value=newUsername id="change_username" classNames="input-xxlarge" maxlengthBinding="Discourse.SiteSettings.max_username_length"}}
|
||||
{{text-field value=newUsername id="change_username" classNames="input-xxlarge" maxlength=maxLength}}
|
||||
</div>
|
||||
<div class='instructions'>
|
||||
{{#if taken}}
|
||||
|
|
Loading…
Reference in a new issue