From ecb0ab4847991b7b121989f6d40134b9f5c92dd7 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Thu, 15 Dec 2011 12:00:17 -0800 Subject: [PATCH] Phriction - kill tabs Summary: ...except that pesky help tab which remains. Pertinent bits here... - move "History" into button "View History" that is grey and next to "Edit Page" - for history page, add breadcrumb similar to the one on "diff" page. This unifies the experiencing on history <=> diffs as well as gives the user a link back to the document, which was a tab on the History page before this diff. Thoughts for next time... - I'd like to further unify the breadcrumbs between "View" and "History / Diff". - The "Document Index" is pretty sweet and feels a bit buried. I wonder if unifying breadcrumbs is the key here? Test Plan: clicked around phriction. viewed a document, viewed its history. verified links in breadcrumbs were correct Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Maniphest Tasks: T631 Differential Revision: 1221 --- src/__celerity_resource_map__.php | 2 +- .../controller/base/PhrictionController.php | 24 +++++------------- .../diff/PhrictionDiffController.php | 3 --- .../document/PhrictionDocumentController.php | 15 ++++++++--- .../history/PhrictionHistoryController.php | 25 ++++++++++++++----- .../phriction/controller/history/__init__.php | 1 + .../phriction/phriction-document-css.css | 1 + 7 files changed, 40 insertions(+), 31 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 0269cb8936..847e2a5886 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -1605,7 +1605,7 @@ celerity_register_resource_map(array( ), 'phriction-document-css' => array( - 'uri' => '/res/a0eb9ea1/rsrc/css/application/phriction/phriction-document-css.css', + 'uri' => '/res/8d09bd7f/rsrc/css/application/phriction/phriction-document-css.css', 'type' => 'css', 'requires' => array( diff --git a/src/applications/phriction/controller/base/PhrictionController.php b/src/applications/phriction/controller/base/PhrictionController.php index ed9f86f565..7b8f7d8633 100644 --- a/src/applications/phriction/controller/base/PhrictionController.php +++ b/src/applications/phriction/controller/base/PhrictionController.php @@ -30,25 +30,13 @@ abstract class PhrictionController extends PhabricatorController { $page->setTitle(idx($data, 'title')); $page->setGlyph("\xE2\x9A\xA1"); - $tabs = array(); - if (!empty($data['document'])) { - $tabs['document'] = array( - 'name' => 'Document', - 'href' => $data['document'], - ); - } - if (!empty($data['history'])) { - $tabs['history'] = array( - 'name' => 'History', - 'href' => $data['history'], - ); - } - - $tabs['help'] = array( - 'name' => 'Help', - 'href' => PhabricatorEnv::getDoclink('article/Phriction_User_Guide.html'), + $tabs = array( + 'help' => array( + 'name' => 'Help', + 'href' => + PhabricatorEnv::getDoclink('article/Phriction_User_Guide.html'), + ), ); - $page->setTabs($tabs, idx($data, 'tab')); $page->appendChild($view); diff --git a/src/applications/phriction/controller/diff/PhrictionDiffController.php b/src/applications/phriction/controller/diff/PhrictionDiffController.php index ba1d719aab..251b7a6db0 100644 --- a/src/applications/phriction/controller/diff/PhrictionDiffController.php +++ b/src/applications/phriction/controller/diff/PhrictionDiffController.php @@ -195,10 +195,7 @@ class PhrictionDiffController ), array( 'title' => 'Document History', - 'history' => PhrictionDocument::getSlugURI($slug, 'history'), - 'document' => PhrictionDocument::getSlugURI($slug), )); - } private function renderRevertButton( diff --git a/src/applications/phriction/controller/document/PhrictionDocumentController.php b/src/applications/phriction/controller/document/PhrictionDocumentController.php index 30b1150d02..acffc72807 100644 --- a/src/applications/phriction/controller/document/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/document/PhrictionDocumentController.php @@ -72,6 +72,7 @@ class PhrictionDocumentController 'class' => 'green button', ), 'Create Page'); + $buttons = $button; } else { $version = $request->getInt('v'); if ($version) { @@ -127,13 +128,22 @@ class PhrictionDocumentController ''. ''; - $button = phutil_render_tag( + $edit_button = phutil_render_tag( 'a', array( 'href' => '/phriction/edit/'.$document->getID().'/', 'class' => 'button', ), 'Edit Page'); + $history_button = phutil_render_tag( + 'a', + array( + 'href' => PhrictionDocument::getSlugURI($slug, 'history'), + 'class' => 'button grey', + ), + 'View History'); + // these float right so button2 which is right most goes first + $buttons = $history_button.$edit_button; } if ($version_note) { @@ -144,7 +154,7 @@ class PhrictionDocumentController $page = '
'. - $button. + $buttons. '

'.phutil_escape_html($page_title).'

'. $breadcrumbs. '
'. @@ -156,7 +166,6 @@ class PhrictionDocumentController $page, array( 'title' => 'Phriction - '.$page_title, - 'history' => PhrictionDocument::getSlugURI($slug, 'history'), )); } diff --git a/src/applications/phriction/controller/history/PhrictionHistoryController.php b/src/applications/phriction/controller/history/PhrictionHistoryController.php index 0c8d1c12c1..75e3beb0d3 100644 --- a/src/applications/phriction/controller/history/PhrictionHistoryController.php +++ b/src/applications/phriction/controller/history/PhrictionHistoryController.php @@ -109,6 +109,21 @@ class PhrictionHistoryController ); } + $crumbs = new AphrontCrumbsView(); + $crumbs->setCrumbs( + array( + 'Phriction', + phutil_render_tag( + 'a', + array( + 'href' => PhrictionDocument::getSlugURI($document->getSlug()), + ), + phutil_escape_html($current->getTitle()) + ), + 'History', + )); + + $table = new AphrontTableView($rows); $table->setHeaders( array( @@ -136,15 +151,13 @@ class PhrictionHistoryController $panel->appendChild($table); $panel->appendChild($pager); - $slug = $document->getSlug(); - return $this->buildStandardPageResponse( - $panel, + array( + $crumbs, + $panel, + ), array( 'title' => 'Document History', - 'history' => PhrictionDocument::getSlugURI($slug, 'history'), - 'document' => PhrictionDocument::getSlugURI($slug), - 'tab' => 'history', )); } diff --git a/src/applications/phriction/controller/history/__init__.php b/src/applications/phriction/controller/history/__init__.php index 296b6f192b..6c5ab29f2f 100644 --- a/src/applications/phriction/controller/history/__init__.php +++ b/src/applications/phriction/controller/history/__init__.php @@ -13,6 +13,7 @@ phutil_require_module('phabricator', 'applications/phriction/storage/content'); phutil_require_module('phabricator', 'applications/phriction/storage/document'); phutil_require_module('phabricator', 'view/control/pager'); phutil_require_module('phabricator', 'view/control/table'); +phutil_require_module('phabricator', 'view/layout/crumbs'); phutil_require_module('phabricator', 'view/layout/panel'); phutil_require_module('phabricator', 'view/utils'); diff --git a/webroot/rsrc/css/application/phriction/phriction-document-css.css b/webroot/rsrc/css/application/phriction/phriction-document-css.css index 26241e419c..c0dd596e49 100644 --- a/webroot/rsrc/css/application/phriction/phriction-document-css.css +++ b/webroot/rsrc/css/application/phriction/phriction-document-css.css @@ -10,6 +10,7 @@ .phriction-header a.button { float: right; + margin: 0em 0em 0em 1%; } .phriction-header h1 {