Cleaned up unused code in <GhTagSettingsForm>

no issue

- the tag screen is now separate from the index so the code needed for handling switches between main/meta panes and scroll resets is not used and no longer needed
- tidies up indentation in the template
This commit is contained in:
Kevin Ansfield 2020-01-10 14:14:55 +00:00
parent 190f2e905d
commit 704cbcfb4d
2 changed files with 65 additions and 86 deletions

View File

@ -1,4 +1,3 @@
/* global key */
import Component from '@ember/component'; import Component from '@ember/component';
import Ember from 'ember'; import Ember from 'ember';
import {computed} from '@ember/object'; import {computed} from '@ember/object';
@ -12,8 +11,7 @@ export default Component.extend({
config: service(), config: service(),
tag: null, tag: null,
scratchTag: null,
isViewingSubview: false,
// Allowed actions // Allowed actions
setProperty: () => {}, setProperty: () => {},
@ -98,30 +96,6 @@ export default Component.extend({
clearCoverImage() { clearCoverImage() {
this.setProperty('featureImage', ''); this.setProperty('featureImage', '');
},
openMeta() {
this.set('isViewingSubview', true);
},
closeMeta() {
this.set('isViewingSubview', false);
} }
},
reset() {
this.set('isViewingSubview', false);
if (this.$()) {
this.$('.settings-menu-pane').scrollTop(0);
}
},
focusIn() {
key.setScope('tag-settings-form');
},
focusOut() {
key.setScope('default');
} }
}); });

View File

