2019-02-19 20:56:01 +08:00
|
|
|
<div class="edit-main-nav admin-controls">
|
|
|
|
<nav>
|
|
|
|
<ul class="nav nav-pills target">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#each this.visibleTargets as |target|}}
|
2019-02-19 20:56:01 +08:00
|
|
|
<li>
|
2022-07-06 16:37:54 +08:00
|
|
|
<LinkTo
|
|
|
|
@route={{this.editRouteName}}
|
|
|
|
@models={{array this.theme.id target.name this.fieldName}}
|
|
|
|
@replace={{true}}
|
|
|
|
title={{this.field.title}}
|
|
|
|
class={{if target.edited "edited" "blank"}}
|
|
|
|
>
|
2019-02-19 20:56:01 +08:00
|
|
|
{{#if target.error}}{{d-icon "exclamation-triangle"}}{{/if}}
|
|
|
|
{{#if target.icon}}{{d-icon target.icon}}{{/if}}
|
|
|
|
{{i18n (concat "admin.customize.theme." target.name)}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</LinkTo>
|
2019-02-19 20:56:01 +08:00
|
|
|
</li>
|
|
|
|
{{/each}}
|
2020-02-11 22:55:16 +08:00
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.allowAdvanced}}
|
2019-02-19 20:56:01 +08:00
|
|
|
<li>
|
DEV: Remove usage of {{action}} modifiers - Take 2 (#18476)
This PR enables the [`no-action-modifiers`](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-action-modifiers.md) template lint rule and removes all usages of the `{{action}}` modifier in core.
In general, instances of `{{action "x"}}` have been replaced with `{{on "click" (action "x")}}`.
In many cases, such as for `a` elements, we also need to prevent default event handling to avoid unwanted side effects. While the `{{action}}` modifier internally calls `event.preventDefault()`, we need to handle these cases more explicitly. For this purpose, this PR also adds the [ember-event-helpers](https://github.com/buschtoens/ember-event-helpers) dependency so we can use the `prevent-default` handler. For instance:
```
<a href {{on "click" (prevent-default (action "x"))}}>Do X</a>
```
Note that `action` has not in general been refactored away as a helper yet. In general, all event handlers should be methods on the corresponding component and referenced directly (e.g. `{{on "click" this.doSomething}}`). However, the `action` helper is used extensively throughout the codebase and often references methods in the `actions` hash on controllers or routes. Thus this refactor will also be extensive and probably deserves a separate PR.
Note: This work was done to complement #17767 by minimizing the potential impact of the `action` modifier override, which uses private API and arguably should be replaced with an AST transform.
This is a followup to #18333, which had to be reverted because it did not account for the default treatment of modifier keys by the {{action}} modifier.
Commits:
* Enable `no-action-modifiers` template lint rule
* Replace {{action "x"}} with {{on "click" (action "x")}}
* Remove unnecessary action helper usage
* Remove ctl+click tests for user-menu
These tests now break in Chrome when used with addEventListener. As per the comment, they can probably be safely removed.
* Prevent default event handlers to avoid unwanted side effects
Uses `event.preventDefault()` in event handlers to prevent default event handling. This had been done automatically by the `action` modifier, but is not always desirable or necessary.
* Restore UserCardContents#showUser action to avoid regression
By keeping the `showUser` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showUser` argument that's been passed.
* Revert EditCategoryTab#selectTab -> EditCategoryTab#select
Avoid potential breaking change in themes / plugins
* Restore GroupCardContents#showGroup action to avoid regression
By keeping the `showGroup` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showGroup` argument that's been passed.
* Restore SecondFactorAddTotp#showSecondFactorKey action to avoid regression
By keeping the `showSecondFactorKey` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showSecondFactorKey` property that's maintained on the controller.
* Refactor away from `actions` hash in ChooseMessage component
* Modernize EmojiPicker#onCategorySelection usage
* Modernize SearchResultEntry#logClick usage
* Modernize Discovery::Categories#showInserted usage
* Modernize Preferences::Account#resendConfirmationEmail usage
* Modernize MultiSelect::SelectedCategory#onSelectedNameClick usage
* Favor fn over action in SelectedChoice component
* Modernize WizardStep event handlers
* Favor fn over action usage in buttons
* Restore Login#forgotPassword action to avoid possible regression
* Introduce modKeysPressed utility
Returns an array of modifier keys that are pressed during a given `MouseEvent` or `KeyboardEvent`.
* Don't interfere with click events on links with `href` values when modifier keys are pressed
2022-10-05 20:08:54 +08:00
|
|
|
<a
|
|
|
|
{{on "click" this.toggleShowAdvanced}}
|
2020-02-11 22:55:16 +08:00
|
|
|
href
|
2022-07-06 01:41:31 +08:00
|
|
|
title={{i18n
|
|
|
|
(concat
|
|
|
|
"admin.customize.theme."
|
|
|
|
(if this.showAdvanced "hide_advanced" "show_advanced")
|
2022-12-28 20:28:11 +08:00
|
|
|
)
|
2022-07-06 01:41:31 +08:00
|
|
|
}}
|
2020-03-07 19:58:48 +08:00
|
|
|
class="no-text"
|
|
|
|
>
|
2022-07-06 01:41:31 +08:00
|
|
|
{{d-icon
|
|
|
|
(if this.showAdvanced "angle-double-left" "angle-double-right")
|
|
|
|
}}
|
2019-02-20 06:25:00 +08:00
|
|
|
</a>
|
2019-02-19 20:56:01 +08:00
|
|
|
</li>
|
2019-02-20 06:25:00 +08:00
|
|
|
{{/if}}
|
2019-02-19 20:56:01 +08:00
|
|
|
<li class="spacer"></li>
|
|
|
|
<li>
|
|
|
|
<label>
|
2022-07-06 16:37:54 +08:00
|
|
|
<Input
|
|
|
|
@type="checkbox"
|
|
|
|
@checked={{this.onlyOverridden}}
|
|
|
|
{{on
|
|
|
|
"click"
|
2023-02-24 07:03:27 +08:00
|
|
|
(action this.onlyOverriddenChanged value="target.checked")
|
2022-07-06 16:37:54 +08:00
|
|
|
}}
|
|
|
|
/>
|
2019-02-19 20:56:01 +08:00
|
|
|
{{i18n "admin.customize.theme.hide_unused_fields"}}
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="admin-controls">
|
|
|
|
<nav>
|
|
|
|
<ul class="nav nav-pills fields">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#each this.visibleFields as |field|}}
|
2019-02-19 20:56:01 +08:00
|
|
|
<li>
|
2022-07-06 16:37:54 +08:00
|
|
|
<LinkTo
|
|
|
|
@route={{this.editRouteName}}
|
|
|
|
@models={{array this.theme.id this.currentTargetName field.name}}
|
|
|
|
@replace={{true}}
|
|
|
|
title={{field.title}}
|
|
|
|
class={{if field.edited "edited" "blank"}}
|
|
|
|
>
|
2019-02-19 20:56:01 +08:00
|
|
|
{{#if field.error}}{{d-icon "exclamation-triangle"}}{{/if}}
|
|
|
|
{{#if field.icon}}{{d-icon field.icon}}{{/if}}
|
|
|
|
{{field.translatedName}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</LinkTo>
|
2019-02-19 20:56:01 +08:00
|
|
|
</li>
|
|
|
|
{{/each}}
|
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.showAddField}}
|
2019-02-19 20:56:01 +08:00
|
|
|
<li>
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.addingField}}
|
|
|
|
<Input
|
|
|
|
@type={{this.text}}
|
|
|
|
@value={{this.newFieldName}}
|
|
|
|
@enter={{action "addField"}}
|
|
|
|
@escape-press={{action "cancelAddField"}}
|
|
|
|
/>
|
|
|
|
<DButton
|
|
|
|
@class="ok"
|
|
|
|
@action={{action "addField" this.newFieldName}}
|
|
|
|
@icon="check"
|
2022-06-30 18:30:50 +08:00
|
|
|
/>
|
|
|
|
<DButton
|
|
|
|
@class="cancel"
|
|
|
|
@action={{action "cancelAddField"}}
|
|
|
|
@icon="times"
|
2022-12-28 20:28:11 +08:00
|
|
|
/>
|
2019-02-19 20:56:01 +08:00
|
|
|
{{else}}
|
DEV: Remove usage of {{action}} modifiers - Take 2 (#18476)
This PR enables the [`no-action-modifiers`](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-action-modifiers.md) template lint rule and removes all usages of the `{{action}}` modifier in core.
In general, instances of `{{action "x"}}` have been replaced with `{{on "click" (action "x")}}`.
In many cases, such as for `a` elements, we also need to prevent default event handling to avoid unwanted side effects. While the `{{action}}` modifier internally calls `event.preventDefault()`, we need to handle these cases more explicitly. For this purpose, this PR also adds the [ember-event-helpers](https://github.com/buschtoens/ember-event-helpers) dependency so we can use the `prevent-default` handler. For instance:
```
<a href {{on "click" (prevent-default (action "x"))}}>Do X</a>
```
Note that `action` has not in general been refactored away as a helper yet. In general, all event handlers should be methods on the corresponding component and referenced directly (e.g. `{{on "click" this.doSomething}}`). However, the `action` helper is used extensively throughout the codebase and often references methods in the `actions` hash on controllers or routes. Thus this refactor will also be extensive and probably deserves a separate PR.
Note: This work was done to complement #17767 by minimizing the potential impact of the `action` modifier override, which uses private API and arguably should be replaced with an AST transform.
This is a followup to #18333, which had to be reverted because it did not account for the default treatment of modifier keys by the {{action}} modifier.
Commits:
* Enable `no-action-modifiers` template lint rule
* Replace {{action "x"}} with {{on "click" (action "x")}}
* Remove unnecessary action helper usage
* Remove ctl+click tests for user-menu
These tests now break in Chrome when used with addEventListener. As per the comment, they can probably be safely removed.
* Prevent default event handlers to avoid unwanted side effects
Uses `event.preventDefault()` in event handlers to prevent default event handling. This had been done automatically by the `action` modifier, but is not always desirable or necessary.
* Restore UserCardContents#showUser action to avoid regression
By keeping the `showUser` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showUser` argument that's been passed.
* Revert EditCategoryTab#selectTab -> EditCategoryTab#select
Avoid potential breaking change in themes / plugins
* Restore GroupCardContents#showGroup action to avoid regression
By keeping the `showGroup` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showGroup` argument that's been passed.
* Restore SecondFactorAddTotp#showSecondFactorKey action to avoid regression
By keeping the `showSecondFactorKey` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showSecondFactorKey` property that's maintained on the controller.
* Refactor away from `actions` hash in ChooseMessage component
* Modernize EmojiPicker#onCategorySelection usage
* Modernize SearchResultEntry#logClick usage
* Modernize Discovery::Categories#showInserted usage
* Modernize Preferences::Account#resendConfirmationEmail usage
* Modernize MultiSelect::SelectedCategory#onSelectedNameClick usage
* Favor fn over action in SelectedChoice component
* Modernize WizardStep event handlers
* Favor fn over action usage in buttons
* Restore Login#forgotPassword action to avoid possible regression
* Introduce modKeysPressed utility
Returns an array of modifier keys that are pressed during a given `MouseEvent` or `KeyboardEvent`.
* Don't interfere with click events on links with `href` values when modifier keys are pressed
2022-10-05 20:08:54 +08:00
|
|
|
<a href {{on "click" this.toggleAddField}} class="no-text">
|
2019-02-19 20:56:01 +08:00
|
|
|
{{d-icon "plus"}}
|
|
|
|
</a>
|
|
|
|
{{/if}}
|
|
|
|
</li>
|
|
|
|
{{/if}}
|
2020-04-13 23:17:20 +08:00
|
|
|
|
2019-02-19 20:56:01 +08:00
|
|
|
<li class="spacer"></li>
|
|
|
|
<li>
|
DEV: Remove usage of {{action}} modifiers - Take 2 (#18476)
This PR enables the [`no-action-modifiers`](https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-action-modifiers.md) template lint rule and removes all usages of the `{{action}}` modifier in core.
In general, instances of `{{action "x"}}` have been replaced with `{{on "click" (action "x")}}`.
In many cases, such as for `a` elements, we also need to prevent default event handling to avoid unwanted side effects. While the `{{action}}` modifier internally calls `event.preventDefault()`, we need to handle these cases more explicitly. For this purpose, this PR also adds the [ember-event-helpers](https://github.com/buschtoens/ember-event-helpers) dependency so we can use the `prevent-default` handler. For instance:
```
<a href {{on "click" (prevent-default (action "x"))}}>Do X</a>
```
Note that `action` has not in general been refactored away as a helper yet. In general, all event handlers should be methods on the corresponding component and referenced directly (e.g. `{{on "click" this.doSomething}}`). However, the `action` helper is used extensively throughout the codebase and often references methods in the `actions` hash on controllers or routes. Thus this refactor will also be extensive and probably deserves a separate PR.
Note: This work was done to complement #17767 by minimizing the potential impact of the `action` modifier override, which uses private API and arguably should be replaced with an AST transform.
This is a followup to #18333, which had to be reverted because it did not account for the default treatment of modifier keys by the {{action}} modifier.
Commits:
* Enable `no-action-modifiers` template lint rule
* Replace {{action "x"}} with {{on "click" (action "x")}}
* Remove unnecessary action helper usage
* Remove ctl+click tests for user-menu
These tests now break in Chrome when used with addEventListener. As per the comment, they can probably be safely removed.
* Prevent default event handlers to avoid unwanted side effects
Uses `event.preventDefault()` in event handlers to prevent default event handling. This had been done automatically by the `action` modifier, but is not always desirable or necessary.
* Restore UserCardContents#showUser action to avoid regression
By keeping the `showUser` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showUser` argument that's been passed.
* Revert EditCategoryTab#selectTab -> EditCategoryTab#select
Avoid potential breaking change in themes / plugins
* Restore GroupCardContents#showGroup action to avoid regression
By keeping the `showGroup` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showGroup` argument that's been passed.
* Restore SecondFactorAddTotp#showSecondFactorKey action to avoid regression
By keeping the `showSecondFactorKey` action, we can avoid a breaking change for plugins that rely upon it, while not interfering with the `showSecondFactorKey` property that's maintained on the controller.
* Refactor away from `actions` hash in ChooseMessage component
* Modernize EmojiPicker#onCategorySelection usage
* Modernize SearchResultEntry#logClick usage
* Modernize Discovery::Categories#showInserted usage
* Modernize Preferences::Account#resendConfirmationEmail usage
* Modernize MultiSelect::SelectedCategory#onSelectedNameClick usage
* Favor fn over action in SelectedChoice component
* Modernize WizardStep event handlers
* Favor fn over action usage in buttons
* Restore Login#forgotPassword action to avoid possible regression
* Introduce modKeysPressed utility
Returns an array of modifier keys that are pressed during a given `MouseEvent` or `KeyboardEvent`.
* Don't interfere with click events on links with `href` values when modifier keys are pressed
2022-10-05 20:08:54 +08:00
|
|
|
<a href {{on "click" this.toggleMaximize}} class="no-text">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{d-icon this.maximizeIcon}}
|
2019-02-19 20:56:01 +08:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.error}}
|
|
|
|
<pre class="field-error">{{this.error}}</pre>
|
2019-02-19 20:56:01 +08:00
|
|
|
{{/if}}
|
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.warning}}
|
|
|
|
<pre class="field-warning">{{html-safe this.warning}}</pre>
|
2021-05-11 21:01:06 +08:00
|
|
|
{{/if}}
|
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
<AceEditor
|
|
|
|
@content={{this.activeSection}}
|
|
|
|
@editorId={{this.editorId}}
|
|
|
|
@mode={{this.activeSectionMode}}
|
|
|
|
@autofocus="true"
|
|
|
|
@placeholder={{this.placeholder}}
|
|
|
|
@htmlPlaceholder={{true}}
|
2023-02-24 07:03:27 +08:00
|
|
|
@save={{this.save}}
|
2022-07-06 01:41:31 +08:00
|
|
|
@setWarning={{action "setWarning"}}
|
|
|
|
/>
|