Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Updated copy for scheduled posts
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzimon committed Nov 8, 2019
1 parent 421809b commit 39d2e13
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 29 deletions.
2 changes: 1 addition & 1 deletion app/components/gh-posts-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default Component.extend({
}

if (this.isScheduled) {
return `${text.slice(0, 40)}...`;
return `${text.slice(0, 35)}...`;
} else {
return `${text.slice(0, 80)}...`;
}
Expand Down
3 changes: 3 additions & 0 deletions app/components/gh-publishmenu-scheduled.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Component from '@ember/component';
import moment from 'moment';
import {computed} from '@ember/object';
import { equal } from '@ember/object/computed';
import {inject as service} from '@ember/service';

export default Component.extend({
Expand All @@ -15,6 +16,8 @@ export default Component.extend({

'data-test-publishmenu-scheduled': true,

disableEmailOption: equal('memberCount', 0),

timeToPublished: computed('post.publishedAtUTC', 'clock.second', function () {
let publishedAtUTC = this.get('post.publishedAtUTC');

Expand Down
7 changes: 6 additions & 1 deletion app/styles/components/publishmenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
margin: 0 0 15px 0;
padding: 20px 20px 0;
font-size: 1.8rem;
line-height: 1.15em;
line-height: 1.25em;
}

.gh-publishmenu-content {
Expand Down Expand Up @@ -249,4 +249,9 @@

.gh-publishmenu-content .for-switch.pe-none {
opacity: 0.6;
}

.gh-publishmenu-email-info {
margin: 15px 0;
color: var(--midgrey);
}
2 changes: 1 addition & 1 deletion app/templates/components/gh-posts-list-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</h3>
{{#if isScheduled}}
<p>
<span class="gh-schedule-time">Will go live {{gh-format-post-time this.post.publishedAtUTC scheduled=true}}</span>
<span class="gh-schedule-time">Scheduled to be published and sent {{gh-format-post-time this.post.publishedAtUTC scheduled=true}}</span>
<span class="gh-schedule-subtext">&dash; {{this.subText}}</span>
</p>
{{else}}
Expand Down
77 changes: 53 additions & 24 deletions app/templates/components/gh-publishmenu-scheduled.hbs
Original file line number Diff line number Diff line change
@@ -1,27 +1,56 @@
<header class="gh-publishmenu-heading">Will be published in {{timeToPublished}}</header>
<section class="gh-publishmenu-content">
<div class="gh-publishmenu-radio {{if (eq saveType "draft") "active"}}" {{action "setSaveType" "draft" on="click"}}>
<div class="gh-publishmenu-radio-button" data-test-publishmenu-draft-option></div>
<div class="gh-publishmenu-radio-content">
<div class="gh-publishmenu-radio-label">Revert to draft</div>
<div class="gh-publishmenu-radio-desc">Do not publish</div>
<div class="gh-publishmenu-content">
<section class="gh-publishmenu-section">
<div class="gh-publishmenu-radio {{if (eq saveType "draft") "active"}}" {{action "setSaveType" "draft" on="click"}}>
<div class="gh-publishmenu-radio-button" data-test-publishmenu-draft-option></div>
<div class="gh-publishmenu-radio-content">
<div class="gh-publishmenu-radio-label">Revert to draft</div>
<div class="gh-publishmenu-radio-desc">Do not publish</div>
</div>
</div>
</div>
<div class="gh-publishmenu-radio {{if (eq saveType "schedule") "active"}}" {{action "setSaveType" "schedule" on="click"}}>
<div class="gh-publishmenu-radio-button" data-test-publishmenu-scheduled-option></div>
<div class="gh-publishmenu-radio-content">
<div class="gh-publishmenu-radio-label">Schedule for later</div>
{{gh-date-time-picker
date=post.publishedAtBlogDate
time=post.publishedAtBlogTime
setDate=(action "setDate")
setTime=(action "setTime")
errors=post.errors
dateErrorProperty="publishedAtBlogDate"
timeErrorProperty="publishedAtBlogTime"
minDate=_minDate
}}
<div class="gh-publishmenu-radio-desc">Set automatic future publish date</div>
<div class="gh-publishmenu-radio {{if (eq saveType "schedule") "active"}}" {{action "setSaveType" "schedule" on="click"}}>
<div class="gh-publishmenu-radio-button" data-test-publishmenu-scheduled-option></div>
<div class="gh-publishmenu-radio-content">
<div class="gh-publishmenu-radio-label">Schedule for later</div>
{{gh-date-time-picker
date=post.publishedAtBlogDate
time=post.publishedAtBlogTime
setDate=(action "setDate")
setTime=(action "setTime")
errors=post.errors
dateErrorProperty="publishedAtBlogDate"
timeErrorProperty="publishedAtBlogTime"
minDate=_minDate
}}
<div class="gh-publishmenu-radio-desc">Set automatic future publish date</div>
</div>
</div>
</div>
</section>
</section>
{{#if post.sendEmailWhenPublished}}
<section class="gh-publishmenu-section">
<div class="gh-publishmenu-radio gh-publishmenu-email">
{{#if this.backgroundLoader.isRunning}}
<div class="gh-loading-spinner" style="zoom: 50%"></div>
{{else}}
<div class="gh-publishmenu-email-label">
<label class="gh-publishmenu-radio-label pe-none midgrey"
for="email-when-published-checkbox">Send by email</label>
{{#if this.memberCount}}
<div class="gh-publishmenu-radio-desc">Deliver post to members</div>
{{else}}
<div class="gh-publishmenu-radio-desc">You haven't got any members</div>
{{/if}}
</div>
<div class="for-switch small pe-none">
<div class="switch container" for="email-when-published-checkbox">
<Input @checked={{post.sendEmailWhenPublished}} @type="checkbox" @id="email-when-published-checkbox"
@name="email-when-published" @disabled={{disableEmailOption}} />
<span class="input-toggle-component gh-publishmenu-email-checkbox"
{{on "click" (toggle "sendEmailWhenPublished" this)}}></span>
</div>
</div>
{{/if}}
</div>
</section>
{{/if}}
</div>
1 change: 1 addition & 0 deletions app/templates/components/gh-publishmenu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
post=post
saveType=saveType
isClosing=isClosing
memberCount=this.memberCount
setSaveType=(action "setSaveType")}}

{{else}}
Expand Down
6 changes: 4 additions & 2 deletions app/templates/editor.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
</div>
{{/if}}
<div class="flex items-center pl4 pr4 f8 nudge-left--1 h9 br2 br--right {{unless infoMessage "bg-white"}}">
{{#unless post.isScheduled}}
<span class="fw4 midgrey-l2">
{{gh-editor-post-status
post=post
isSaving=(or autosave.isRunning saveTasks.isRunning)
}}
</span>
{{/unless}}
{{#gh-scheduled-post-countdown post=post as |post countdown|}}
<time datetime="{{post.publishedAtUTC}}" class="green f8 ml5" data-test-schedule-countdown>
{{capitalize post.displayName}} will go live {{countdown}}.
<time datetime="{{post.publishedAtUTC}}" class="green f8" data-test-schedule-countdown>
Scheduled to be published and sent {{countdown}}.
</time>
{{/gh-scheduled-post-countdown}}
</div>
Expand Down

0 comments on commit 39d2e13

Please sign in to comment.