1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Unify headsup action lists.

Summary:

Test Plan:

Reviewers:

CC:
This commit is contained in:
epriestley 2011-02-20 12:50:28 -08:00
parent d919ddb808
commit c6c6a2cc4c
12 changed files with 257 additions and 31 deletions

View file

@ -43,6 +43,15 @@ celerity_register_resource_map(array(
),
'disk' => '/rsrc/css/aphront/form-view.css',
),
'aphront-headsup-action-list-view-css' =>
array(
'uri' => '/res/099b7588/rsrc/css/aphront/headsup-action-list-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/headsup-action-list-view.css',
),
'aphront-panel-view-css' =>
array(
'uri' => '/res/63672373/rsrc/css/aphront/panel-view.css',
@ -154,7 +163,7 @@ celerity_register_resource_map(array(
),
'differential-revision-detail-css' =>
array(
'uri' => '/res/7b5e95cc/rsrc/css/application/differential/revision-detail.css',
'uri' => '/res/623e3946/rsrc/css/application/differential/revision-detail.css',
'type' => 'css',
'requires' =>
array(
@ -486,7 +495,7 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/04b474ba/core.pkg.css',
'type' => 'css',
),
'fcf7ec68' =>
'76f3c1f8' =>
array (
'name' => 'differential.pkg.css',
'symbols' =>
@ -500,7 +509,7 @@ celerity_register_resource_map(array(
6 => 'differential-revision-add-comment-css',
7 => 'differential-revision-comment-list-css',
),
'uri' => '/res/pkg/fcf7ec68/differential.pkg.css',
'uri' => '/res/pkg/76f3c1f8/differential.pkg.css',
'type' => 'css',
),
'30d594cf' =>
@ -533,14 +542,14 @@ celerity_register_resource_map(array(
'phabricator-directory-css' => '04b474ba',
'phabricator-remarkup-css' => '04b474ba',
'syntax-highlighting-css' => '04b474ba',
'differential-core-view-css' => 'fcf7ec68',
'differential-changeset-view-css' => 'fcf7ec68',
'differential-revision-detail-css' => 'fcf7ec68',
'differential-revision-history-css' => 'fcf7ec68',
'differential-table-of-contents-css' => 'fcf7ec68',
'differential-revision-comment-css' => 'fcf7ec68',
'differential-revision-add-comment-css' => 'fcf7ec68',
'differential-revision-comment-list-css' => 'fcf7ec68',
'differential-core-view-css' => '76f3c1f8',
'differential-changeset-view-css' => '76f3c1f8',
'differential-revision-detail-css' => '76f3c1f8',
'differential-revision-history-css' => '76f3c1f8',
'differential-table-of-contents-css' => '76f3c1f8',
'differential-revision-comment-css' => '76f3c1f8',
'differential-revision-add-comment-css' => '76f3c1f8',
'differential-revision-comment-list-css' => '76f3c1f8',
'javelin-behavior-differential-feedback-preview' => '30d594cf',
'javelin-behavior-differential-edit-inline-comments' => '30d594cf',
'javelin-behavior-differential-populate' => '30d594cf',

View file

@ -35,6 +35,8 @@ phutil_register_library_map(array(
'AphrontFormTextControl' => 'view/form/control/text',
'AphrontFormTokenizerControl' => 'view/form/control/tokenizer',
'AphrontFormView' => 'view/form/base',
'AphrontHeadsupActionListView' => 'view/layout/headsup/actionlist',
'AphrontHeadsupActionView' => 'view/layout/headsup/action',
'AphrontMySQLDatabaseConnection' => 'storage/connection/mysql',
'AphrontNullView' => 'view/null',
'AphrontPageView' => 'view/page/base',
@ -312,6 +314,8 @@ phutil_register_library_map(array(
'AphrontFormTextControl' => 'AphrontFormControl',
'AphrontFormTokenizerControl' => 'AphrontFormControl',
'AphrontFormView' => 'AphrontView',
'AphrontHeadsupActionListView' => 'AphrontView',
'AphrontHeadsupActionView' => 'AphrontView',
'AphrontMySQLDatabaseConnection' => 'AphrontDatabaseConnection',
'AphrontNullView' => 'AphrontView',
'AphrontPageView' => 'AphrontView',

View file

@ -60,25 +60,20 @@ final class DifferentialRevisionDetailView extends AphrontView {
$actions = array();
foreach ($this->actions as $action) {
if (empty($action['href'])) {
$tag = 'span';
} else {
$tag = 'a';
$obj = new AphrontHeadsupActionView();
$obj->setName($action['name']);
$obj->setURI(idx($action, 'href'));
$obj->setWorkflow(idx($action, 'sigil') == 'workflow');
$obj->setClass(idx($action, 'class'));
$actions[] = $obj;
}
$name = $action['name'];
unset($action['name']);
$actions[] = javelin_render_tag(
$tag,
$action,
phutil_escape_html($name));
}
$actions = implode("\n", $actions);
$action_list = new AphrontHeadsupActionListView();
$action_list->setActions($actions);
return
'<div class="differential-revision-detail differential-panel">'.
'<div class="differential-revision-actions">'.
$actions.
'</div>'.
$action_list->render().
'<div class="differential-revision-detail-core">'.
'<h1>'.phutil_escape_html($revision->getTitle()).'</h1>'.
$properties.

View file

@ -7,10 +7,12 @@
phutil_require_module('phabricator', 'infrastructure/celerity/api');
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phabricator', 'view/base');
phutil_require_module('phabricator', 'view/layout/headsup/action');
phutil_require_module('phabricator', 'view/layout/headsup/actionlist');
phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');
phutil_require_source('DifferentialRevisionDetailView.php');

View file

@ -125,8 +125,31 @@ class ManiphestTaskDetailController extends ManiphestController {
implode("\n", $table).
'</table>';
$actions = array();
$action = new AphrontHeadsupActionView();
$action->setName('Edit Task');
$action->setURI('/maniphest/edit/'.$task->getID().'/');
$action->setClass('action-edit');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Upload File');
$action->setClass('action-upload unavailable');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Edit Differential Revisions');
$action->setClass('action-attach unavailable');
$actions[] = $action;
$action_list = new AphrontHeadsupActionListView();
$action_list->setActions($actions);
$panel =
'<div class="maniphest-panel">'.
$action_list->render().
'<div class="maniphest-task-detail-core">'.
'<h1>'.
phutil_escape_html('T'.$task->getID().' '.$task->getTitle()).

View file

@ -0,0 +1,69 @@
<?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.
*/
final class AphrontHeadsupActionView extends AphrontView {
private $name;
private $class;
private $uri;
private $workflow;
public function setName($name) {
$this->name = $name;
return $this;
}
public function setClass($class) {
$this->class = $class;
return $this;
}
public function setURI($uri) {
$this->uri = $uri;
return $this;
}
public function setWorkflow($workflow) {
$this->workflow = $workflow;
return $this;
}
public function render() {
if ($this->uri) {
$tag = 'a';
} else {
$tag = 'span';
}
$attrs = array(
'href' => $this->uri,
'class' => $this->class,
);
if ($this->workflow) {
$attrs['sigil'] = 'workflow';
}
return javelin_render_tag(
$tag,
$attrs,
phutil_escape_html($this->name));
}
}

View file

@ -0,0 +1,15 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phabricator', 'view/base');
phutil_require_module('phutil', 'markup');
phutil_require_source('AphrontHeadsupActionView.php');

View file

@ -0,0 +1,43 @@
<?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.
*/
final class AphrontHeadsupActionListView extends AphrontView {
private $actions;
public function setActions(array $actions) {
$this->actions = $actions;
}
public function render() {
require_celerity_resource('aphront-headsup-action-list-view-css');
$actions = array();
foreach ($this->actions as $action_view) {
$actions[] = $action_view->render();
}
$actions = implode("\n", $actions);
return
'<div class="aphront-headsup-action-list">'.
$actions.
'</div>';
}
}

View file

@ -0,0 +1,12 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'view/base');
phutil_require_source('AphrontHeadsupActionListView.php');

View file

@ -0,0 +1,53 @@
/**
* @provides aphront-headsup-action-list-view-css
*/
.aphront-headsup-action-list {
float: right;
width: 250px;
background: #cfcfbf;
border: 1px solid #666622;
border-width: 0px 0px 1px 1px;
margin: -15px -20px 1em 0;
font-size: 11px;
}
.aphront-headsup-action-list a,
.aphront-headsup-action-list span {
background-position: 8px center;
background-repeat: no-repeat;
display: block;
padding: 4px 4px 4px 32px;
}
.aphront-headsup-action-list span.unavailable {
color: #666666;
font-style: italic;
}
.aphront-headsup-action-list .subscribe-rem {
background-image: url(/rsrc/image/icon/unsubscribe.png);
}
.aphront-headsup-action-list .subscribe-add {
background-image: url(/rsrc/image/icon/subscribe.png);
}
.aphront-headsup-action-list .action-edit,
.aphront-headsup-action-list .revision-edit {
background-image: url(/rsrc/image/icon/tango/edit.png);
}
.aphront-headsup-action-list .action-attach,
.aphront-headsup-action-list .attach-maniphest {
background-image: url(/rsrc/image/icon/tango/attachment.png);
}
.aphront-headsup-action-list .action-upload {
background-image: url(/rsrc/image/icon/tango/upload.png);
}
.aphront-headsup-action-list .transcripts-metamta {
background-image: url(/rsrc/image/icon/tango/log.png);
}

View file

@ -24,6 +24,11 @@
padding: 3px 2px;
}
.differential-revision-detail-core {
margin-right: 265px;
}
.differential-revision-actions {
float: right;
width: 250px;
@ -34,10 +39,6 @@
font-size: 11px;
}
.differential-revision-detail-core {
margin-right: 265px;
}
.differential-revision-actions a,
.differential-revision-actions span {
background-position: 8px center;

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B