Skip to content

Commit 9aedb3c

Browse files
author
epriestley
committed
Clearly show draft vs nondraft inline comments
Summary: Fixes T2638; mark draft inlines in Pholio in a way similar to Differential. Test Plan: {F34553} Reviewers: chad Reviewed By: chad CC: aran Maniphest Tasks: T2638 Differential Revision: https://secure.phabricator.com/D5217
1 parent 21db190 commit 9aedb3c

File tree

4 files changed

+83
-46
lines changed

4 files changed

+83
-46
lines changed

src/__celerity_resource_map__.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,7 +3236,7 @@
32363236
),
32373237
'pholio-css' =>
32383238
array(
3239-
'uri' => '/res/5bbb9e67/rsrc/css/application/pholio/pholio.css',
3239+
'uri' => '/res/b74040b8/rsrc/css/application/pholio/pholio.css',
32403240
'type' => 'css',
32413241
'requires' =>
32423242
array(
@@ -3245,7 +3245,7 @@
32453245
),
32463246
'pholio-inline-comments-css' =>
32473247
array(
3248-
'uri' => '/res/647d658d/rsrc/css/application/pholio/pholio-inline-comments.css',
3248+
'uri' => '/res/241b121c/rsrc/css/application/pholio/pholio-inline-comments.css',
32493249
'type' => 'css',
32503250
'requires' =>
32513251
array(

src/applications/pholio/view/PholioInlineCommentView.php

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,42 +40,57 @@ public function render() {
4040
}
4141

4242
$actions = null;
43-
44-
if ($this->inlineComment->getTransactionPHID() === null &&
45-
$this->inlineComment->getEditPolicy(
46-
PhabricatorPolicyCapability::CAN_EDIT) == $this->user->getPHID()) {
43+
$inline = $this->inlineComment;
44+
$phid = $inline->getPHID();
45+
$id = $inline->getID();
46+
$user = $this->user;
47+
48+
$is_draft = ($inline->getTransactionPHID() === null);
49+
$can_edit = PhabricatorPolicyFilter::hasCapability(
50+
$user,
51+
$inline,
52+
PhabricatorPolicyCapability::CAN_EDIT);
53+
54+
if ($is_draft && $can_edit) {
55+
$draft = phutil_tag(
56+
'span',
57+
array(
58+
'class' => 'pholio-inline-status',
59+
),
60+
pht('Not Submitted Yet'));
4761

4862
$edit_action = javelin_tag(
4963
'a',
5064
array(
51-
'href' => '/pholio/inline/edit/'.$this->inlineComment->getID(),
65+
'href' => '/pholio/inline/edit/'.$id.'/',
5266
'sigil' => 'inline-edit',
5367
'meta' => array(
54-
'phid' => $this->inlineComment->getPHID(),
55-
'id' => $this->inlineComment->getID()
68+
'phid' => $phid,
69+
'id' => $id,
5670
)
5771
),
5872
pht('Edit'));
5973

6074
$delete_action = javelin_tag(
6175
'a',
6276
array(
63-
'href' => '/pholio/inline/delete/'.$this->inlineComment->getID(),
77+
'href' => '/pholio/inline/delete/'.$id.'/',
6478
'sigil' => 'inline-delete',
6579
'meta' => array(
66-
'phid' => $this->inlineComment->getPHID(),
67-
'id' => $this->inlineComment->getID()
80+
'phid' => $phid,
81+
'id' => $id,
6882
)
6983
),
7084
pht('Delete'));
7185

72-
7386
$actions = phutil_tag(
7487
'span',
7588
array(
7689
'class' => 'pholio-inline-head-links'
7790
),
78-
array($edit_action, $delete_action));
91+
phutil_implode_html(
92+
" \xC2\xB7 ",
93+
array($draft, $edit_action, $delete_action)));
7994
}
8095

8196
$comment_header = phutil_tag(
@@ -87,7 +102,7 @@ public function render() {
87102

88103

89104
$comment = $this->engine->renderOneObject(
90-
$this->inlineComment,
105+
$inline,
91106
PholioTransactionComment::MARKUP_FIELD_COMMENT,
92107
$this->user);
93108

@@ -96,14 +111,21 @@ public function render() {
96111
array(),
97112
$comment);
98113

114+
$classes = array();
115+
$classes[] = 'pholio-inline-comment';
116+
117+
if ($is_draft) {
118+
$classes[] = 'pholio-inline-comment-draft';
119+
}
120+
99121
$comment_block = javelin_tag(
100122
'div',
101123
array(
102-
'id' => $this->inlineComment->getPHID()."_comment",
103-
'class' => 'pholio-inline-comment',
124+
'id' => "{$phid}_comment",
125+
'class' => implode(' ', $classes),
104126
'sigil' => 'inline_comment',
105127
'meta' => array(
106-
'phid' => $this->inlineComment->getPHID()
128+
'phid' => $phid,
107129
)
108130
),
109131
array($comment_header, $comment_body));

webroot/rsrc/css/application/pholio/pholio-inline-comments.css

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
/**
22
* @provides pholio-inline-comments-css
33
*/
4+
5+
.pholio-inline-comment {
6+
border: 1px solid #555555;
7+
background: #353535;
8+
margin: 0 0 5px 0;
9+
padding: 8px 10px;
10+
color: #ccc;
11+
12+
font-family: Verdana;
13+
font-size: 11px;
14+
}
15+
16+
.pholio-mock-inline-comments {
17+
width: 300px;
18+
border-left: 1px solid #101010;
19+
border-top: 1px solid #333;
20+
position: absolute;
21+
top: 0;
22+
bottom: 0;
23+
right: 0;
24+
padding: 10px;
25+
background: #282828;
26+
overflow-x: auto;
27+
text-align: left;
28+
}
29+
430
.pholio-inline-comment-dialog-title {
531
font-weight: bold;
632
color: #fff;
@@ -37,3 +63,20 @@
3763
.pholio-inline-comment-dialog-buttons a {
3864
display: none;
3965
}
66+
67+
.pholio-inline-comment-draft {
68+
border-style: dashed;
69+
border-color: #777777;
70+
background: #464646;
71+
}
72+
73+
.pholio-inline-head-links {
74+
float: right;
75+
font-weight: normal;
76+
color: #777777;
77+
}
78+
79+
.pholio-inline-head-links a {
80+
font-weight: normal;
81+
color: #2178db;
82+
}

webroot/rsrc/css/application/pholio/pholio.css

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -72,29 +72,6 @@
7272
display: inline-block;
7373
}
7474

75-
.pholio-mock-inline-comments {
76-
width: 300px;
77-
border-left: 1px solid #101010;
78-
border-top: 1px solid #333;
79-
position: absolute;
80-
top: 0;
81-
bottom: 0;
82-
right: 0;
83-
padding: 10px;
84-
background: #282828;
85-
overflow-x: auto;
86-
text-align: left;
87-
}
88-
89-
.pholio-inline-comment {
90-
border: 1px solid #333;
91-
border-bottom: 1px solid #555;
92-
background: #353535;
93-
margin: 0 0 5px 0;
94-
padding: 8px 10px;
95-
color: #ccc;
96-
}
97-
9875
.pholio-inline-comment-header {
9976
color: #fff;
10077
border-bottom: 1px solid #555;
@@ -107,8 +84,3 @@
10784
background-color: #222;
10885
border-color: #555;
10986
}
110-
111-
.pholio-inline-head-links a {
112-
font-weight: normal;
113-
margin-left: 5px;
114-
}

0 commit comments

Comments
 (0)