1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Modernize Repositories a bit

Summary: Switch to modern components, crumbs, pht, object boxes.

Test Plan:
Test browsing a list, click edit, click new repository, click delete, verify all work as expected.

{F330864}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7427

Differential Revision: https://secure.phabricator.com/D11984
This commit is contained in:
Chad Little 2015-03-05 09:43:13 -08:00
parent 19f2468753
commit 386a517c14
4 changed files with 53 additions and 47 deletions

View file

@ -27,13 +27,13 @@ final class PhabricatorRepositoryArcanistProjectDeleteController
$dialog = new AphrontDialogView();
$dialog
->setUser($request->getUser())
->setTitle('Really delete this arcanist project?')
->appendChild(hsprintf(
'<p>Really delete the "%s" arcanist project? '.
'This operation can not be undone.</p>',
->setTitle(pht('Really delete this arcanist project?'))
->appendChild(pht(
'Really delete the "%s" arcanist project? '.
'This operation can not be undone.',
$arc_project->getName()))
->setSubmitURI('/repository/project/delete/'.$this->id.'/')
->addSubmitButton('Delete Arcanist Project')
->addSubmitButton(pht('Delete Arcanist Project'))
->addCancelButton('/repository/');
return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -71,7 +71,7 @@ final class PhabricatorRepositoryArcanistProjectEditController
->setUser($user)
->appendChild(
id(new AphrontFormStaticControl())
->setLabel('Name')
->setLabel(pht('Name'))
->setValue($project->getName()))
->appendChild(
id(new AphrontFormStaticControl())
@ -79,13 +79,13 @@ final class PhabricatorRepositoryArcanistProjectEditController
->setValue($project->getPHID()))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel('Repository')
->setLabel(pht('Repository'))
->setOptions($repos)
->setName('repository')
->setValue($project->getRepositoryID()))
->appendChild(
id(new AphrontFormTextControl())
->setLabel('Indexed Languages')
->setLabel(pht('Indexed Languages'))
->setName('symbolIndexLanguages')
->setCaption(pht(
'Separate with commas, for example: %s',
@ -93,7 +93,7 @@ final class PhabricatorRepositoryArcanistProjectEditController
->setValue($langs))
->appendChild(
id(new AphrontFormTokenizerControl())
->setLabel('Uses Symbols From')
->setLabel(pht('Uses Symbols From'))
->setName('symbolIndexProjects')
->setDatasource(new DiffusionArcanistProjectDatasource())
->setValue($uses))
@ -102,15 +102,20 @@ final class PhabricatorRepositoryArcanistProjectEditController
->addCancelButton('/repository/')
->setValue('Save'));
$panel = new AphrontPanelView();
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
$panel->setHeader('Edit Arcanist Project');
$panel->appendChild($form);
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Edit Arcanist Project'));
$panel->setForm($form);
return $this->buildStandardPageResponse(
$panel,
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Edit Project'));
return $this->buildApplicationPage(
array(
'title' => 'Edit Project',
$crumbs,
$panel,
),
array(
'title' => pht('Edit Project'),
));
}

View file

@ -7,18 +7,9 @@ abstract class PhabricatorRepositoryController extends PhabricatorController {
return true;
}
public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView();
$page->setApplicationName('Repositories');
$page->setBaseURI('/repository/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph('rX');
$page->appendChild($view);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
return $crumbs;
}
}

View file

@ -23,7 +23,7 @@ final class PhabricatorRepositoryListController
array(
'href' => '/diffusion/'.$repo->getCallsign().'/',
),
'View in Diffusion');
pht('View in Diffusion'));
} else {
$diffusion_link = phutil_tag('em', array(), 'Not Tracked');
}
@ -40,17 +40,18 @@ final class PhabricatorRepositoryListController
'class' => 'button small grey',
'href' => '/diffusion/'.$repo->getCallsign().'/edit/',
),
'Edit'),
pht('Edit')),
);
}
$table = new AphrontTableView($rows);
$table->setNoDataString(pht('No Repositories'));
$table->setHeaders(
array(
'Callsign',
'Repository',
'Type',
'Diffusion',
pht('Callsign'),
pht('Repository'),
pht('Type'),
pht('Diffusion'),
'',
));
$table->setColumnClasses(
@ -71,13 +72,18 @@ final class PhabricatorRepositoryListController
$is_admin,
));
$panel = new AphrontPanelView();
$panel->setHeader('Repositories');
$panel = new PHUIObjectBoxView();
$header = new PHUIHeaderView();
$header->setHeader(pht('Repositories'));
if ($is_admin) {
$panel->setCreateButton('Create New Repository', '/diffusion/new/');
$button = id(new PHUIButtonView())
->setTag('a')
->setText(pht('Create New Repository'))
->setHref('/diffusion/new/');
$header->addActionLink($button);
}
$panel->setHeader($header);
$panel->appendChild($table);
$panel->setNoBackground();
$projects = id(new PhabricatorRepositoryArcanistProject())->loadAll();
@ -99,7 +105,7 @@ final class PhabricatorRepositoryListController
'href' => '/repository/project/edit/'.$project->getID().'/',
'class' => 'button grey small',
),
'Edit'),
pht('Edit')),
javelin_tag(
'a',
array(
@ -107,16 +113,17 @@ final class PhabricatorRepositoryListController
'class' => 'button grey small',
'sigil' => 'workflow',
),
'Delete'),
pht('Delete')),
);
}
$project_table = new AphrontTableView($rows);
$project_table->setNoDataString(pht('No Arcanist Projects'));
$project_table->setHeaders(
array(
'Project ID',
'Repository',
pht('Project ID'),
pht('Repository'),
'',
'',
));
@ -136,18 +143,21 @@ final class PhabricatorRepositoryListController
$is_admin,
));
$project_panel = new AphrontPanelView();
$project_panel->setHeader('Arcanist Projects');
$project_panel = new PHUIObjectBoxView();
$project_panel->setHeaderText(pht('Arcanist Projects'));
$project_panel->appendChild($project_table);
$project_panel->setNoBackground();
return $this->buildStandardPageResponse(
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Repository List'));
return $this->buildApplicationPage(
array(
$crumbs,
$panel,
$project_panel,
),
array(
'title' => 'Repository List',
'title' => pht('Repository List'),
));
}