mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Restore "Shortcuts" feature to Diffusion.
This commit is contained in:
parent
c99df1f4eb
commit
34e8d902c7
6 changed files with 90 additions and 1 deletions
7
resources/sql/patches/014.shortcuts.sql
Normal file
7
resources/sql/patches/014.shortcuts.sql
Normal file
|
@ -0,0 +1,7 @@
|
|||
CREATE TABLE phabricator_repository.repository_shortcut (
|
||||
id int unsigned not null auto_increment primary key,
|
||||
name varchar(255) not null,
|
||||
href varchar(255) not null,
|
||||
description varchar(255) not null,
|
||||
sequence int unsigned not null
|
||||
);
|
|
@ -357,6 +357,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorRepositoryGitHubNotification' => 'applications/repository/storage/githubnotification',
|
||||
'PhabricatorRepositoryGitHubPostReceiveController' => 'applications/repository/controller/github-post-receive',
|
||||
'PhabricatorRepositoryListController' => 'applications/repository/controller/list',
|
||||
'PhabricatorRepositoryShortcut' => 'applications/repository/storage/shortcut',
|
||||
'PhabricatorRepositorySvnCommitChangeParserWorker' => 'applications/repository/worker/commitchangeparser/svn',
|
||||
'PhabricatorRepositorySvnCommitDiscoveryDaemon' => 'applications/repository/daemon/commitdiscovery/svn',
|
||||
'PhabricatorRepositorySvnCommitMessageParserWorker' => 'applications/repository/worker/commitmessageparser/svn',
|
||||
|
@ -692,6 +693,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorRepositoryGitHubNotification' => 'PhabricatorRepositoryDAO',
|
||||
'PhabricatorRepositoryGitHubPostReceiveController' => 'PhabricatorRepositoryController',
|
||||
'PhabricatorRepositoryListController' => 'PhabricatorRepositoryController',
|
||||
'PhabricatorRepositoryShortcut' => 'PhabricatorRepositoryDAO',
|
||||
'PhabricatorRepositorySvnCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker',
|
||||
'PhabricatorRepositorySvnCommitDiscoveryDaemon' => 'PhabricatorRepositoryCommitDiscoveryDaemon',
|
||||
'PhabricatorRepositorySvnCommitMessageParserWorker' => 'PhabricatorRepositoryCommitMessageParserWorker',
|
||||
|
|
|
@ -20,7 +20,41 @@ class DiffusionHomeController extends DiffusionController {
|
|||
|
||||
public function processRequest() {
|
||||
|
||||
// TODO: Restore "shortcuts" feature.
|
||||
$shortcuts = id(new PhabricatorRepositoryShortcut())->loadAll();
|
||||
if ($shortcuts) {
|
||||
$shortcuts = msort($shortcuts, 'getSequence');
|
||||
|
||||
$rows = array();
|
||||
foreach ($shortcuts as $shortcut) {
|
||||
$rows[] = array(
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $shortcut->getHref(),
|
||||
),
|
||||
phutil_escape_html($shortcut->getName())),
|
||||
phutil_escape_html($shortcut->getDescription()),
|
||||
);
|
||||
}
|
||||
|
||||
$shortcut_table = new AphrontTableView($rows);
|
||||
$shortcut_table->setHeaders(
|
||||
array(
|
||||
'Link',
|
||||
'',
|
||||
));
|
||||
$shortcut_table->setColumnClasses(
|
||||
array(
|
||||
'pri',
|
||||
'wide',
|
||||
));
|
||||
|
||||
$shortcut_panel = new AphrontPanelView();
|
||||
$shortcut_panel->setHeader('Shortcuts');
|
||||
$shortcut_panel->appendChild($shortcut_table);
|
||||
} else {
|
||||
$shortcut_panel = null;
|
||||
}
|
||||
|
||||
$repository = new PhabricatorRepository();
|
||||
|
||||
|
@ -113,6 +147,7 @@ class DiffusionHomeController extends DiffusionController {
|
|||
return $this->buildStandardPageResponse(
|
||||
array(
|
||||
$crumbs,
|
||||
$shortcut_panel,
|
||||
$panel,
|
||||
),
|
||||
array(
|
||||
|
|
|
@ -11,6 +11,7 @@ phutil_require_module('phabricator', 'applications/diffusion/view/base');
|
|||
phutil_require_module('phabricator', 'applications/repository/constants/repositorytype');
|
||||
phutil_require_module('phabricator', 'applications/repository/storage/commit');
|
||||
phutil_require_module('phabricator', 'applications/repository/storage/repository');
|
||||
phutil_require_module('phabricator', 'applications/repository/storage/shortcut');
|
||||
phutil_require_module('phabricator', 'storage/queryfx');
|
||||
phutil_require_module('phabricator', 'view/control/table');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class PhabricatorRepositoryShortcut extends PhabricatorRepositoryDAO {
|
||||
|
||||
protected $name;
|
||||
protected $href;
|
||||
protected $description;
|
||||
protected $sequence;
|
||||
|
||||
public function getConfiguration() {
|
||||
return array(
|
||||
self::CONFIG_TIMESTAMPS => false,
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
}
|
12
src/applications/repository/storage/shortcut/__init__.php
Normal file
12
src/applications/repository/storage/shortcut/__init__.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/repository/storage/base');
|
||||
|
||||
|
||||
phutil_require_source('PhabricatorRepositoryShortcut.php');
|
Loading…
Reference in a new issue