Skip to content

Commit e3a97e3

Browse files
chadlittlechad
authored and
chad
committed
Update Phurl to PHUITwoColumnView
Summary: Cleaner UI, moved visit to be button. Test Plan: Make a phurl about cats, click on it. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D15385
1 parent fe01949 commit e3a97e3

File tree

1 file changed

+45
-41
lines changed

1 file changed

+45
-41
lines changed

src/applications/phurl/controller/PhabricatorPhurlURLViewController.php

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,20 @@ public function handleRequest(AphrontRequest $request) {
2424
$title = $url->getMonogram();
2525
$page_title = $title.' '.$url->getName();
2626
$crumbs = $this->buildApplicationCrumbs();
27-
$crumbs->addTextCrumb($title, $url->getURI());
27+
$crumbs->addTextCrumb($title);
28+
$crumbs->setBorder(true);
2829

2930
$timeline = $this->buildTransactionTimeline(
3031
$url,
3132
new PhabricatorPhurlURLTransactionQuery());
3233

3334
$header = $this->buildHeaderView($url);
34-
$actions = $this->buildActionView($url);
35-
$properties = $this->buildPropertyView($url);
35+
$curtain = $this->buildCurtain($url);
36+
$details = $this->buildPropertySectionView($url);
3637

37-
$properties->setActionList($actions);
3838
$url_error = id(new PHUIInfoView())
3939
->setErrors(array(pht('This URL is invalid due to a bad protocol.')))
4040
->setIsHidden($url->isValid());
41-
$box = id(new PHUIObjectBoxView())
42-
->setHeader($header)
43-
->addPropertyList($properties)
44-
->setInfoView($url_error);
4541

4642
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
4743
$add_comment_header = $is_serious
@@ -58,71 +54,80 @@ public function handleRequest(AphrontRequest $request) {
5854
->setAction($comment_uri)
5955
->setSubmitButtonName(pht('Add Comment'));
6056

61-
return $this->buildApplicationPage(
62-
array(
63-
$crumbs,
64-
$box,
57+
$view = id(new PHUITwoColumnView())
58+
->setHeader($header)
59+
->setCurtain($curtain)
60+
->setMainColumn(array(
61+
$url_error,
62+
$details,
6563
$timeline,
6664
$add_comment_form,
67-
),
68-
array(
69-
'title' => $page_title,
70-
'pageObjects' => array($url->getPHID()),
7165
));
66+
67+
return $this->newPage()
68+
->setTitle($page_title)
69+
->setCrumbs($crumbs)
70+
->setPageObjectPHIDs(array($url->getPHID()))
71+
->appendChild(
72+
array(
73+
$view,
74+
));
75+
7276
}
7377

7478
private function buildHeaderView(PhabricatorPhurlURL $url) {
7579
$viewer = $this->getViewer();
76-
$icon = 'fa-compress';
77-
$color = 'green';
80+
$icon = 'fa-check';
81+
$color = 'bluegrey';
7882
$status = pht('Active');
83+
$id = $url->getID();
84+
85+
$visit = id(new PHUIButtonView())
86+
->setTag('a')
87+
->setText(pht('Visit URL'))
88+
->setIcon('fa-external-link')
89+
->setHref("u/{$id}")
90+
->setDisabled(!$url->isValid());
7991

8092
$header = id(new PHUIHeaderView())
8193
->setUser($viewer)
8294
->setHeader($url->getDisplayName())
8395
->setStatus($icon, $color, $status)
84-
->setPolicyObject($url);
96+
->setPolicyObject($url)
97+
->setHeaderIcon('fa-compress')
98+
->addActionLink($visit);
8599

86100
return $header;
87101
}
88102

89-
private function buildActionView(PhabricatorPhurlURL $url) {
103+
private function buildCurtain(PhabricatorPhurlURL $url) {
90104
$viewer = $this->getViewer();
91105
$id = $url->getID();
92106

93-
$actions = id(new PhabricatorActionListView())
94-
->setUser($viewer)
95-
->setObject($url);
107+
$curtain = $this->newCurtainView($url);
96108

97109
$can_edit = PhabricatorPolicyFilter::hasCapability(
98110
$viewer,
99111
$url,
100112
PhabricatorPolicyCapability::CAN_EDIT);
101113

102-
$actions
114+
$curtain
103115
->addAction(
104116
id(new PhabricatorActionView())
105117
->setName(pht('Edit'))
106118
->setIcon('fa-pencil')
107119
->setHref($this->getApplicationURI("url/edit/{$id}/"))
108120
->setDisabled(!$can_edit)
109-
->setWorkflow(!$can_edit))
110-
->addAction(
111-
id(new PhabricatorActionView())
112-
->setName(pht('Visit URL'))
113-
->setIcon('fa-external-link')
114-
->setHref("u/{$id}")
115-
->setDisabled(!$url->isValid()));
121+
->setWorkflow(!$can_edit));
116122

117-
return $actions;
123+
return $curtain;
118124
}
119125

120-
private function buildPropertyView(PhabricatorPhurlURL $url) {
126+
private function buildPropertySectionView(PhabricatorPhurlURL $url) {
121127
$viewer = $this->getViewer();
122128

123129
$properties = id(new PHUIPropertyListView())
124-
->setUser($viewer)
125-
->setObject($url);
130+
->setUser($viewer);
126131

127132
$properties->addProperty(
128133
pht('Original URL'),
@@ -132,18 +137,17 @@ private function buildPropertyView(PhabricatorPhurlURL $url) {
132137
pht('Alias'),
133138
$url->getAlias());
134139

135-
$properties->invokeWillRenderEvent();
136-
137140
$description = $url->getDescription();
138141
if (strlen($description)) {
139142
$description = new PHUIRemarkupView($viewer, $description);
140-
$properties->addSectionHeader(
141-
pht('Description'),
142-
PHUIPropertyListView::ICON_SUMMARY);
143+
$properties->addSectionHeader(pht('Description'));
143144
$properties->addTextContent($description);
144145
}
145146

146-
return $properties;
147+
return id(new PHUIObjectBoxView())
148+
->setHeaderText(pht('DETAILS'))
149+
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
150+
->appendChild($properties);
147151
}
148152

149153
}

0 commit comments

Comments
 (0)