mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
2231dd84c2
no issue
Ember is migrating to `<AngleBracketSyntax />` for component invocation, see https://github.com/emberjs/rfcs/blob/master/text/0311-angle-bracket-invocation.md
We were in a half-way situation where some templates used angle bracket syntax in some places, this PR updates templates to use the syntax everywhere.
This simplifies the rules for what template code is referring to...
`<Component>` = a component
`{{helper}}` = a helper (or locally assigned handlebars variable)
`{{this.foo}}` = data on the template backing context (a component/controller)
`{{@foo}}` = a named argument passed into the component that the component backing class has not modified (note: this commit does not introduce any named arguments)
- ran codemod https://github.com/ember-codemods/ember-angle-brackets-codemod on the following directories:
- `app/templates`
- `lib/koenig-editor/addon/templates`
- removed positional params from components as angle bracket syntax does not support them
- `gh-feature-flag`
- `gh-tour-item`
- `gh-cm-editor`
- `gh-fullscreen-modal`
- `gh-task-button`
- updates some code that was missed in 3c851293c1
to use explicit this
148 lines
6.6 KiB
Handlebars
148 lines
6.6 KiB
Handlebars
{{#if this.post}}
|
|
<GhEditor
|
|
@tagName="section"
|
|
@class="gh-editor gh-view"
|
|
as |editor|
|
|
>
|
|
<header class="gh-editor-header br2 pe-none {{editor.headerClass}} {{if this.infoMessage "bg-white"}}">
|
|
<div class="flex items-center pe-auto">
|
|
{{#if this.ui.isFullScreen}}
|
|
<div class="{{ui-text "ts"}} h9 br b--lightgrey pl3 pr4 flex items-center br2 br--left {{unless this.infoMessage "bg-white"}}">
|
|
<LinkTo @route={{pluralize this.post.displayName }} @classNames="blue link fw4 flex items-center" data-test-link={{pluralize this.post.displayName}}>
|
|
{{svg-jar "arrow-left" class="w3 fill-blue mr1 nudge-right--2"}}
|
|
{{capitalize (pluralize this.post.displayName)}}
|
|
</LinkTo>
|
|
</div>
|
|
{{/if}}
|
|
<div class="flex items-center pl4 pr4 f8 nudge-left--1 h9 br2 br--right {{unless this.infoMessage "bg-white"}}">
|
|
<span class="fw4 midgrey-l2">
|
|
<GhEditorPostStatus
|
|
@post={{this.post}}
|
|
@isSaving={{or this.autosave.isRunning this.saveTasks.isRunning}}
|
|
/>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
{{#if this.infoMessage}}
|
|
<div class="gh-koenig-info miw88 flex flex-auto justify-center" style="pointer-events: auto">
|
|
<div class="midgrey inline-flex tracked-1 center pa1 pl4 pr4 br3 justify-center items-start {{if (eq editor.headerClass "gh-editor-header-small") "bg-white"}}">
|
|
{{svg-jar "idea" class="w7 h7 fill-blue"}}
|
|
<p class="ma0 pa0 ml1 nudge-top--2">
|
|
{{this.infoMessage}}
|
|
<button type="button" class="blue fw5" {{action (mut this.infoMessage "")}}>Got it</button>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
|
|
<section class="view-actions br2 {{unless this.infoMessage "bg-white"}}" style="pointer-events: auto">
|
|
{{#unless this.post.isNew}}
|
|
{{#if this.session.user.isContributor}}
|
|
<GhTaskButton @buttonText="Save"
|
|
@task={{this.save}}
|
|
@runningText="Saving"
|
|
@class="gh-btn gh-btn-blue gh-btn-icon contributor-save-button"
|
|
data-test-contributor-save=true />
|
|
{{else}}
|
|
<GhPublishmenu
|
|
@post={{this.post}}
|
|
@postStatus={{this.post.status}}
|
|
@saveTask={{this.save}}
|
|
@setSaveType={{action "setSaveType"}}
|
|
@onOpen={{action "cancelAutosave"}}
|
|
@backgroundTask={{this.backgroundLoader}}
|
|
@memberCount={{this.memberCount}} />
|
|
{{/if}}
|
|
{{/unless}}
|
|
|
|
<button type="button" class="post-settings" title="Settings" {{action "openSettingsMenu" target=this.ui}} data-test-psm-trigger>
|
|
{{svg-jar "settings"}}
|
|
</button>
|
|
</section>
|
|
</header>
|
|
|
|
{{!--
|
|
gh-koenig-editor acts as a wrapper around the title input and
|
|
koenig editor canvas to support Ghost-specific editor behaviour
|
|
--}}
|
|
<GhKoenigEditor
|
|
@title={{readonly this.post.titleScratch}}
|
|
@titlePlaceholder={{concat (capitalize this.post.displayName) " Title"}}
|
|
@onTitleChange={{action "updateTitleScratch"}}
|
|
@onTitleBlur={{action (perform this.saveTitle)}}
|
|
@body={{readonly this.post.scratch}}
|
|
@bodyPlaceholder={{concat "Begin writing your " this.post.displayName "..."}}
|
|
@bodyAutofocus={{this.shouldFocusEditor}}
|
|
@onBodyChange={{action "updateScratch"}}
|
|
@headerOffset={{editor.headerHeight}}
|
|
@scrollContainerSelector=".gh-koenig-editor"
|
|
@scrollOffsetTopSelector=".gh-editor-header-small"
|
|
@scrollOffsetBottomSelector=".gh-mobile-nav-bar"
|
|
@onEditorCreated={{action "setKoenigEditor"}}
|
|
@onWordCountChange={{action "updateWordCount"}}
|
|
/>
|
|
|
|
<div class="absolute flex items-center br3 bg-white {{if editor.headerClass "right-4 bottom-4" "right-6 bottom-6"}}">
|
|
<div class="midgrey-l2 {{if editor.headerClass "f-supersmall pl2 pr2" "f8 pl4 pr3"}} fw4">
|
|
{{pluralize this.wordCount.wordCount "word"}}
|
|
</div>
|
|
<a href="https://ghost.org/faq/using-the-editor/" class="flex {{if editor.headerClass "pa2" "pa3"}}" target="_blank">{{svg-jar "help" class="w4 h4 stroke-midgrey-l2"}}</a>
|
|
</div>
|
|
|
|
</GhEditor>
|
|
|
|
{{#if this.showDeletePostModal}}
|
|
<GhFullscreenModal @modal="delete-post"
|
|
@model={{hash post=this.post onSuccess=(route-action 'redirectToContentScreen')}}
|
|
@close={{action "toggleDeletePostModal"}}
|
|
@modifier="action wide" />
|
|
{{/if}}
|
|
|
|
{{#if this.showLeaveEditorModal}}
|
|
<GhFullscreenModal @modal="leave-editor"
|
|
@confirm={{action "leaveEditor"}}
|
|
@close={{action "toggleLeaveEditorModal"}}
|
|
@modifier="action wide" />
|
|
{{/if}}
|
|
|
|
{{#if this.showReAuthenticateModal}}
|
|
<GhFullscreenModal @modal="re-authenticate"
|
|
@close={{action "toggleReAuthenticateModal"}}
|
|
@modifier="action wide" />
|
|
{{/if}}
|
|
|
|
{{#if this.showEmailPreviewModal}}
|
|
<GhFullscreenModal @modal="post-email-preview"
|
|
@model={{this.post}}
|
|
@close={{action "toggleEmailPreviewModal"}}
|
|
@modifier="full-overlay email-preview" />
|
|
{{/if}}
|
|
|
|
{{#if this.showUpgradeModal}}
|
|
<GhFullscreenModal
|
|
@modal="upgrade-host-limit"
|
|
@model={{hash
|
|
message=hostLimitError.context
|
|
details=hostLimitError.details
|
|
upgradeLink=hostLimitError.help
|
|
}}
|
|
@close={{action "closeUpgradeModal"}}
|
|
@modifier="action wide"
|
|
/>
|
|
{{/if}}
|
|
|
|
<LiquidWormhole>
|
|
<GhPostSettingsMenu
|
|
@post={{this.post}}
|
|
@showSettingsMenu={{this.ui.showSettingsMenu}}
|
|
@toggleEmailPreviewModal={{action "toggleEmailPreviewModal"}}
|
|
@deletePost={{action "toggleDeletePostModal"}}
|
|
@updateSlug={{this.updateSlug}}
|
|
@savePost={{this.savePost}}
|
|
/>
|
|
</LiquidWormhole>
|
|
{{/if}}
|
|
|
|
{{outlet}}
|