Skip to content

Commit d2bed34

Browse files
committed
Style drafts in new PhameBlogView
Summary: Provides more information that a post is a draft. Test Plan: Add a draft post, see new style. Check Blog as non-editor, don't see draft post. {F1008655} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T9360 Differential Revision: https://secure.phabricator.com/D14613
1 parent 47a5ebb commit d2bed34

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

resources/celerity/map.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
'rsrc/css/phui/phui-button.css' => '16020a60',
128128
'rsrc/css/phui/phui-crumbs-view.css' => '414406b5',
129129
'rsrc/css/phui/phui-document-pro.css' => 'e0fad431',
130-
'rsrc/css/phui/phui-document-summary.css' => 'bca1ed88',
130+
'rsrc/css/phui/phui-document-summary.css' => '350d6025',
131131
'rsrc/css/phui/phui-document.css' => 'a4a1c3b9',
132132
'rsrc/css/phui/phui-feed-story.css' => 'b7b26d23',
133133
'rsrc/css/phui/phui-fontkit.css' => '9cda225e',
@@ -790,7 +790,7 @@
790790
'phui-calendar-list-css' => 'c1c7f338',
791791
'phui-calendar-month-css' => '476be7e0',
792792
'phui-crumbs-view-css' => '414406b5',
793-
'phui-document-summary-view-css' => 'bca1ed88',
793+
'phui-document-summary-view-css' => '350d6025',
794794
'phui-document-view-css' => 'a4a1c3b9',
795795
'phui-document-view-pro-css' => 'e0fad431',
796796
'phui-feed-story-css' => 'b7b26d23',

src/applications/phame/controller/blog/PhameBlogViewController.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,20 @@ protected function renderPostList(
159159

160160
$blogger = phutil_tag('strong', array(), $blogger);
161161
$date = phabricator_datetime($post->getDatePublished(), $viewer);
162-
$subtitle = pht('Written by %s on %s.', $blogger, $date);
162+
if ($post->isDraft()) {
163+
$subtitle = pht('Unpublished draft by %s.', $blogger);
164+
} else {
165+
$subtitle = pht('Written by %s on %s.', $blogger, $date);
166+
}
163167

164168
$item = id(new PHUIDocumentSummaryView())
165169
->setTitle($post->getTitle())
166170
->setHref($this->getApplicationURI('/post/view/'.$post->getID().'/'))
167171
->setSubtitle($subtitle)
168172
->setImage($blogger_image)
169173
->setImageHref($blogger_uri)
170-
->setSummary($phame_post);
174+
->setSummary($phame_post)
175+
->setDraft($post->isDraft());
171176

172177
$list[] = $item;
173178
}

src/view/phui/PHUIDocumentSummaryView.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ final class PHUIDocumentSummaryView extends AphrontTagView {
88
private $subtitle;
99
private $href;
1010
private $summary;
11+
private $draft;
1112

1213
public function setTitle($title) {
1314
$this->title = $title;
@@ -39,11 +40,20 @@ public function setSummary($summary) {
3940
return $this;
4041
}
4142

43+
public function setDraft($draft) {
44+
$this->draft = $draft;
45+
return $this;
46+
}
47+
4248
protected function getTagAttributes() {
4349
$classes = array();
4450
$classes[] = 'phui-document-summary-view';
4551
$classes[] = 'phabricator-remarkup';
4652

53+
if ($this->draft) {
54+
$classes[] = 'is-draft';
55+
}
56+
4757
return array(
4858
'class' => implode(' ', $classes),
4959
);

webroot/rsrc/css/phui/phui-document-summary.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* @provides phui-document-summary-view-css
33
*/
44

5-
.phui-document-summary-view {
6-
5+
.phui-document-summary-view.is-draft {
6+
opacity: 0.5;
77
}
88

99
body .phui-document-view .phui-document-summary-view h2.remarkup-header {

0 commit comments

Comments
 (0)