mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 21:02:41 +01:00
Show "show more..." link in "Local Commits" view in Differential
Summary: Javascript! Depends on D2437 to do anything useful. Test Plan: Clicked "show more", saw more. Reviewers: csilvers, btrahan Reviewed By: csilvers CC: aran Maniphest Tasks: T1189 Differential Revision: https://secure.phabricator.com/D2438
This commit is contained in:
parent
7e0c06716f
commit
b98847d2b1
8 changed files with 147 additions and 18 deletions
|
@ -797,6 +797,18 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'disk' => '/rsrc/js/application/core/behavior-form.js',
|
'disk' => '/rsrc/js/application/core/behavior-form.js',
|
||||||
),
|
),
|
||||||
|
'javelin-behavior-aphront-more' =>
|
||||||
|
array(
|
||||||
|
'uri' => '/res/9ad83c3c/rsrc/js/application/core/behavior-more.js',
|
||||||
|
'type' => 'js',
|
||||||
|
'requires' =>
|
||||||
|
array(
|
||||||
|
0 => 'javelin-behavior',
|
||||||
|
1 => 'javelin-stratcom',
|
||||||
|
2 => 'javelin-dom',
|
||||||
|
),
|
||||||
|
'disk' => '/rsrc/js/application/core/behavior-more.js',
|
||||||
|
),
|
||||||
'javelin-behavior-audit-preview' =>
|
'javelin-behavior-audit-preview' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/3048b073/rsrc/js/application/diffusion/behavior-audit-preview.js',
|
'uri' => '/res/3048b073/rsrc/js/application/diffusion/behavior-audit-preview.js',
|
||||||
|
@ -1449,7 +1461,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'javelin-dom' =>
|
'javelin-dom' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/566888bc/rsrc/js/javelin/lib/DOM.js',
|
'uri' => '/res/6d62f42d/rsrc/js/javelin/lib/DOM.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -1603,7 +1615,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'javelin-request' =>
|
'javelin-request' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/6ccc1d5a/rsrc/js/javelin/lib/Request.js',
|
'uri' => '/res/1fe7cbad/rsrc/js/javelin/lib/Request.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -1618,7 +1630,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'javelin-resource' =>
|
'javelin-resource' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/1ebc5a0d/rsrc/js/javelin/lib/Resource.js',
|
'uri' => '/res/0058cd36/rsrc/js/javelin/lib/Resource.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -2582,7 +2594,7 @@ celerity_register_resource_map(array(
|
||||||
'uri' => '/res/pkg/5e68be89/diffusion.pkg.js',
|
'uri' => '/res/pkg/5e68be89/diffusion.pkg.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
),
|
),
|
||||||
'8a5de8a3' =>
|
'5b44c659' =>
|
||||||
array(
|
array(
|
||||||
'name' => 'javelin.pkg.js',
|
'name' => 'javelin.pkg.js',
|
||||||
'symbols' =>
|
'symbols' =>
|
||||||
|
@ -2598,7 +2610,7 @@ celerity_register_resource_map(array(
|
||||||
8 => 'javelin-json',
|
8 => 'javelin-json',
|
||||||
9 => 'javelin-uri',
|
9 => 'javelin-uri',
|
||||||
),
|
),
|
||||||
'uri' => '/res/pkg/8a5de8a3/javelin.pkg.js',
|
'uri' => '/res/pkg/5b44c659/javelin.pkg.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
),
|
),
|
||||||
'7839ae2d' =>
|
'7839ae2d' =>
|
||||||
|
@ -2675,7 +2687,7 @@ celerity_register_resource_map(array(
|
||||||
'diffusion-commit-view-css' => 'c8ce2d88',
|
'diffusion-commit-view-css' => 'c8ce2d88',
|
||||||
'diffusion-icons-css' => 'c8ce2d88',
|
'diffusion-icons-css' => 'c8ce2d88',
|
||||||
'inline-comment-summary-css' => '2debe0e0',
|
'inline-comment-summary-css' => '2debe0e0',
|
||||||
'javelin-behavior' => '8a5de8a3',
|
'javelin-behavior' => '5b44c659',
|
||||||
'javelin-behavior-aphront-basic-tokenizer' => '97f65640',
|
'javelin-behavior-aphront-basic-tokenizer' => '97f65640',
|
||||||
'javelin-behavior-aphront-drag-and-drop' => '5b7b36d7',
|
'javelin-behavior-aphront-drag-and-drop' => '5b7b36d7',
|
||||||
'javelin-behavior-aphront-drag-and-drop-textarea' => '5b7b36d7',
|
'javelin-behavior-aphront-drag-and-drop-textarea' => '5b7b36d7',
|
||||||
|
@ -2708,22 +2720,22 @@ celerity_register_resource_map(array(
|
||||||
'javelin-behavior-refresh-csrf' => '0c96375e',
|
'javelin-behavior-refresh-csrf' => '0c96375e',
|
||||||
'javelin-behavior-repository-crossreference' => '5b7b36d7',
|
'javelin-behavior-repository-crossreference' => '5b7b36d7',
|
||||||
'javelin-behavior-workflow' => '0c96375e',
|
'javelin-behavior-workflow' => '0c96375e',
|
||||||
'javelin-dom' => '8a5de8a3',
|
'javelin-dom' => '5b44c659',
|
||||||
'javelin-event' => '8a5de8a3',
|
'javelin-event' => '5b44c659',
|
||||||
'javelin-install' => '8a5de8a3',
|
'javelin-install' => '5b44c659',
|
||||||
'javelin-json' => '8a5de8a3',
|
'javelin-json' => '5b44c659',
|
||||||
'javelin-mask' => '0c96375e',
|
'javelin-mask' => '0c96375e',
|
||||||
'javelin-request' => '8a5de8a3',
|
'javelin-request' => '5b44c659',
|
||||||
'javelin-stratcom' => '8a5de8a3',
|
'javelin-stratcom' => '5b44c659',
|
||||||
'javelin-tokenizer' => '97f65640',
|
'javelin-tokenizer' => '97f65640',
|
||||||
'javelin-typeahead' => '97f65640',
|
'javelin-typeahead' => '97f65640',
|
||||||
'javelin-typeahead-normalizer' => '97f65640',
|
'javelin-typeahead-normalizer' => '97f65640',
|
||||||
'javelin-typeahead-ondemand-source' => '97f65640',
|
'javelin-typeahead-ondemand-source' => '97f65640',
|
||||||
'javelin-typeahead-preloaded-source' => '97f65640',
|
'javelin-typeahead-preloaded-source' => '97f65640',
|
||||||
'javelin-typeahead-source' => '97f65640',
|
'javelin-typeahead-source' => '97f65640',
|
||||||
'javelin-uri' => '8a5de8a3',
|
'javelin-uri' => '5b44c659',
|
||||||
'javelin-util' => '8a5de8a3',
|
'javelin-util' => '5b44c659',
|
||||||
'javelin-vector' => '8a5de8a3',
|
'javelin-vector' => '5b44c659',
|
||||||
'javelin-workflow' => '0c96375e',
|
'javelin-workflow' => '0c96375e',
|
||||||
'maniphest-task-summary-css' => '7839ae2d',
|
'maniphest-task-summary-css' => '7839ae2d',
|
||||||
'maniphest-transaction-detail-css' => '7839ae2d',
|
'maniphest-transaction-detail-css' => '7839ae2d',
|
||||||
|
|
|
@ -64,6 +64,7 @@ phutil_register_library_map(array(
|
||||||
'AphrontKeyboardShortcutsAvailableView' => 'view/widget/keyboardshortcuts',
|
'AphrontKeyboardShortcutsAvailableView' => 'view/widget/keyboardshortcuts',
|
||||||
'AphrontListFilterView' => 'view/layout/listfilter',
|
'AphrontListFilterView' => 'view/layout/listfilter',
|
||||||
'AphrontMiniPanelView' => 'view/layout/minipanel',
|
'AphrontMiniPanelView' => 'view/layout/minipanel',
|
||||||
|
'AphrontMoreView' => 'view/layout/more',
|
||||||
'AphrontMySQLDatabaseConnection' => 'storage/connection/mysql/mysql',
|
'AphrontMySQLDatabaseConnection' => 'storage/connection/mysql/mysql',
|
||||||
'AphrontMySQLDatabaseConnectionBase' => 'storage/connection/mysql/base',
|
'AphrontMySQLDatabaseConnectionBase' => 'storage/connection/mysql/base',
|
||||||
'AphrontMySQLDatabaseConnectionTestCase' => 'storage/connection/mysql/__tests__',
|
'AphrontMySQLDatabaseConnectionTestCase' => 'storage/connection/mysql/__tests__',
|
||||||
|
@ -1101,6 +1102,7 @@ phutil_register_library_map(array(
|
||||||
'AphrontKeyboardShortcutsAvailableView' => 'AphrontView',
|
'AphrontKeyboardShortcutsAvailableView' => 'AphrontView',
|
||||||
'AphrontListFilterView' => 'AphrontView',
|
'AphrontListFilterView' => 'AphrontView',
|
||||||
'AphrontMiniPanelView' => 'AphrontView',
|
'AphrontMiniPanelView' => 'AphrontView',
|
||||||
|
'AphrontMoreView' => 'AphrontView',
|
||||||
'AphrontMySQLDatabaseConnection' => 'AphrontMySQLDatabaseConnectionBase',
|
'AphrontMySQLDatabaseConnection' => 'AphrontMySQLDatabaseConnectionBase',
|
||||||
'AphrontMySQLDatabaseConnectionBase' => 'AphrontDatabaseConnection',
|
'AphrontMySQLDatabaseConnectionBase' => 'AphrontDatabaseConnection',
|
||||||
'AphrontMySQLDatabaseConnectionTestCase' => 'PhabricatorTestCase',
|
'AphrontMySQLDatabaseConnectionTestCase' => 'PhabricatorTestCase',
|
||||||
|
|
|
@ -300,6 +300,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||||
$toc_view->setRevisionID($revision->getID());
|
$toc_view->setRevisionID($revision->getID());
|
||||||
$toc_view->setWhitespace($whitespace);
|
$toc_view->setWhitespace($whitespace);
|
||||||
|
|
||||||
|
$comment_form = null;
|
||||||
if (!$viewer_is_anonymous) {
|
if (!$viewer_is_anonymous) {
|
||||||
$draft = id(new PhabricatorDraft())->loadOneWhere(
|
$draft = id(new PhabricatorDraft())->loadOneWhere(
|
||||||
'authorPHID = %s AND draftKey = %s',
|
'authorPHID = %s AND draftKey = %s',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2011 Facebook, Inc.
|
* Copyright 2012 Facebook, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -95,9 +95,24 @@ final class DifferentialLocalCommitsView extends AphrontView {
|
||||||
idx($commit, 'author'));
|
idx($commit, 'author'));
|
||||||
$row[] = '<td>'.phutil_escape_html($author).'</td>';
|
$row[] = '<td>'.phutil_escape_html($author).'</td>';
|
||||||
|
|
||||||
|
$message = idx($commit, 'message');
|
||||||
|
|
||||||
$summary = idx($commit, 'summary');
|
$summary = idx($commit, 'summary');
|
||||||
$summary = phutil_utf8_shorten($summary, 60);
|
$summary = phutil_utf8_shorten($summary, 80);
|
||||||
$row[] = '<td class="summary">'.phutil_escape_html($summary).'</td>';
|
|
||||||
|
$view = new AphrontMoreView();
|
||||||
|
$view->setSome(phutil_escape_html($summary));
|
||||||
|
|
||||||
|
if ($message && (trim($summary) != trim($message))) {
|
||||||
|
$view->setMore(nl2br(phutil_escape_html($message)));
|
||||||
|
}
|
||||||
|
|
||||||
|
$row[] = phutil_render_tag(
|
||||||
|
'td',
|
||||||
|
array(
|
||||||
|
'class' => 'summary',
|
||||||
|
),
|
||||||
|
$view->render());
|
||||||
|
|
||||||
$date = nonempty(
|
$date = nonempty(
|
||||||
idx($commit, 'date'),
|
idx($commit, 'date'),
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||||
phutil_require_module('phabricator', 'view/base');
|
phutil_require_module('phabricator', 'view/base');
|
||||||
|
phutil_require_module('phabricator', 'view/layout/more');
|
||||||
phutil_require_module('phabricator', 'view/utils');
|
phutil_require_module('phabricator', 'view/utils');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'markup');
|
phutil_require_module('phutil', 'markup');
|
||||||
|
|
62
src/view/layout/more/AphrontMoreView.php
Normal file
62
src/view/layout/more/AphrontMoreView.php
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2012 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 AphrontMoreView extends AphrontView {
|
||||||
|
|
||||||
|
private $some;
|
||||||
|
private $more;
|
||||||
|
|
||||||
|
public function setSome($some) {
|
||||||
|
$this->some = $some;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMore($more) {
|
||||||
|
$this->more = $more;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render() {
|
||||||
|
$some = $this->some;
|
||||||
|
|
||||||
|
$link = null;
|
||||||
|
if ($this->more && $this->more != $this->some) {
|
||||||
|
Javelin::initBehavior('aphront-more');
|
||||||
|
$link = ' '.javelin_render_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'sigil' => 'aphront-more-view-show-more',
|
||||||
|
'mustcapture' => true,
|
||||||
|
'href' => '#',
|
||||||
|
'meta' => array(
|
||||||
|
'more' => $this->more,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"(Show More\xE2\x80\xA6)");
|
||||||
|
}
|
||||||
|
|
||||||
|
return javelin_render_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'sigil' => 'aphront-more-view',
|
||||||
|
),
|
||||||
|
$some.$link);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
14
src/view/layout/more/__init__.php
Normal file
14
src/view/layout/more/__init__.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is automatically generated. Lint this module to rebuild it.
|
||||||
|
* @generated
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||||
|
phutil_require_module('phabricator', 'view/base');
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_source('AphrontMoreView.php');
|
22
webroot/rsrc/js/application/core/behavior-more.js
Normal file
22
webroot/rsrc/js/application/core/behavior-more.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/**
|
||||||
|
* @provides javelin-behavior-aphront-more
|
||||||
|
* @requires javelin-behavior
|
||||||
|
* javelin-stratcom
|
||||||
|
* javelin-dom
|
||||||
|
* @javelin
|
||||||
|
*/
|
||||||
|
|
||||||
|
JX.behavior('aphront-more', function(config) {
|
||||||
|
JX.Stratcom.listen(
|
||||||
|
'click',
|
||||||
|
'aphront-more-view-show-more',
|
||||||
|
function(e) {
|
||||||
|
e.kill();
|
||||||
|
|
||||||
|
var node = e.getNode('aphront-more-view');
|
||||||
|
var more = JX.$H(e.getNodeData('aphront-more-view-show-more').more);
|
||||||
|
|
||||||
|
// When the user clicks "More...", show more.
|
||||||
|
JX.DOM.setContent(node, more);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue