1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

T2385: Add "Delete Document" action to Phriction pages

Summary: If a page has not been deleted, this adds an action button to delete the document in the menu on the Phriction Page.

Test Plan:
1. Created a document, checked whether "Delete Document" button was visible.
2. Clicked on "Delete Document" button, checked that the document had been deleted.
3. Went back to document page, checked that the "Delete Document" button no longer existed.

Reviewers: epriestley

CC: aran, Korvin

Maniphest Tasks: T2385

Differential Revision: https://secure.phabricator.com/D4636
This commit is contained in:
Vedha Sayyaparaju 2013-01-24 21:26:40 -08:00 committed by epriestley
parent cf7534f971
commit cf346d3c81
2 changed files with 17 additions and 20 deletions

View file

@ -215,15 +215,26 @@ final class PhrictionDocumentController
$slug = PhabricatorSlug::normalize($this->slug);
return id(new PhabricatorActionListView())
$action_view = id(new PhabricatorActionListView())
->setUser($user)
->setObject($document)
->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Document'))
->setIcon('edit')
->setHref('/phriction/edit/'.$document->getID().'/'))
->addAction(
->setHref('/phriction/edit/'.$document->getID().'/'));
if ($document->getStatus() == PhrictionDocumentStatus::STATUS_EXISTS) {
$action_view->addAction(
id(new PhabricatorActionView())
->setName(pht('Delete Document'))
->setIcon('delete')
->setHref('/phriction/delete/'.$document->getID().'/')
->setWorkflow(true));
}
return
$action_view->addAction(
id(new PhabricatorActionView())
->setName(pht('View History'))
->setIcon('history')

View file

@ -154,19 +154,9 @@ final class PhrictionEditController
->setErrors($errors);
}
$delete_button = null;
if ($document->getID()) {
$panel_header = 'Edit Phriction Document';
$submit_button = 'Save Changes';
if ($document->getStatus() != PhrictionDocumentStatus::STATUS_DELETED) {
$delete_button = phutil_render_tag(
'a',
array(
'href' => '/phriction/delete/'.$document->getID().'/',
'class' => 'grey button',
),
'Delete Document');
}
} else {
$panel_header = 'Create New Phriction Document';
$submit_button = 'Create Document';
@ -240,10 +230,6 @@ final class PhrictionEditController
->setHeader($panel_header)
->appendChild($form);
if ($delete_button) {
$panel->addButton($delete_button);
}
$preview_panel =
'<div class="aphront-panel-preview aphront-panel-preview-wide">
<div class="phriction-document-preview-header">