Updated confirm publish button text

no issue

- button text changed to include the post type and time of publish
- the button text has become more complex than a static string so the logic was moved into a getter on the confirm component backing class
This commit is contained in:
Kevin Ansfield 2022-05-06 15:12:38 +01:00
parent a4c1f2f7e0
commit f9ce41620a
3 changed files with 33 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<div class="gh-publish-title">
<div class="green">Ready, set, publish.</div>
<div class="green">Ready, set, publish.</div>
<div>Share it with the world.</div>
</div>
<p class="gh-publish-confirmation">
@ -57,7 +57,7 @@
<div class="gh-publish-cta">
<GhTaskButton
@task={{@saveTask}}
@buttonText={{@publishOptions.selectedPublishTypeOption.confirmButton}}
@buttonText={{this.confirmButtonText}}
@runningText={{if @publishOptions.willOnlyEmail "Sending" "Publishing"}}
@successText={{if @publishOptions.willOnlyEmail "Sent" "Published"}}
@class="gh-btn gh-btn-pulse gh-btn-large"

View File

@ -0,0 +1,30 @@
import Component from '@glimmer/component';
import moment from 'moment';
import {inject as service} from '@ember/service';
export default class PublishFlowOptions extends Component {
@service settings;
get confirmButtonText() {
const publishType = this.args.publishOptions.publishType;
let buttonText = '';
if (publishType === 'publish+send') {
buttonText = 'Publish & send';
} else if (publishType === 'publish') {
buttonText = `Publish ${this.args.publishOptions.post.displayName}`;
} else if (publishType === 'send') {
buttonText = 'Send email';
}
if (this.args.publishOptions.isScheduled) {
const scheduleMoment = moment.tz(this.args.publishOptions.scheduledAtUTC, this.settings.get('timezone'));
buttonText += `, on ${scheduleMoment.format('MMMM Do')}`;
} else {
buttonText += ', right now';
}
return buttonText;
}
}

View File

@ -92,18 +92,15 @@ export class PublishOptions {
value: 'publish+send', // internal
label: 'Publish and email', // shown in expanded options
display: 'Publish and email', // shown in option title
confirmButton: 'Yes, publish and send', // shown in confirm step
disabled: this.emailDisabled
}, {
value: 'publish',
label: 'Publish only',
display: 'Publish',
confirmButton: 'Yes, publish on site'
display: 'Publish'
}, {
value: 'send',
label: 'Email only',
display: 'Email',
confirmButton: 'Yes, send by email',
disabled: this.emailDisabled
}];
}