mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 21:32:43 +01:00
Update Phriction Edit/History/Diff UI
Summary: Updates various Phriction pages to match new UI Test Plan: New Document, Edit Document, View History, Revert Change Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D15572
This commit is contained in:
parent
e3daf598fb
commit
83a3ea5705
4 changed files with 58 additions and 41 deletions
|
@ -98,6 +98,7 @@ final class PhrictionDiffController extends PhrictionController {
|
|||
->setRenderingReferences(array("{$l},{$r}"))
|
||||
->setRenderURI('/phriction/diff/'.$document->getID().'/')
|
||||
->setTitle(pht('Changes'))
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->setParser($parser);
|
||||
|
||||
require_celerity_resource('phriction-document-css');
|
||||
|
@ -121,11 +122,10 @@ final class PhrictionDiffController extends PhrictionController {
|
|||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($title)
|
||||
->setTall(true);
|
||||
->setHeaderIcon('fa-history');
|
||||
|
||||
$crumbs->addTextCrumb($title, $request->getRequestURI());
|
||||
|
||||
|
||||
$comparison_table = $this->renderComparisonTable(
|
||||
array(
|
||||
$content_r,
|
||||
|
@ -144,7 +144,7 @@ final class PhrictionDiffController extends PhrictionController {
|
|||
'a',
|
||||
array(
|
||||
'href' => $uri->alter('l', $l - 1)->alter('r', $r - 1),
|
||||
'class' => 'button simple',
|
||||
'class' => 'button grey',
|
||||
),
|
||||
pht("\xC2\xAB Previous Change"));
|
||||
} else {
|
||||
|
@ -163,7 +163,7 @@ final class PhrictionDiffController extends PhrictionController {
|
|||
'a',
|
||||
array(
|
||||
'href' => $uri->alter('l', $l + 1)->alter('r', $r + 1),
|
||||
'class' => 'button simple',
|
||||
'class' => 'button grey',
|
||||
),
|
||||
pht("Next Change \xC2\xBB"));
|
||||
} else {
|
||||
|
@ -185,7 +185,6 @@ final class PhrictionDiffController extends PhrictionController {
|
|||
)));
|
||||
}
|
||||
|
||||
|
||||
$output = hsprintf(
|
||||
'<div class="phriction-document-history-diff">'.
|
||||
'%s%s'.
|
||||
|
@ -198,21 +197,25 @@ final class PhrictionDiffController extends PhrictionController {
|
|||
$revert_l,
|
||||
$revert_r);
|
||||
|
||||
|
||||
$object_box = id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
->setHeaderText(pht('Edits'))
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->appendChild($output);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
$crumbs->setBorder(true);
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setFooter(array(
|
||||
$object_box,
|
||||
$changes,
|
||||
),
|
||||
array(
|
||||
'title' => pht('Document History'),
|
||||
));
|
||||
|
||||
return $this->newPage()
|
||||
->setTitle(pht('Document History'))
|
||||
->setCrumbs($crumbs)
|
||||
->appendChild($view);
|
||||
|
||||
}
|
||||
|
||||
private function renderRevertButton(
|
||||
|
@ -238,7 +241,7 @@ final class PhrictionDiffController extends PhrictionController {
|
|||
'a',
|
||||
array(
|
||||
'href' => '/phriction/edit/'.$document_id.'/',
|
||||
'class' => 'button simple',
|
||||
'class' => 'button grey',
|
||||
),
|
||||
pht('Edit Current Version'));
|
||||
}
|
||||
|
@ -248,7 +251,7 @@ final class PhrictionDiffController extends PhrictionController {
|
|||
'a',
|
||||
array(
|
||||
'href' => '/phriction/edit/'.$document_id.'/?revert='.$version,
|
||||
'class' => 'button simple',
|
||||
'class' => 'button grey',
|
||||
),
|
||||
pht('Revert to Version %s...', $version));
|
||||
}
|
||||
|
|
|
@ -177,8 +177,9 @@ final class PhrictionEditController
|
|||
}
|
||||
|
||||
if ($document->getID()) {
|
||||
$panel_header = pht('Edit Phriction Document');
|
||||
$panel_header = pht('Edit Document: %s', $content->getTitle());
|
||||
$page_title = pht('Edit Document');
|
||||
$header_icon = 'fa-pencil';
|
||||
if ($overwrite) {
|
||||
$submit_button = pht('Overwrite Changes');
|
||||
} else {
|
||||
|
@ -188,6 +189,7 @@ final class PhrictionEditController
|
|||
$panel_header = pht('Create New Phriction Document');
|
||||
$submit_button = pht('Create Document');
|
||||
$page_title = pht('Create Document');
|
||||
$header_icon = 'fa-plus-square';
|
||||
}
|
||||
|
||||
$uri = $document->getSlug();
|
||||
|
@ -263,8 +265,9 @@ final class PhrictionEditController
|
|||
->setValue($submit_button));
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($panel_header)
|
||||
->setHeaderText(pht('Document'))
|
||||
->setValidationException($validation_exception)
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->setForm($form);
|
||||
|
||||
$preview = id(new PHUIRemarkupPreviewPanel())
|
||||
|
@ -282,17 +285,25 @@ final class PhrictionEditController
|
|||
} else {
|
||||
$crumbs->addTextCrumb(pht('Create'));
|
||||
}
|
||||
$crumbs->setBorder(true);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($panel_header)
|
||||
->setHeaderIcon($header_icon);
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setFooter(array(
|
||||
$draft_note,
|
||||
$form_box,
|
||||
$preview,
|
||||
),
|
||||
array(
|
||||
'title' => $page_title,
|
||||
));
|
||||
|
||||
return $this->newPage()
|
||||
->setTitle($page_title)
|
||||
->setCrumbs($crumbs)
|
||||
->appendChild($view);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,19 +3,17 @@
|
|||
final class PhrictionHistoryController
|
||||
extends PhrictionController {
|
||||
|
||||
private $slug;
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$this->slug = $request->getURIData('slug');
|
||||
$slug = $request->getURIData('slug');
|
||||
|
||||
$document = id(new PhrictionDocumentQuery())
|
||||
->setViewer($viewer)
|
||||
->withSlugs(array(PhabricatorSlug::normalize($this->slug)))
|
||||
->withSlugs(array(PhabricatorSlug::normalize($slug)))
|
||||
->needContent(true)
|
||||
->executeOne();
|
||||
if (!$document) {
|
||||
|
@ -141,6 +139,7 @@ final class PhrictionHistoryController
|
|||
$crumbs->addTextCrumb(
|
||||
pht('History'),
|
||||
PhrictionDocument::getSlugURI($document->getSlug(), 'history'));
|
||||
$crumbs->setBorder(true);
|
||||
|
||||
$header = new PHUIHeaderView();
|
||||
$header->setHeader(phutil_tag(
|
||||
|
@ -150,23 +149,31 @@ final class PhrictionHistoryController
|
|||
$header->setSubheader(pht('Document History'));
|
||||
|
||||
$obj_box = id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->setObjectList($list);
|
||||
|
||||
$pager = id(new PHUIBoxView())
|
||||
->addClass('ml')
|
||||
->appendChild($pager);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(pht('Document History: %s', head($history)->getTitle()))
|
||||
->setHeaderIcon('fa-history');
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setFooter(array(
|
||||
$obj_box,
|
||||
$pager,
|
||||
),
|
||||
array(
|
||||
'title' => pht('Document History'),
|
||||
));
|
||||
|
||||
$title = pht('Document History');
|
||||
|
||||
return $this->newPage()
|
||||
->setTitle($title)
|
||||
->setCrumbs($crumbs)
|
||||
->appendChild($view);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ final class PhrictionNewController extends PhrictionController {
|
|||
PhrictionDocumentStatus::STATUS_EXISTS;
|
||||
|
||||
if ($document_exists && $prompt == 'no') {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setSubmitURI('/phriction/new/')
|
||||
return $this->newDialog()
|
||||
->setSubmitURI('/phriction/new/')
|
||||
->setTitle(pht('Edit Existing Document?'))
|
||||
->setUser($viewer)
|
||||
->appendChild(pht(
|
||||
|
@ -27,8 +27,6 @@ final class PhrictionNewController extends PhrictionController {
|
|||
->addHiddenInput('prompt', 'yes')
|
||||
->addCancelButton('/w/')
|
||||
->addSubmitButton(pht('Edit Document'));
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
||||
$uri = '/phriction/edit/?slug='.$slug;
|
||||
|
@ -46,8 +44,7 @@ final class PhrictionNewController extends PhrictionController {
|
|||
->setValue($slug)
|
||||
->setName('slug'));
|
||||
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($viewer)
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('New Document'))
|
||||
->setSubmitURI('/phriction/new/')
|
||||
->appendChild(phutil_tag('p',
|
||||
|
@ -57,7 +54,6 @@ final class PhrictionNewController extends PhrictionController {
|
|||
->addSubmitButton(pht('Create'))
|
||||
->addCancelButton('/w/');
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue