mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-15 10:00:55 +01:00
(stable) Promote 2017 Week 27
This commit is contained in:
commit
eed68de999
20 changed files with 279 additions and 359 deletions
|
@ -74,6 +74,7 @@ return array(
|
|||
'rsrc/css/application/diffusion/diffusion-history.css' => '4540f568',
|
||||
'rsrc/css/application/diffusion/diffusion-icons.css' => 'a6a1e2ba',
|
||||
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
|
||||
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
|
||||
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
|
||||
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
|
||||
'rsrc/css/application/files/global-drag-and-drop.css' => '5c1b47c2',
|
||||
|
@ -572,6 +573,7 @@ return array(
|
|||
'diffusion-history-css' => '4540f568',
|
||||
'diffusion-icons-css' => 'a6a1e2ba',
|
||||
'diffusion-readme-css' => '419dd5b6',
|
||||
'diffusion-repository-css' => 'ee6f20ec',
|
||||
'diffusion-source-css' => '750add59',
|
||||
'diviner-shared-css' => '896f1d43',
|
||||
'font-fontawesome' => 'e838e088',
|
||||
|
|
|
@ -71,8 +71,11 @@ final class DiffusionBranchTableController extends DiffusionController {
|
|||
->setHeader(pht('Branches'))
|
||||
->setHeaderIcon('fa-code-fork');
|
||||
|
||||
$tabs = $this->buildTabsView('branch');
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setTabs($tabs)
|
||||
->setFooter(array(
|
||||
$content,
|
||||
));
|
||||
|
|
|
@ -106,7 +106,6 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
$path = $drequest->getPath();
|
||||
|
||||
$blame_key = PhabricatorDiffusionBlameSetting::SETTINGKEY;
|
||||
|
||||
$show_blame = $request->getBool(
|
||||
'blame',
|
||||
$viewer->getUserSetting($blame_key));
|
||||
|
@ -160,6 +159,7 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
$hit_time_limit = $response['tooSlow'];
|
||||
|
||||
$file_phid = $response['filePHID'];
|
||||
$show_editor = false;
|
||||
if ($hit_byte_limit) {
|
||||
$corpus = $this->buildErrorCorpus(
|
||||
pht(
|
||||
|
@ -215,6 +215,7 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
} else {
|
||||
$this->loadLintMessages();
|
||||
$this->coverage = $drequest->loadCoverage();
|
||||
$show_editor = true;
|
||||
|
||||
// Build the content of the file.
|
||||
$corpus = $this->buildCorpus(
|
||||
|
@ -234,12 +235,7 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
require_celerity_resource('diffusion-source-css');
|
||||
|
||||
// Render the page.
|
||||
$view = $this->buildCurtain($drequest);
|
||||
$curtain = $this->enrichCurtain(
|
||||
$view,
|
||||
$drequest,
|
||||
$show_blame);
|
||||
|
||||
$curtain = $this->buildCurtain($drequest, $show_blame, $show_editor);
|
||||
$properties = $this->buildPropertyView($drequest);
|
||||
$header = $this->buildHeaderView($drequest);
|
||||
$header->setHeaderIcon('fa-file-code-o');
|
||||
|
@ -327,7 +323,7 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
|
||||
$reason = $results->getReasonForEmptyResultSet();
|
||||
|
||||
$curtain = $this->buildCurtain($drequest);
|
||||
$actions = $this->getActions($drequest);
|
||||
$details = $this->buildPropertyView($drequest);
|
||||
|
||||
$header = $this->buildHeaderView($drequest);
|
||||
|
@ -363,9 +359,9 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
->setPaths($results->getPaths())
|
||||
->setUser($request->getUser());
|
||||
|
||||
$browse_header = id(new PHUIHeaderView())
|
||||
->setHeader(nonempty(basename($drequest->getPath()), '/'))
|
||||
->setHeaderIcon('fa-folder-open');
|
||||
$title = nonempty(basename($drequest->getPath()), '/');
|
||||
$icon = 'fa-folder-open';
|
||||
$browse_header = $this->buildPanelHeaderView($title, $icon, $actions);
|
||||
|
||||
$browse_panel = id(new PHUIObjectBoxView())
|
||||
->setHeader($browse_header)
|
||||
|
@ -400,15 +396,11 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setCurtain($curtain)
|
||||
->setMainColumn(
|
||||
->setFooter(
|
||||
array(
|
||||
$branch_panel,
|
||||
$empty_result,
|
||||
$browse_panel,
|
||||
))
|
||||
->setFooter(
|
||||
array(
|
||||
$open_revisions,
|
||||
$readme,
|
||||
));
|
||||
|
@ -745,14 +737,14 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
|
||||
Javelin::initBehavior('load-blame', array('id' => $id));
|
||||
|
||||
|
||||
$edit = $this->renderEditButton();
|
||||
$file = $this->renderFileButton();
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(basename($this->getDiffusionRequest()->getPath()))
|
||||
->setHeaderIcon('fa-file-code-o')
|
||||
->addActionLink($edit)
|
||||
->addActionLink($file);
|
||||
$title = basename($this->getDiffusionRequest()->getPath());
|
||||
$icon = 'fa-file-code-o';
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$actions = $this->getActions($drequest);
|
||||
|
||||
$header = $this->buildPanelHeaderView($title, $icon, $actions);
|
||||
$header->addActionLink($file);
|
||||
|
||||
$corpus = id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
|
@ -791,14 +783,23 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
return $corpus;
|
||||
}
|
||||
|
||||
private function enrichCurtain(
|
||||
PHUICurtainView $curtain,
|
||||
private function buildCurtain(
|
||||
DiffusionRequest $drequest,
|
||||
$show_blame) {
|
||||
$show_blame,
|
||||
$show_editor) {
|
||||
|
||||
$curtain = $this->newCurtainView($drequest);
|
||||
$viewer = $this->getViewer();
|
||||
$base_uri = $this->getRequest()->getRequestURI();
|
||||
|
||||
$user = $this->getRequest()->getUser();
|
||||
$repository = $drequest->getRepository();
|
||||
$path = $drequest->getPath();
|
||||
$line = nonempty((int)$drequest->getLine(), 1);
|
||||
|
||||
$editor_link = $user->loadEditorLink($path, $line, $repository);
|
||||
$template = $user->loadEditorLink($path, '%l', $repository);
|
||||
|
||||
$curtain->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('Show Last Change'))
|
||||
|
@ -827,6 +828,15 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
->setUser($viewer)
|
||||
->setRenderAsForm($viewer->isLoggedIn()));
|
||||
|
||||
$curtain->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('Open in Editor'))
|
||||
->setHref($editor_link)
|
||||
->setIcon('fa-pencil')
|
||||
->setID('editor_link')
|
||||
->setMetadata(array('link_template' => $template))
|
||||
->setDisabled(!$editor_link));
|
||||
|
||||
$href = null;
|
||||
if ($this->getRequest()->getStr('lint') !== null) {
|
||||
$lint_text = pht('Hide %d Lint Message(s)', count($this->lintMessages));
|
||||
|
@ -897,41 +907,16 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
return $curtain;
|
||||
}
|
||||
|
||||
private function renderEditButton() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
|
||||
$repository = $drequest->getRepository();
|
||||
$path = $drequest->getPath();
|
||||
$line = nonempty((int)$drequest->getLine(), 1);
|
||||
|
||||
$editor_link = $user->loadEditorLink($path, $line, $repository);
|
||||
$template = $user->loadEditorLink($path, '%l', $repository);
|
||||
|
||||
$button = id(new PHUIButtonView())
|
||||
->setTag('a')
|
||||
->setText(pht('Open in Editor'))
|
||||
->setHref($editor_link)
|
||||
->setIcon('fa-pencil')
|
||||
->setID('editor_link')
|
||||
->setMetadata(array('link_template' => $template))
|
||||
->setDisabled(!$editor_link);
|
||||
|
||||
return $button;
|
||||
}
|
||||
|
||||
private function renderFileButton($file_uri = null, $label = null) {
|
||||
|
||||
$base_uri = $this->getRequest()->getRequestURI();
|
||||
|
||||
if ($file_uri) {
|
||||
$text = pht('Download Raw File');
|
||||
$text = pht('Download Raw');
|
||||
$href = $file_uri;
|
||||
$icon = 'fa-download';
|
||||
} else {
|
||||
$text = pht('View Raw File');
|
||||
$text = pht('View Raw');
|
||||
$href = $base_uri->alter('view', 'raw');
|
||||
$icon = 'fa-file-text';
|
||||
}
|
||||
|
@ -1374,10 +1359,12 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
)));
|
||||
|
||||
$file = $this->renderFileButton($file_uri);
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(basename($this->getDiffusionRequest()->getPath()))
|
||||
->addActionLink($file)
|
||||
->setHeaderIcon('fa-file-image-o');
|
||||
$title = basename($this->getDiffusionRequest()->getPath());
|
||||
$icon = 'fa-file-image-o';
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$actions = $this->getActions($drequest);
|
||||
$header = $this->buildPanelHeaderView($title, $icon, $actions);
|
||||
$header->addActionLink($file);
|
||||
|
||||
return id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
|
@ -1393,9 +1380,12 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
->appendChild($text);
|
||||
|
||||
$file = $this->renderFileButton($file_uri);
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(pht('Details'))
|
||||
->addActionLink($file);
|
||||
$title = basename($this->getDiffusionRequest()->getPath());
|
||||
$icon = 'fa-file';
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$actions = $this->getActions($drequest);
|
||||
$header = $this->buildPanelHeaderView($title, $icon, $actions);
|
||||
$header->addActionLink($file);
|
||||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
|
@ -1656,52 +1646,61 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
return $header;
|
||||
}
|
||||
|
||||
protected function buildCurtain(DiffusionRequest $drequest) {
|
||||
protected function buildPanelHeaderView($title, $icon, array $actions) {
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($title)
|
||||
->setHeaderIcon($icon)
|
||||
->addClass('diffusion-panel-header-view');
|
||||
|
||||
foreach ($actions as $action_link) {
|
||||
if ($action_link) {
|
||||
$header->addActionLink($action_link);
|
||||
}
|
||||
}
|
||||
return $header;
|
||||
|
||||
}
|
||||
|
||||
protected function getActions(DiffusionRequest $drequest) {
|
||||
$viewer = $this->getViewer();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$curtain = $this->newCurtainView($drequest);
|
||||
|
||||
$history_uri = $drequest->generateURI(
|
||||
array(
|
||||
'action' => 'history',
|
||||
));
|
||||
|
||||
$curtain->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('View History'))
|
||||
->setHref($history_uri)
|
||||
->setIcon('fa-list'));
|
||||
|
||||
$history_uri = $drequest->generateURI(array('action' => 'history'));
|
||||
$behind_head = $drequest->getSymbolicCommit();
|
||||
|
||||
if ($repository->supportsBranchComparison()) {
|
||||
$compare_uri = $drequest->generateURI(
|
||||
array(
|
||||
'action' => 'compare',
|
||||
));
|
||||
|
||||
$curtain->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('Compare Against...'))
|
||||
->setIcon('fa-code-fork')
|
||||
->setWorkflow(true)
|
||||
->setHref($compare_uri));
|
||||
}
|
||||
|
||||
$head_uri = $drequest->generateURI(
|
||||
array(
|
||||
'commit' => '',
|
||||
'action' => 'browse',
|
||||
));
|
||||
$curtain->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('Jump to HEAD'))
|
||||
|
||||
if ($repository->supportsBranchComparison()) {
|
||||
$compare_uri = $drequest->generateURI(array('action' => 'compare'));
|
||||
$compare = id(new PHUIButtonView())
|
||||
->setText(pht('Compare'))
|
||||
->setIcon('fa-code-fork')
|
||||
->setWorkflow(true)
|
||||
->setTag('a')
|
||||
->setHref($compare_uri)
|
||||
->setColor(PHUIButtonView::GREY);
|
||||
}
|
||||
|
||||
$head = null;
|
||||
if ($behind_head) {
|
||||
$head = id(new PHUIButtonView())
|
||||
->setText(pht('Back to HEAD'))
|
||||
->setHref($head_uri)
|
||||
->setIcon('fa-home')
|
||||
->setDisabled(!$behind_head));
|
||||
->setColor(PHUIButtonView::GREY);
|
||||
}
|
||||
|
||||
return $curtain;
|
||||
$history = id(new PHUIButtonView())
|
||||
->setText(pht('History'))
|
||||
->setHref($history_uri)
|
||||
->setTag('a')
|
||||
->setIcon('fa-history')
|
||||
->setColor(PHUIButtonView::GREY);
|
||||
|
||||
return array($history, $compare, $head);
|
||||
}
|
||||
|
||||
protected function buildPropertyView(
|
||||
|
@ -1902,9 +1901,11 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
// show the user an error if we can't, rather than making them click
|
||||
// through to hit an error.
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(basename($this->getDiffusionRequest()->getPath()))
|
||||
->setHeaderIcon('fa-archive');
|
||||
$title = basename($this->getDiffusionRequest()->getPath());
|
||||
$icon = 'fa-archive';
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$actions = $this->getActions($drequest);
|
||||
$header = $this->buildPanelHeaderView($title, $icon, $actions);
|
||||
|
||||
$severity = PHUIInfoView::SEVERITY_NOTICE;
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
private function loadContext(array $options) {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $this->getViewer();
|
||||
require_celerity_resource('diffusion-repository-css');
|
||||
|
||||
$identifier = $this->getRepositoryIdentifierFromRequest($request);
|
||||
|
||||
|
@ -122,10 +123,10 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
private function buildCrumbList(array $spec = array()) {
|
||||
|
||||
$spec = $spec + array(
|
||||
'commit' => null,
|
||||
'tags' => null,
|
||||
'branches' => null,
|
||||
'view' => null,
|
||||
'commit' => null,
|
||||
'tags' => null,
|
||||
'branches' => null,
|
||||
'view' => null,
|
||||
);
|
||||
|
||||
$crumb_list = array();
|
||||
|
@ -314,7 +315,7 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
|
||||
protected function renderStatusMessage($title, $body) {
|
||||
return id(new PHUIInfoView())
|
||||
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
|
||||
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
|
||||
->setTitle($title)
|
||||
->setFlush(true)
|
||||
->appendChild($body);
|
||||
|
@ -409,4 +410,74 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
->setContent($readme_corpus);
|
||||
}
|
||||
|
||||
protected function buildTabsView($key) {
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$view = new PHUIListView();
|
||||
|
||||
$view->addMenuItem(
|
||||
id(new PHUIListItemView())
|
||||
->setKey('home')
|
||||
->setName(pht('Home'))
|
||||
->setIcon('fa-home')
|
||||
->setHref($drequest->generateURI(
|
||||
array(
|
||||
'action' => 'branch',
|
||||
'path' => '/',
|
||||
)))
|
||||
->setSelected($key == 'home'));
|
||||
|
||||
if (!$repository->isSVN()) {
|
||||
$view->addMenuItem(
|
||||
id(new PHUIListItemView())
|
||||
->setKey('branch')
|
||||
->setName(pht('Branches'))
|
||||
->setIcon('fa-code-fork')
|
||||
->setHref($drequest->generateURI(
|
||||
array(
|
||||
'action' => 'branches',
|
||||
)))
|
||||
->setSelected($key == 'branch'));
|
||||
}
|
||||
|
||||
if (!$repository->isSVN()) {
|
||||
$view->addMenuItem(
|
||||
id(new PHUIListItemView())
|
||||
->setKey('tags')
|
||||
->setName(pht('Tags'))
|
||||
->setIcon('fa-tags')
|
||||
->setHref($drequest->generateURI(
|
||||
array(
|
||||
'action' => 'tags',
|
||||
)))
|
||||
->setSelected($key == 'tags'));
|
||||
}
|
||||
|
||||
$view->addMenuItem(
|
||||
id(new PHUIListItemView())
|
||||
->setKey('history')
|
||||
->setName(pht('History'))
|
||||
->setIcon('fa-history')
|
||||
->setHref($drequest->generateURI(
|
||||
array(
|
||||
'action' => 'history',
|
||||
)))
|
||||
->setSelected($key == 'history'));
|
||||
|
||||
$view->addMenuItem(
|
||||
id(new PHUIListItemView())
|
||||
->setKey('graph')
|
||||
->setName(pht('Graph'))
|
||||
->setIcon('fa-code-fork')
|
||||
->setHref($drequest->generateURI(
|
||||
array(
|
||||
'action' => 'graph',
|
||||
)))
|
||||
->setSelected($key == 'graph'));
|
||||
|
||||
return $view;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,8 +68,11 @@ final class DiffusionGraphController extends DiffusionController {
|
|||
->setTable($graph)
|
||||
->setPager($pager);
|
||||
|
||||
$tabs = $this->buildTabsView('graph');
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setTabs($tabs)
|
||||
->setFooter($graph_view);
|
||||
|
||||
return $this->newPage()
|
||||
|
@ -81,25 +84,17 @@ final class DiffusionGraphController extends DiffusionController {
|
|||
private function buildHeader(DiffusionRequest $drequest) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$tag = $this->renderCommitHashTag($drequest);
|
||||
$history_uri = $drequest->generateURI(
|
||||
array(
|
||||
'action' => 'history',
|
||||
));
|
||||
|
||||
$history_button = id(new PHUIButtonView())
|
||||
->setTag('a')
|
||||
->setText(pht('History'))
|
||||
->setHref($history_uri)
|
||||
->setIcon('fa-history');
|
||||
$no_path = !strlen($drequest->getPath());
|
||||
if ($no_path) {
|
||||
$header_text = pht('Graph');
|
||||
} else {
|
||||
$header_text = $this->renderPathLinks($drequest, $mode = 'history');
|
||||
}
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setUser($viewer)
|
||||
->setPolicyObject($drequest->getRepository())
|
||||
->addTag($tag)
|
||||
->setHeader($this->renderPathLinks($drequest, $mode = 'history'))
|
||||
->setHeaderIcon('fa-code-fork')
|
||||
->addActionLink($history_button);
|
||||
->setHeader($header_text)
|
||||
->setHeaderIcon('fa-code-fork');
|
||||
|
||||
return $header;
|
||||
|
||||
|
|
|
@ -59,8 +59,11 @@ final class DiffusionHistoryController extends DiffusionController {
|
|||
->addClass('mlb')
|
||||
->appendChild($pager);
|
||||
|
||||
$tabs = $this->buildTabsView('history');
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setTabs($tabs)
|
||||
->setFooter(array(
|
||||
$history_list,
|
||||
$pager,
|
||||
|
@ -76,30 +79,18 @@ final class DiffusionHistoryController extends DiffusionController {
|
|||
private function buildHeader(DiffusionRequest $drequest) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$tag = $this->renderCommitHashTag($drequest);
|
||||
$show_graph = !strlen($drequest->getPath());
|
||||
$no_path = !strlen($drequest->getPath());
|
||||
if ($no_path) {
|
||||
$header_text = pht('History');
|
||||
} else {
|
||||
$header_text = $this->renderPathLinks($drequest, $mode = 'history');
|
||||
}
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setUser($viewer)
|
||||
->setPolicyObject($drequest->getRepository())
|
||||
->addTag($tag)
|
||||
->setHeader($this->renderPathLinks($drequest, $mode = 'history'))
|
||||
->setHeader($header_text)
|
||||
->setHeaderIcon('fa-clock-o');
|
||||
|
||||
if ($show_graph) {
|
||||
$graph_uri = $drequest->generateURI(
|
||||
array(
|
||||
'action' => 'graph',
|
||||
));
|
||||
|
||||
$graph_button = id(new PHUIButtonView())
|
||||
->setTag('a')
|
||||
->setText(pht('Graph'))
|
||||
->setHref($graph_uri)
|
||||
->setIcon('fa-code-fork');
|
||||
$header->addActionLink($graph_button);
|
||||
}
|
||||
|
||||
return $header;
|
||||
|
||||
}
|
||||
|
|
|
@ -84,9 +84,12 @@ final class DiffusionRepositoryController extends DiffusionController {
|
|||
->setErrors(array($empty_message));
|
||||
}
|
||||
|
||||
$tabs = $this->buildTabsView('home');
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setCurtain($curtain)
|
||||
->setTabs($tabs)
|
||||
->setMainColumn(array(
|
||||
$property_table,
|
||||
$description,
|
||||
|
@ -134,32 +137,9 @@ final class DiffusionRepositoryController extends DiffusionController {
|
|||
'limit' => $browse_pager->getPageSize() + 1,
|
||||
));
|
||||
|
||||
if ($this->needTagFuture()) {
|
||||
$tag_limit = $this->getTagLimit();
|
||||
$this->tagFuture = $this->callConduitMethod(
|
||||
'diffusion.tagsquery',
|
||||
array(
|
||||
// On the home page, we want to find tags on any branch.
|
||||
'commit' => null,
|
||||
'limit' => $tag_limit + 1,
|
||||
));
|
||||
}
|
||||
|
||||
if ($this->needBranchFuture()) {
|
||||
$branch_limit = $this->getBranchLimit();
|
||||
$this->branchFuture = $this->callConduitMethod(
|
||||
'diffusion.branchquery',
|
||||
array(
|
||||
'closed' => false,
|
||||
'limit' => $branch_limit + 1,
|
||||
));
|
||||
}
|
||||
|
||||
$futures = array(
|
||||
$this->historyFuture,
|
||||
$this->browseFuture,
|
||||
$this->tagFuture,
|
||||
$this->branchFuture,
|
||||
);
|
||||
$futures = array_filter($futures);
|
||||
$futures = new FutureIterator($futures);
|
||||
|
@ -241,26 +221,6 @@ final class DiffusionRepositoryController extends DiffusionController {
|
|||
$history,
|
||||
$history_exception);
|
||||
|
||||
try {
|
||||
$content[] = $this->buildTagListTable($drequest);
|
||||
} catch (Exception $ex) {
|
||||
if (!$repository->isImporting()) {
|
||||
$content[] = $this->renderStatusMessage(
|
||||
pht('Unable to Load Tags'),
|
||||
$ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$content[] = $this->buildBranchListTable($drequest);
|
||||
} catch (Exception $ex) {
|
||||
if (!$repository->isImporting()) {
|
||||
$content[] = $this->renderStatusMessage(
|
||||
pht('Unable to Load Branches'),
|
||||
$ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ($readme) {
|
||||
$content[] = $readme;
|
||||
}
|
||||
|
@ -366,6 +326,12 @@ final class DiffusionRepositoryController extends DiffusionController {
|
|||
$this->renderCloneURI($repository, $uri));
|
||||
}
|
||||
|
||||
if (!$view->hasAnyProperties()) {
|
||||
$view = id(new PHUIInfoView())
|
||||
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
|
||||
->appendChild(pht('Repository has no URIs set.'));
|
||||
}
|
||||
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Details'))
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
|
@ -412,123 +378,6 @@ final class DiffusionRepositoryController extends DiffusionController {
|
|||
return $box;
|
||||
}
|
||||
|
||||
private function buildBranchListTable(DiffusionRequest $drequest) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
if (!$this->needBranchFuture()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$branches = $this->branchFuture->resolve();
|
||||
if (!$branches) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$limit = $this->getBranchLimit();
|
||||
$more_branches = (count($branches) > $limit);
|
||||
$branches = array_slice($branches, 0, $limit);
|
||||
|
||||
$branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
|
||||
|
||||
$commits = id(new DiffusionCommitQuery())
|
||||
->setViewer($viewer)
|
||||
->withIdentifiers(mpull($branches, 'getCommitIdentifier'))
|
||||
->withRepository($drequest->getRepository())
|
||||
->execute();
|
||||
|
||||
$table = id(new DiffusionBranchTableView())
|
||||
->setUser($viewer)
|
||||
->setDiffusionRequest($drequest)
|
||||
->setBranches($branches)
|
||||
->setCommits($commits);
|
||||
|
||||
$panel = id(new PHUIObjectBoxView())
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
|
||||
$header = new PHUIHeaderView();
|
||||
$header->setHeader(pht('Branches'));
|
||||
|
||||
if ($more_branches) {
|
||||
$header->setSubheader(pht('Showing %d branches.', $limit));
|
||||
}
|
||||
|
||||
$button = id(new PHUIButtonView())
|
||||
->setText(pht('Show All'))
|
||||
->setTag('a')
|
||||
->setIcon('fa-code-fork')
|
||||
->setHref($drequest->generateURI(
|
||||
array(
|
||||
'action' => 'branches',
|
||||
)));
|
||||
|
||||
$header->addActionLink($button);
|
||||
$panel->setHeader($header);
|
||||
$panel->setTable($table);
|
||||
|
||||
return $panel;
|
||||
}
|
||||
|
||||
private function buildTagListTable(DiffusionRequest $drequest) {
|
||||
$viewer = $this->getViewer();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
if (!$this->needTagFuture()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$tags = $this->tagFuture->resolve();
|
||||
$tags = DiffusionRepositoryTag::newFromConduit($tags);
|
||||
if (!$tags) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$tag_limit = $this->getTagLimit();
|
||||
$more_tags = (count($tags) > $tag_limit);
|
||||
$tags = array_slice($tags, 0, $tag_limit);
|
||||
|
||||
$commits = id(new DiffusionCommitQuery())
|
||||
->setViewer($viewer)
|
||||
->withIdentifiers(mpull($tags, 'getCommitIdentifier'))
|
||||
->withRepository($repository)
|
||||
->needCommitData(true)
|
||||
->execute();
|
||||
|
||||
$view = id(new DiffusionTagTableView())
|
||||
->setUser($viewer)
|
||||
->setDiffusionRequest($drequest)
|
||||
->setTags($tags)
|
||||
->setCommits($commits);
|
||||
|
||||
$phids = $view->getRequiredHandlePHIDs();
|
||||
$handles = $this->loadViewerHandles($phids);
|
||||
$view->setHandles($handles);
|
||||
|
||||
$panel = new PHUIObjectBoxView();
|
||||
$header = new PHUIHeaderView();
|
||||
$header->setHeader(pht('Tags'));
|
||||
|
||||
if ($more_tags) {
|
||||
$header->setSubheader(
|
||||
pht('Showing the %d most recent tags.', $tag_limit));
|
||||
}
|
||||
|
||||
$button = id(new PHUIButtonView())
|
||||
->setText(pht('Show All Tags'))
|
||||
->setTag('a')
|
||||
->setIcon('fa-tag')
|
||||
->setHref($drequest->generateURI(
|
||||
array(
|
||||
'action' => 'tags',
|
||||
)));
|
||||
|
||||
$header->addActionLink($button);
|
||||
|
||||
$panel->setHeader($header);
|
||||
$panel->setTable($view);
|
||||
$panel->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
|
||||
|
||||
return $panel;
|
||||
}
|
||||
|
||||
private function buildHistoryTable(
|
||||
$history_results,
|
||||
$history,
|
||||
|
@ -567,30 +416,10 @@ final class DiffusionRepositoryController extends DiffusionController {
|
|||
|
||||
$history_table->setIsHead(true);
|
||||
|
||||
$history = id(new PHUIButtonView())
|
||||
->setText(pht('History'))
|
||||
->setHref($drequest->generateURI(
|
||||
array(
|
||||
'action' => 'history',
|
||||
)))
|
||||
->setTag('a')
|
||||
->setIcon('fa-history');
|
||||
|
||||
$graph = id(new PHUIButtonView())
|
||||
->setText(pht('Graph'))
|
||||
->setHref($drequest->generateURI(
|
||||
array(
|
||||
'action' => 'graph',
|
||||
)))
|
||||
->setTag('a')
|
||||
->setIcon('fa-code-fork');
|
||||
|
||||
$panel = id(new PHUIObjectBoxView())
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(pht('Recent Commits'))
|
||||
->addActionLink($graph)
|
||||
->addActionLink($history);
|
||||
->setHeader(pht('Recent Commits'));
|
||||
$panel->setHeader($header);
|
||||
$panel->setTable($history_table);
|
||||
|
||||
|
@ -721,35 +550,8 @@ final class DiffusionRepositoryController extends DiffusionController {
|
|||
->setDisplayURI($display);
|
||||
}
|
||||
|
||||
private function needTagFuture() {
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
switch ($repository->getVersionControlSystem()) {
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||
// No tags in SVN.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function getTagLimit() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
private function needBranchFuture() {
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
|
||||
if ($drequest->getBranch() === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function getBranchLimit() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,8 +88,11 @@ final class DiffusionTagListController extends DiffusionController {
|
|||
));
|
||||
$crumbs->setBorder(true);
|
||||
|
||||
$tabs = $this->buildTabsView('tags');
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setTabs($tabs)
|
||||
->setFooter($content);
|
||||
|
||||
return $this->newPage()
|
||||
|
|
|
@ -54,7 +54,7 @@ final class DiffusionRepositoryDatasource
|
|||
$parts[] = $monogram;
|
||||
}
|
||||
|
||||
$name = implode(' ', $parts);
|
||||
$name = implode("\n", $parts);
|
||||
|
||||
$vcs = $repository->getVersionControlSystem();
|
||||
$vcs_type = PhabricatorRepositoryType::getNameForRepositoryType($vcs);
|
||||
|
|
|
@ -98,8 +98,12 @@ final class DiffusionReadmeView extends DiffusionView {
|
|||
->setFluid(true)
|
||||
->appendChild($readme_content);
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($readme_name)
|
||||
->addClass('diffusion-panel-header-view');
|
||||
|
||||
return id(new PHUIObjectBoxView())
|
||||
->setHeaderText($readme_name)
|
||||
->setHeader($header)
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->appendChild($document)
|
||||
->addClass('diffusion-readme-view');
|
||||
|
|
|
@ -42,8 +42,9 @@ final class PhamePostArchiveController extends PhamePostController {
|
|||
|
||||
$title = pht('Archive Post');
|
||||
$body = pht(
|
||||
'This post will revert to archived status and no longer be visible '.
|
||||
'to other users or members of this blog.');
|
||||
'If you archive this post, it will only be visible to users who can '.
|
||||
'edit %s.',
|
||||
$viewer->renderHandle($post->getBlogPHID()));
|
||||
$button = pht('Archive Post');
|
||||
|
||||
return $this->newDialog()
|
||||
|
|
|
@ -46,8 +46,10 @@ final class PhamePostViewController
|
|||
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
|
||||
->setTitle(pht('Draft Post'))
|
||||
->appendChild(
|
||||
pht('Only you can see this draft until you publish it. '.
|
||||
'Use "Publish" to publish this post.')));
|
||||
pht(
|
||||
'This is a draft, and is only visible to you and other users '.
|
||||
'who can edit %s. Use "Publish" to publish this post.',
|
||||
$viewer->renderHandle($post->getBlogPHID()))));
|
||||
}
|
||||
|
||||
if ($post->isArchived()) {
|
||||
|
@ -56,8 +58,10 @@ final class PhamePostViewController
|
|||
->setSeverity(PHUIInfoView::SEVERITY_ERROR)
|
||||
->setTitle(pht('Archived Post'))
|
||||
->appendChild(
|
||||
pht('Only you can see this archived post until you publish it. '.
|
||||
'Use "Publish" to publish this post.')));
|
||||
pht(
|
||||
'This post has been archived, and is only visible to you and '.
|
||||
'other users who can edit %s.',
|
||||
$viewer->renderHandle($post->getBlogPHID()))));
|
||||
}
|
||||
|
||||
if (!$post->getBlog()) {
|
||||
|
|
|
@ -200,8 +200,9 @@ final class PhamePost extends PhameDAO
|
|||
}
|
||||
|
||||
public function getPolicy($capability) {
|
||||
// Draft posts are visible only to the author. Published posts are visible
|
||||
// to whoever the blog is visible to.
|
||||
// Draft and archived posts are visible only to the author and other
|
||||
// users who can edit the blog. Published posts are visible to whoever
|
||||
// the blog is visible to.
|
||||
|
||||
switch ($capability) {
|
||||
case PhabricatorPolicyCapability::CAN_VIEW:
|
||||
|
|
|
@ -50,8 +50,9 @@ final class PhortuneSubscriptionProduct
|
|||
public function didPurchaseProduct(
|
||||
PhortuneProduct $product,
|
||||
PhortunePurchase $purchase) {
|
||||
// TODO: Callback the subscription.
|
||||
return;
|
||||
return $this->getSubscription()->didPurchaseProduct(
|
||||
$product,
|
||||
$purchase);
|
||||
}
|
||||
|
||||
public function didRefundProduct(
|
||||
|
|
|
@ -232,6 +232,15 @@ final class PhortuneSubscription extends PhortuneDAO
|
|||
$purchase);
|
||||
}
|
||||
|
||||
public function didPurchaseProduct(
|
||||
PhortuneProduct $product,
|
||||
PhortunePurchase $purchase) {
|
||||
return $this->getImplementation()->didPurchaseProduct(
|
||||
$this,
|
||||
$product,
|
||||
$purchase);
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
|
|
@ -48,4 +48,12 @@ abstract class PhortuneSubscriptionImplementation extends Phobject {
|
|||
PhortunePurchase $purchase) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function didPurchaseProduct(
|
||||
PhortuneSubscription $subscription,
|
||||
PhortuneProduct $product,
|
||||
PhortunePurchase $purchase) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ final class RepositoryQueryConduitAPIMethod
|
|||
public function getMethodStatusDescription() {
|
||||
return pht(
|
||||
'This method is frozen and will eventually be deprecated. New code '.
|
||||
'should use "diffusion.repository.query" instead.');
|
||||
'should use "diffusion.repository.search" instead.');
|
||||
}
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -24,6 +24,12 @@ same steps you would if you were creating a backup and then restoring it, you
|
|||
will just backup the old machine and then restore the data onto the new
|
||||
machine.
|
||||
|
||||
WARNING: You need to restart Phabricator after restoring data.
|
||||
|
||||
Restarting Phabricator after performing a restore makes sure that caches are
|
||||
flushed properly. For complete instructions, see
|
||||
@{article:Restarting Phabricator}.
|
||||
|
||||
|
||||
Backup: MySQL Databases
|
||||
=======================
|
||||
|
|
|
@ -119,6 +119,11 @@ final class PhabricatorActionView extends AphrontView {
|
|||
return $this->openInNewWindow;
|
||||
}
|
||||
|
||||
public function setID($id) {
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getID() {
|
||||
if (!$this->id) {
|
||||
$this->id = celerity_generate_unique_node_id();
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* @provides diffusion-repository-css
|
||||
*/
|
||||
|
||||
.diffusion-page-header-view a.phui-header-action-link {
|
||||
display: block;
|
||||
float: none;
|
||||
}
|
||||
|
||||
.phui-box.phui-object-box.phui-box-blue-property
|
||||
.diffusion-panel-header-view.phui-header-shell {
|
||||
padding: 8px 4px 8px 16px;
|
||||
}
|
Loading…
Reference in a new issue