@ -2,54 +2,58 @@
<div class="pa5 pt4 br4 shadow-1 bg-grouped-table mt2 flex flex-column flex-row-ns items-start justify-between gh-tag-basic-settings-form"> <div class="pa5 pt4 br4 shadow-1 bg-grouped-table mt2 flex flex-column flex-row-ns items-start justify-between gh-tag-basic-settings-form">
<div class="order-1 flex flex-column items-start mr5 w-100 w-50-m w-two-thirds-l"> <div class="order-1 flex flex-column items-start mr5 w-100 w-50-m w-two-thirds-l">
{{#gh-form-group errors=this.tag.errors hasValidated=this.tag.hasValidated property="name"}} {{#gh-form-group errors=this.tag.errors hasValidated=this.tag.hasValidated property="name"}}
<label for="tag-name">Name</label> <label for="tag-name">Name</label>
{{gh-text-input {{gh-text-input
id="tag-name" id="tag-name"
name="name" name="name"
value=this.scratchTag.name value=this.scratchTag.name
tabindex="1" tabindex="1"
focus-out=(action 'setProperty' 'name' this.scratchTag.name)}} focus-out=(action 'setProperty' 'name' this.scratchTag.name)
<p class="description">Start with # to create internal tags. <a }}
href="https://ghost.org/docs/concepts/tags/#internal-tag" target="_blank" rel="noreferrer">Learn <p class="description">
more</a></p> Start with # to create internal tags
<GhErrorMessage @errors={{this.tag.errors}} @property="name" /> <a href="https://ghost.org/docs/concepts/tags/#internal-tag" target="_blank" rel="noreferrer">Learn more</a>
</p>
<GhErrorMessage @errors={{this.tag.errors}} @property="name" />
{{/gh-form-group}} {{/gh-form-group}}
{{#gh-form-group errors=this.tag.errors hasValidated=this.tag.hasValidated property="slug"}} {{#gh-form-group errors=this.tag.errors hasValidated=this.tag.hasValidated property="slug"}}
<label for="tag-slug">Slug</label> <label for="tag-slug">Slug</label>
{{gh-text-input {{gh-text-input
value=this.scratchTag.slug value=this.scratchTag.slug
id="tag-slug" id="tag-slug"
name="slug" name="slug"
tabindex="2" tabindex="2"
focus-out=(action 'setProperty' 'slug' this.scratchTag.slug)}} focus-out=(action 'setProperty' 'slug' this.scratchTag.slug)
{{gh-url-preview prefix="tag" slug=this.scratchTag.slug tagName="p" classNames="description"}} }}
<GhErrorMessage @errors={{this.activeTag.errors}} @property="slug" /> {{gh-url-preview prefix="tag" slug=this.scratchTag.slug tagName="p" classNames="description"}}
<GhErrorMessage @errors={{this.activeTag.errors}} @property="slug" />
{{/gh-form-group}} {{/gh-form-group}}
{{#gh-form-group errors=this.tag.errors hasValidated=this.tag.hasValidated property="description"}} {{#gh-form-group errors=this.tag.errors hasValidated=this.tag.hasValidated property="description"}}
<label for="tag-description">Description</label> <label for="tag-description">Description</label>
{{gh-textarea {{gh-textarea
id="tag-description" id="tag-description"
name="description" name="description"
class="gh-tag-details-textarea" class="gh-tag-details-textarea"
tabindex="3" tabindex="3"
value=this.scratchTag.description value=this.scratchTag.description
focus-out=(action 'setProperty' 'description' this.scratchTag.description) focus-out=(action 'setProperty' 'description' this.scratchTag.description)
}} }}
<GhErrorMessage @errors={{this.tag.errors}} @property="description" /> <GhErrorMessage @errors={{this.tag.errors}} @property="description" />
<p>Maximum: <b>500</b> characters. Youve used {{gh-count-down-characters this.scratchTag.description 500}}</p> <p>Maximum: <b>500</b> characters. Youve used {{gh-count-down-characters this.scratchTag.description 500}}</p>
{{/gh-form-group}} {{/gh-form-group}}
</div> </div>
<div class="order-0 mb6 mb0-ns order-2-ns w-100 w-50-m w-third-l"> <div class="order-0 mb6 mb0-ns order-2-ns w-100 w-50-m w-third-l">
<label for="tag-image">Tag image</label> <label for="tag-image">Tag image</label>
{{gh-image-uploader-with-preview {{gh-image-uploader-with-preview
image=this.tag.featureImage image=this.tag.featureImage
text="Upload tag image" text="Upload tag image"
class="gh-tag-image-uploader" class="gh-tag-image-uploader"
allowUnsplash=true allowUnsplash=true
update=(action "setCoverImage") update=(action "setCoverImage")
remove=(action "clearCoverImage")}} remove=(action "clearCoverImage")
}}
</div> </div>
</div> </div>
@ -57,31 +61,32 @@
<div class="pa5 pt4 br4 shadow-1 bg-grouped-table mt2 flex flex-column flex-row-ns items-start justify-between"> <div class="pa5 pt4 br4 shadow-1 bg-grouped-table mt2 flex flex-column flex-row-ns items-start justify-between">
<div class="flex flex-column items-start mr5 w-100 w-50-m w-two-thirds-l"> <div class="flex flex-column items-start mr5 w-100 w-50-m w-two-thirds-l">
{{#gh-form-group errors=this.tag.errors hasValidated=this.tag.hasValidated property="metaTitle"}} {{#gh-form-group errors=this.tag.errors hasValidated=this.tag.hasValidated property="metaTitle"}}
<label for="meta-title">Meta Title</label> <label for="meta-title">Meta Title</label>
{{gh-text-input {{gh-text-input
id="meta-title" id="meta-title"
name="metaTitle" name="metaTitle"
placeholder=this.scratchTag.name placeholder=this.scratchTag.name
tabindex="4" tabindex="4"
value=this.scratchTag.metaTitle value=this.scratchTag.metaTitle
focus-out=(action "setProperty" "metaTitle" this.scratchTag.metaTitle)}} focus-out=(action "setProperty" "metaTitle" this.scratchTag.metaTitle)
<GhErrorMessage @errors={{this.tag.errors}} @property="metaTitle" /> }}
<p>Recommended: <b>70</b> characters. Youve used {{gh-count-down-characters this.scratchTag.metaTitle 70}}</p> <GhErrorMessage @errors={{this.tag.errors}} @property="metaTitle" />
<p>Recommended: <b>70</b> characters. Youve used {{gh-count-down-characters this.scratchTag.metaTitle 70}}</p>
{{/gh-form-group}} {{/gh-form-group}}
{{#gh-form-group errors=this.tag.errors hasValidated=this.tag.hasValidated property="metaDescription"}} {{#gh-form-group errors=this.tag.errors hasValidated=this.tag.hasValidated property="metaDescription"}}
<label for="meta-description">Meta Description</label> <label for="meta-description">Meta Description</label>
{{gh-textarea {{gh-textarea
id="meta-description" id="meta-description"
name="metaDescription" name="metaDescription"
class="gh-tag-details-textarea" class="gh-tag-details-textarea"
placeholder=this.scratchTag.description placeholder=this.scratchTag.description
tabindex="5" tabindex="5"
value=this.scratchTag.metaDescription value=this.scratchTag.metaDescription
focus-out=(action "setProperty" "metaDescription" this.scratchTag.metaDescription) focus-out=(action "setProperty" "metaDescription" this.scratchTag.metaDescription)
}} }}
<GhErrorMessage @errors={{this.tag.errors}} @property="metaDescription" /> <GhErrorMessage @errors={{this.tag.errors}} @property="metaDescription" />
<p>Recommended: <b>156</b> characters. Youve used {{gh-count-down-characters this.scratchTag.metaDescription 156}}</p> <p>Recommended: <b>156</b> characters. Youve used {{gh-count-down-characters this.scratchTag.metaDescription 156}}</p>
{{/gh-form-group}} {{/gh-form-group}}
</div> </div>
<div class="w-100 w-50-m w-third-l"> <div class="w-100 w-50-m w-third-l">