Skip to content

Commit b98847d

Browse files
author
epriestley
committed
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
1 parent 7e0c067 commit b98847d

File tree

8 files changed

+147
-18
lines changed

8 files changed

+147
-18
lines changed

src/__celerity_resource_map__.php

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,18 @@
797797
),
798798
'disk' => '/rsrc/js/application/core/behavior-form.js',
799799
),
800+
'javelin-behavior-aphront-more' =>
801+
array(
802+
'uri' => '/res/9ad83c3c/rsrc/js/application/core/behavior-more.js',
803+
'type' => 'js',
804+
'requires' =>
805+
array(
806+
0 => 'javelin-behavior',
807+
1 => 'javelin-stratcom',
808+
2 => 'javelin-dom',
809+
),
810+
'disk' => '/rsrc/js/application/core/behavior-more.js',
811+
),
800812
'javelin-behavior-audit-preview' =>
801813
array(
802814
'uri' => '/res/3048b073/rsrc/js/application/diffusion/behavior-audit-preview.js',
@@ -1449,7 +1461,7 @@
14491461
),
14501462
'javelin-dom' =>
14511463
array(
1452-
'uri' => '/res/566888bc/rsrc/js/javelin/lib/DOM.js',
1464+
'uri' => '/res/6d62f42d/rsrc/js/javelin/lib/DOM.js',
14531465
'type' => 'js',
14541466
'requires' =>
14551467
array(
@@ -1603,7 +1615,7 @@
16031615
),
16041616
'javelin-request' =>
16051617
array(
1606-
'uri' => '/res/6ccc1d5a/rsrc/js/javelin/lib/Request.js',
1618+
'uri' => '/res/1fe7cbad/rsrc/js/javelin/lib/Request.js',
16071619
'type' => 'js',
16081620
'requires' =>
16091621
array(
@@ -1618,7 +1630,7 @@
16181630
),
16191631
'javelin-resource' =>
16201632
array(
1621-
'uri' => '/res/1ebc5a0d/rsrc/js/javelin/lib/Resource.js',
1633+
'uri' => '/res/0058cd36/rsrc/js/javelin/lib/Resource.js',
16221634
'type' => 'js',
16231635
'requires' =>
16241636
array(
@@ -2582,7 +2594,7 @@
25822594
'uri' => '/res/pkg/5e68be89/diffusion.pkg.js',
25832595
'type' => 'js',
25842596
),
2585-
'8a5de8a3' =>
2597+
'5b44c659' =>
25862598
array(
25872599
'name' => 'javelin.pkg.js',
25882600
'symbols' =>
@@ -2598,7 +2610,7 @@
25982610
8 => 'javelin-json',
25992611
9 => 'javelin-uri',
26002612
),
2601-
'uri' => '/res/pkg/8a5de8a3/javelin.pkg.js',
2613+
'uri' => '/res/pkg/5b44c659/javelin.pkg.js',
26022614
'type' => 'js',
26032615
),
26042616
'7839ae2d' =>
@@ -2675,7 +2687,7 @@
26752687
'diffusion-commit-view-css' => 'c8ce2d88',
26762688
'diffusion-icons-css' => 'c8ce2d88',
26772689
'inline-comment-summary-css' => '2debe0e0',
2678-
'javelin-behavior' => '8a5de8a3',
2690+
'javelin-behavior' => '5b44c659',
26792691
'javelin-behavior-aphront-basic-tokenizer' => '97f65640',
26802692
'javelin-behavior-aphront-drag-and-drop' => '5b7b36d7',
26812693
'javelin-behavior-aphront-drag-and-drop-textarea' => '5b7b36d7',
@@ -2708,22 +2720,22 @@
27082720
'javelin-behavior-refresh-csrf' => '0c96375e',
27092721
'javelin-behavior-repository-crossreference' => '5b7b36d7',
27102722
'javelin-behavior-workflow' => '0c96375e',
2711-
'javelin-dom' => '8a5de8a3',
2712-
'javelin-event' => '8a5de8a3',
2713-
'javelin-install' => '8a5de8a3',
2714-
'javelin-json' => '8a5de8a3',
2723+
'javelin-dom' => '5b44c659',
2724+
'javelin-event' => '5b44c659',
2725+
'javelin-install' => '5b44c659',
2726+
'javelin-json' => '5b44c659',
27152727
'javelin-mask' => '0c96375e',
2716-
'javelin-request' => '8a5de8a3',
2717-
'javelin-stratcom' => '8a5de8a3',
2728+
'javelin-request' => '5b44c659',
2729+
'javelin-stratcom' => '5b44c659',
27182730
'javelin-tokenizer' => '97f65640',
27192731
'javelin-typeahead' => '97f65640',
27202732
'javelin-typeahead-normalizer' => '97f65640',
27212733
'javelin-typeahead-ondemand-source' => '97f65640',
27222734
'javelin-typeahead-preloaded-source' => '97f65640',
27232735
'javelin-typeahead-source' => '97f65640',
2724-
'javelin-uri' => '8a5de8a3',
2725-
'javelin-util' => '8a5de8a3',
2726-
'javelin-vector' => '8a5de8a3',
2736+
'javelin-uri' => '5b44c659',
2737+
'javelin-util' => '5b44c659',
2738+
'javelin-vector' => '5b44c659',
27272739
'javelin-workflow' => '0c96375e',
27282740
'maniphest-task-summary-css' => '7839ae2d',
27292741
'maniphest-transaction-detail-css' => '7839ae2d',

src/__phutil_library_map__.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
'AphrontKeyboardShortcutsAvailableView' => 'view/widget/keyboardshortcuts',
6565
'AphrontListFilterView' => 'view/layout/listfilter',
6666
'AphrontMiniPanelView' => 'view/layout/minipanel',
67+
'AphrontMoreView' => 'view/layout/more',
6768
'AphrontMySQLDatabaseConnection' => 'storage/connection/mysql/mysql',
6869
'AphrontMySQLDatabaseConnectionBase' => 'storage/connection/mysql/base',
6970
'AphrontMySQLDatabaseConnectionTestCase' => 'storage/connection/mysql/__tests__',
@@ -1101,6 +1102,7 @@
11011102
'AphrontKeyboardShortcutsAvailableView' => 'AphrontView',
11021103
'AphrontListFilterView' => 'AphrontView',
11031104
'AphrontMiniPanelView' => 'AphrontView',
1105+
'AphrontMoreView' => 'AphrontView',
11041106
'AphrontMySQLDatabaseConnection' => 'AphrontMySQLDatabaseConnectionBase',
11051107
'AphrontMySQLDatabaseConnectionBase' => 'AphrontDatabaseConnection',
11061108
'AphrontMySQLDatabaseConnectionTestCase' => 'PhabricatorTestCase',

src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ public function processRequest() {
300300
$toc_view->setRevisionID($revision->getID());
301301
$toc_view->setWhitespace($whitespace);
302302

303+
$comment_form = null;
303304
if (!$viewer_is_anonymous) {
304305
$draft = id(new PhabricatorDraft())->loadOneWhere(
305306
'authorPHID = %s AND draftKey = %s',

src/applications/differential/view/localcommits/DifferentialLocalCommitsView.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
* Copyright 2011 Facebook, Inc.
4+
* Copyright 2012 Facebook, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -95,9 +95,24 @@ public function render() {
9595
idx($commit, 'author'));
9696
$row[] = '<td>'.phutil_escape_html($author).'</td>';
9797

98+
$message = idx($commit, 'message');
99+
98100
$summary = idx($commit, 'summary');
99-
$summary = phutil_utf8_shorten($summary, 60);
100-
$row[] = '<td class="summary">'.phutil_escape_html($summary).'</td>';
101+
$summary = phutil_utf8_shorten($summary, 80);
102+
103+
$view = new AphrontMoreView();
104+
$view->setSome(phutil_escape_html($summary));
105+
106+
if ($message && (trim($summary) != trim($message))) {
107+
$view->setMore(nl2br(phutil_escape_html($message)));
108+
}
109+
110+
$row[] = phutil_render_tag(
111+
'td',
112+
array(
113+
'class' => 'summary',
114+
),
115+
$view->render());
101116

102117
$date = nonempty(
103118
idx($commit, 'date'),

src/applications/differential/view/localcommits/__init__.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
phutil_require_module('phabricator', 'infrastructure/celerity/api');
1010
phutil_require_module('phabricator', 'view/base');
11+
phutil_require_module('phabricator', 'view/layout/more');
1112
phutil_require_module('phabricator', 'view/utils');
1213

1314
phutil_require_module('phutil', 'markup');
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
/*
4+
* Copyright 2012 Facebook, Inc.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
final class AphrontMoreView extends AphrontView {
20+
21+
private $some;
22+
private $more;
23+
24+
public function setSome($some) {
25+
$this->some = $some;
26+
return $this;
27+
}
28+
29+
public function setMore($more) {
30+
$this->more = $more;
31+
return $this;
32+
}
33+
34+
public function render() {
35+
$some = $this->some;
36+
37+
$link = null;
38+
if ($this->more && $this->more != $this->some) {
39+
Javelin::initBehavior('aphront-more');
40+
$link = ' '.javelin_render_tag(
41+
'a',
42+
array(
43+
'sigil' => 'aphront-more-view-show-more',
44+
'mustcapture' => true,
45+
'href' => '#',
46+
'meta' => array(
47+
'more' => $this->more,
48+
),
49+
),
50+
"(Show More\xE2\x80\xA6)");
51+
}
52+
53+
return javelin_render_tag(
54+
'div',
55+
array(
56+
'sigil' => 'aphront-more-view',
57+
),
58+
$some.$link);
59+
}
60+
61+
62+
}

src/view/layout/more/__init__.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* This file is automatically generated. Lint this module to rebuild it.
4+
* @generated
5+
*/
6+
7+
8+
9+
phutil_require_module('phabricator', 'infrastructure/javelin/api');
10+
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
11+
phutil_require_module('phabricator', 'view/base');
12+
13+
14+
phutil_require_source('AphrontMoreView.php');
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @provides javelin-behavior-aphront-more
3+
* @requires javelin-behavior
4+
* javelin-stratcom
5+
* javelin-dom
6+
* @javelin
7+
*/
8+
9+
JX.behavior('aphront-more', function(config) {
10+
JX.Stratcom.listen(
11+
'click',
12+
'aphront-more-view-show-more',
13+
function(e) {
14+
e.kill();
15+
16+
var node = e.getNode('aphront-more-view');
17+
var more = JX.$H(e.getNodeData('aphront-more-view-show-more').more);
18+
19+
// When the user clicks "More...", show more.
20+
JX.DOM.setContent(node, more);
21+
});
22+
});

0 commit comments

Comments
 (0)