mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 22:40: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:
parent
19f2468753
commit
386a517c14
4 changed files with 53 additions and 47 deletions
|
@ -27,13 +27,13 @@ final class PhabricatorRepositoryArcanistProjectDeleteController
|
||||||
$dialog = new AphrontDialogView();
|
$dialog = new AphrontDialogView();
|
||||||
$dialog
|
$dialog
|
||||||
->setUser($request->getUser())
|
->setUser($request->getUser())
|
||||||
->setTitle('Really delete this arcanist project?')
|
->setTitle(pht('Really delete this arcanist project?'))
|
||||||
->appendChild(hsprintf(
|
->appendChild(pht(
|
||||||
'<p>Really delete the "%s" arcanist project? '.
|
'Really delete the "%s" arcanist project? '.
|
||||||
'This operation can not be undone.</p>',
|
'This operation can not be undone.',
|
||||||
$arc_project->getName()))
|
$arc_project->getName()))
|
||||||
->setSubmitURI('/repository/project/delete/'.$this->id.'/')
|
->setSubmitURI('/repository/project/delete/'.$this->id.'/')
|
||||||
->addSubmitButton('Delete Arcanist Project')
|
->addSubmitButton(pht('Delete Arcanist Project'))
|
||||||
->addCancelButton('/repository/');
|
->addCancelButton('/repository/');
|
||||||
|
|
||||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||||
|
|
|
@ -71,7 +71,7 @@ final class PhabricatorRepositoryArcanistProjectEditController
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormStaticControl())
|
id(new AphrontFormStaticControl())
|
||||||
->setLabel('Name')
|
->setLabel(pht('Name'))
|
||||||
->setValue($project->getName()))
|
->setValue($project->getName()))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormStaticControl())
|
id(new AphrontFormStaticControl())
|
||||||
|
@ -79,13 +79,13 @@ final class PhabricatorRepositoryArcanistProjectEditController
|
||||||
->setValue($project->getPHID()))
|
->setValue($project->getPHID()))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSelectControl())
|
id(new AphrontFormSelectControl())
|
||||||
->setLabel('Repository')
|
->setLabel(pht('Repository'))
|
||||||
->setOptions($repos)
|
->setOptions($repos)
|
||||||
->setName('repository')
|
->setName('repository')
|
||||||
->setValue($project->getRepositoryID()))
|
->setValue($project->getRepositoryID()))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormTextControl())
|
id(new AphrontFormTextControl())
|
||||||
->setLabel('Indexed Languages')
|
->setLabel(pht('Indexed Languages'))
|
||||||
->setName('symbolIndexLanguages')
|
->setName('symbolIndexLanguages')
|
||||||
->setCaption(pht(
|
->setCaption(pht(
|
||||||
'Separate with commas, for example: %s',
|
'Separate with commas, for example: %s',
|
||||||
|
@ -93,7 +93,7 @@ final class PhabricatorRepositoryArcanistProjectEditController
|
||||||
->setValue($langs))
|
->setValue($langs))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormTokenizerControl())
|
id(new AphrontFormTokenizerControl())
|
||||||
->setLabel('Uses Symbols From')
|
->setLabel(pht('Uses Symbols From'))
|
||||||
->setName('symbolIndexProjects')
|
->setName('symbolIndexProjects')
|
||||||
->setDatasource(new DiffusionArcanistProjectDatasource())
|
->setDatasource(new DiffusionArcanistProjectDatasource())
|
||||||
->setValue($uses))
|
->setValue($uses))
|
||||||
|
@ -102,15 +102,20 @@ final class PhabricatorRepositoryArcanistProjectEditController
|
||||||
->addCancelButton('/repository/')
|
->addCancelButton('/repository/')
|
||||||
->setValue('Save'));
|
->setValue('Save'));
|
||||||
|
|
||||||
$panel = new AphrontPanelView();
|
$panel = new PHUIObjectBoxView();
|
||||||
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
|
$panel->setHeaderText(pht('Edit Arcanist Project'));
|
||||||
$panel->setHeader('Edit Arcanist Project');
|
$panel->setForm($form);
|
||||||
$panel->appendChild($form);
|
|
||||||
|
|
||||||
return $this->buildStandardPageResponse(
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$panel,
|
$crumbs->addTextCrumb(pht('Edit Project'));
|
||||||
|
|
||||||
|
return $this->buildApplicationPage(
|
||||||
array(
|
array(
|
||||||
'title' => 'Edit Project',
|
$crumbs,
|
||||||
|
$panel,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'title' => pht('Edit Project'),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,18 +7,9 @@ abstract class PhabricatorRepositoryController extends PhabricatorController {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildStandardPageResponse($view, array $data) {
|
protected function buildApplicationCrumbs() {
|
||||||
$page = $this->buildStandardPageView();
|
$crumbs = parent::buildApplicationCrumbs();
|
||||||
|
return $crumbs;
|
||||||
$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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ final class PhabricatorRepositoryListController
|
||||||
array(
|
array(
|
||||||
'href' => '/diffusion/'.$repo->getCallsign().'/',
|
'href' => '/diffusion/'.$repo->getCallsign().'/',
|
||||||
),
|
),
|
||||||
'View in Diffusion');
|
pht('View in Diffusion'));
|
||||||
} else {
|
} else {
|
||||||
$diffusion_link = phutil_tag('em', array(), 'Not Tracked');
|
$diffusion_link = phutil_tag('em', array(), 'Not Tracked');
|
||||||
}
|
}
|
||||||
|
@ -40,17 +40,18 @@ final class PhabricatorRepositoryListController
|
||||||
'class' => 'button small grey',
|
'class' => 'button small grey',
|
||||||
'href' => '/diffusion/'.$repo->getCallsign().'/edit/',
|
'href' => '/diffusion/'.$repo->getCallsign().'/edit/',
|
||||||
),
|
),
|
||||||
'Edit'),
|
pht('Edit')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new AphrontTableView($rows);
|
$table = new AphrontTableView($rows);
|
||||||
|
$table->setNoDataString(pht('No Repositories'));
|
||||||
$table->setHeaders(
|
$table->setHeaders(
|
||||||
array(
|
array(
|
||||||
'Callsign',
|
pht('Callsign'),
|
||||||
'Repository',
|
pht('Repository'),
|
||||||
'Type',
|
pht('Type'),
|
||||||
'Diffusion',
|
pht('Diffusion'),
|
||||||
'',
|
'',
|
||||||
));
|
));
|
||||||
$table->setColumnClasses(
|
$table->setColumnClasses(
|
||||||
|
@ -71,13 +72,18 @@ final class PhabricatorRepositoryListController
|
||||||
$is_admin,
|
$is_admin,
|
||||||
));
|
));
|
||||||
|
|
||||||
$panel = new AphrontPanelView();
|
$panel = new PHUIObjectBoxView();
|
||||||
$panel->setHeader('Repositories');
|
$header = new PHUIHeaderView();
|
||||||
|
$header->setHeader(pht('Repositories'));
|
||||||
if ($is_admin) {
|
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->appendChild($table);
|
||||||
$panel->setNoBackground();
|
|
||||||
|
|
||||||
$projects = id(new PhabricatorRepositoryArcanistProject())->loadAll();
|
$projects = id(new PhabricatorRepositoryArcanistProject())->loadAll();
|
||||||
|
|
||||||
|
@ -99,7 +105,7 @@ final class PhabricatorRepositoryListController
|
||||||
'href' => '/repository/project/edit/'.$project->getID().'/',
|
'href' => '/repository/project/edit/'.$project->getID().'/',
|
||||||
'class' => 'button grey small',
|
'class' => 'button grey small',
|
||||||
),
|
),
|
||||||
'Edit'),
|
pht('Edit')),
|
||||||
javelin_tag(
|
javelin_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
|
@ -107,16 +113,17 @@ final class PhabricatorRepositoryListController
|
||||||
'class' => 'button grey small',
|
'class' => 'button grey small',
|
||||||
'sigil' => 'workflow',
|
'sigil' => 'workflow',
|
||||||
),
|
),
|
||||||
'Delete'),
|
pht('Delete')),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$project_table = new AphrontTableView($rows);
|
$project_table = new AphrontTableView($rows);
|
||||||
|
$project_table->setNoDataString(pht('No Arcanist Projects'));
|
||||||
$project_table->setHeaders(
|
$project_table->setHeaders(
|
||||||
array(
|
array(
|
||||||
'Project ID',
|
pht('Project ID'),
|
||||||
'Repository',
|
pht('Repository'),
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
));
|
));
|
||||||
|
@ -136,18 +143,21 @@ final class PhabricatorRepositoryListController
|
||||||
$is_admin,
|
$is_admin,
|
||||||
));
|
));
|
||||||
|
|
||||||
$project_panel = new AphrontPanelView();
|
$project_panel = new PHUIObjectBoxView();
|
||||||
$project_panel->setHeader('Arcanist Projects');
|
$project_panel->setHeaderText(pht('Arcanist Projects'));
|
||||||
$project_panel->appendChild($project_table);
|
$project_panel->appendChild($project_table);
|
||||||
$project_panel->setNoBackground();
|
|
||||||
|
|
||||||
return $this->buildStandardPageResponse(
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
$crumbs->addTextCrumb(pht('Repository List'));
|
||||||
|
|
||||||
|
return $this->buildApplicationPage(
|
||||||
array(
|
array(
|
||||||
|
$crumbs,
|
||||||
$panel,
|
$panel,
|
||||||
$project_panel,
|
$project_panel,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'title' => 'Repository List',
|
'title' => pht('Repository List'),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue