mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 10:53:34 +03:00
142f322338
requires fdeb7daf40
- swapped to using settings model for storing custom views instead of user accessibility field
- added conditional that checks current user is an admin/owner when displaying the manage custom views button in the content filter (only admins/owners can edit settings model)
- passed `session.user` into the `<GhContentFilter>` component as an argument so that the conditional getter doesn't need to handle async user access
- fixed no-shadow linting error in settings service
79 lines
2.9 KiB
Handlebars
79 lines
2.9 KiB
Handlebars
<header class="modal-header" data-test-modal="custom-view-form">
|
|
<h1>{{if this.model.isNew "New view" "Edit view"}}</h1>
|
|
</header>
|
|
{{!-- disable mouseDown so it doesn't trigger focus-out validations --}}
|
|
<button class="close" href title="Close" {{action "closeModal"}} {{action (optional this.noop) on="mouseDown"}}>
|
|
{{svg-jar "close"}}
|
|
</button>
|
|
|
|
<div class="modal-body">
|
|
<fieldset>
|
|
<GhFormGroup @errors={{this.model.errors}} @hasValidated={{this.model.hasValidated}} @property="name">
|
|
<label for="view-name" class="dib fw6">View name</label>
|
|
<GhTextInput
|
|
@id="view-name"
|
|
@value={{this.model.name}}
|
|
@placeholder="Breaking news"
|
|
@focus-out={{action "validate" "name" target=this.model}}
|
|
data-test-input="custom-view-name"
|
|
/>
|
|
{{#if this.model.errors}}
|
|
<GhErrorMessage @errors={{this.model.errors}} @property="name" data-test-error="custom-view-name" />
|
|
{{else}}
|
|
{{#if this.model.isNew}}
|
|
<p>Saved views appear in the app sidebar.</p>
|
|
{{/if}}
|
|
{{/if}}
|
|
</GhFormGroup>
|
|
</fieldset>
|
|
<div>
|
|
<label for="view-name" class="dib fw6">Icon color</label>
|
|
<div class="flex justify-between mt3 nl1">
|
|
{{#each this.customViews.availableColors as |color|}}
|
|
<div class="gh-radio-color">
|
|
<input
|
|
type="radio"
|
|
name="view-color"
|
|
id="view-{{color}}"
|
|
checked={{eq color this.delayedModelColor}}
|
|
value={{color}}
|
|
{{on "change" (action 'changeColor')}}
|
|
>
|
|
<label for="view-{{color}}"><span class="gh-radio-color-{{color}}"></span></label>
|
|
</div>
|
|
{{/each}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
{{#if this.model.isNew}}
|
|
<button
|
|
class="gh-btn"
|
|
{{action "closeModal"}}
|
|
{{!-- disable mouseDown so it doesn't trigger focus-out validations --}}
|
|
{{on "mousedown" (optional this.noop)}}
|
|
data-test-button="cancel-custom-view-form"
|
|
>
|
|
<span>Cancel</span>
|
|
</button>
|
|
{{else}}
|
|
<button
|
|
class="gh-btn gh-btn-red gh-btn-icon"
|
|
{{on "click" (perform this.deleteTask)}}
|
|
{{on "mousedown" (optional this.noop)}}
|
|
data-test-button="delete-custom-view"
|
|
>
|
|
<span>{{svg-jar "trash"}} Delete</span>
|
|
</button
|
|
>
|
|
{{/if}}
|
|
|
|
<GhTaskButton
|
|
@buttonText="Save"
|
|
@successText="Saved"
|
|
@task={{this.saveTask}}
|
|
@taskArgs={{this.model}}
|
|
@class="gh-btn gh-btn-green gh-btn-icon"
|
|
data-test-button="save-custom-view" />
|
|
</div> |