mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Add "X / Y Comments" button to Differential persistent header
Summary: Ref M1476. Test Plan: {F4987991} Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18072
This commit is contained in:
parent
863b7ab766
commit
9773dc0e6c
3 changed files with 91 additions and 31 deletions
|
@ -13,7 +13,7 @@ return array(
|
||||||
'core.pkg.js' => '1475bd91',
|
'core.pkg.js' => '1475bd91',
|
||||||
'darkconsole.pkg.js' => '1f9a31bc',
|
'darkconsole.pkg.js' => '1f9a31bc',
|
||||||
'differential.pkg.css' => '1ccbf3a9',
|
'differential.pkg.css' => '1ccbf3a9',
|
||||||
'differential.pkg.js' => 'b2c4cbfa',
|
'differential.pkg.js' => '889ab0ab',
|
||||||
'diffusion.pkg.css' => 'b93d9b8c',
|
'diffusion.pkg.css' => 'b93d9b8c',
|
||||||
'diffusion.pkg.js' => '84c8f8fd',
|
'diffusion.pkg.js' => '84c8f8fd',
|
||||||
'favicon.ico' => '30672e08',
|
'favicon.ico' => '30672e08',
|
||||||
|
@ -393,8 +393,8 @@ return array(
|
||||||
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173',
|
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173',
|
||||||
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
|
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
|
||||||
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
|
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
|
||||||
'rsrc/js/application/diff/DiffChangeset.js' => 'ee50a0ec',
|
'rsrc/js/application/diff/DiffChangeset.js' => 'd498bddb',
|
||||||
'rsrc/js/application/diff/DiffChangesetList.js' => 'b4cf2217',
|
'rsrc/js/application/diff/DiffChangesetList.js' => '0db8cdca',
|
||||||
'rsrc/js/application/diff/DiffInline.js' => '1d17130f',
|
'rsrc/js/application/diff/DiffInline.js' => '1d17130f',
|
||||||
'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832',
|
'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832',
|
||||||
'rsrc/js/application/differential/behavior-comment-preview.js' => '51c5ad07',
|
'rsrc/js/application/differential/behavior-comment-preview.js' => '51c5ad07',
|
||||||
|
@ -772,8 +772,8 @@ return array(
|
||||||
'phabricator-darklog' => 'c8e1ffe3',
|
'phabricator-darklog' => 'c8e1ffe3',
|
||||||
'phabricator-darkmessage' => 'c48cccdd',
|
'phabricator-darkmessage' => 'c48cccdd',
|
||||||
'phabricator-dashboard-css' => 'fe5b1869',
|
'phabricator-dashboard-css' => 'fe5b1869',
|
||||||
'phabricator-diff-changeset' => 'ee50a0ec',
|
'phabricator-diff-changeset' => 'd498bddb',
|
||||||
'phabricator-diff-changeset-list' => 'b4cf2217',
|
'phabricator-diff-changeset-list' => '0db8cdca',
|
||||||
'phabricator-diff-inline' => '1d17130f',
|
'phabricator-diff-inline' => '1d17130f',
|
||||||
'phabricator-drag-and-drop-file-upload' => '58dea2fa',
|
'phabricator-drag-and-drop-file-upload' => '58dea2fa',
|
||||||
'phabricator-draggable-list' => 'bea6e7f4',
|
'phabricator-draggable-list' => 'bea6e7f4',
|
||||||
|
@ -960,6 +960,10 @@ return array(
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
'javelin-router',
|
'javelin-router',
|
||||||
),
|
),
|
||||||
|
'0db8cdca' => array(
|
||||||
|
'javelin-install',
|
||||||
|
'phuix-button-view',
|
||||||
|
),
|
||||||
'0f764c35' => array(
|
'0f764c35' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
|
@ -1771,10 +1775,6 @@ return array(
|
||||||
'b3e7d692' => array(
|
'b3e7d692' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
),
|
),
|
||||||
'b4cf2217' => array(
|
|
||||||
'javelin-install',
|
|
||||||
'phuix-button-view',
|
|
||||||
),
|
|
||||||
'b59e1e96' => array(
|
'b59e1e96' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-stratcom',
|
'javelin-stratcom',
|
||||||
|
@ -1978,6 +1978,17 @@ return array(
|
||||||
'javelin-uri',
|
'javelin-uri',
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
),
|
),
|
||||||
|
'd498bddb' => array(
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-util',
|
||||||
|
'javelin-stratcom',
|
||||||
|
'javelin-install',
|
||||||
|
'javelin-workflow',
|
||||||
|
'javelin-router',
|
||||||
|
'javelin-behavior-device',
|
||||||
|
'javelin-vector',
|
||||||
|
'phabricator-diff-inline',
|
||||||
|
),
|
||||||
'd4eecc63' => array(
|
'd4eecc63' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
|
@ -2092,17 +2103,6 @@ return array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-uri',
|
'javelin-uri',
|
||||||
),
|
),
|
||||||
'ee50a0ec' => array(
|
|
||||||
'javelin-dom',
|
|
||||||
'javelin-util',
|
|
||||||
'javelin-stratcom',
|
|
||||||
'javelin-install',
|
|
||||||
'javelin-workflow',
|
|
||||||
'javelin-router',
|
|
||||||
'javelin-behavior-device',
|
|
||||||
'javelin-vector',
|
|
||||||
'phabricator-diff-inline',
|
|
||||||
),
|
|
||||||
'efe49472' => array(
|
'efe49472' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
|
|
|
@ -440,6 +440,8 @@ JX.install('DiffChangeset', {
|
||||||
last_inline = inline;
|
last_inline = inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var is_saved = (!inline.isDraft() && !inline.isEditing());
|
||||||
|
|
||||||
last_inline_item = {
|
last_inline_item = {
|
||||||
type: block.type,
|
type: block.type,
|
||||||
changeset: this,
|
changeset: this,
|
||||||
|
@ -452,7 +454,9 @@ JX.install('DiffChangeset', {
|
||||||
},
|
},
|
||||||
attributes: {
|
attributes: {
|
||||||
unsaved: inline.isEditing(),
|
unsaved: inline.isEditing(),
|
||||||
unsubmitted: inline.isDraft()
|
unsubmitted: inline.isDraft(),
|
||||||
|
undone: (is_saved && !inline.isDone()),
|
||||||
|
done: (is_saved && inline.isDone())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,8 @@ JX.install('DiffChangesetList', {
|
||||||
_bannerNode: null,
|
_bannerNode: null,
|
||||||
_unsavedButton: null,
|
_unsavedButton: null,
|
||||||
_unsubmittedButton: null,
|
_unsubmittedButton: null,
|
||||||
|
_doneButton: null,
|
||||||
|
_doneMode: null,
|
||||||
|
|
||||||
sleep: function() {
|
sleep: function() {
|
||||||
this._asleep = true;
|
this._asleep = true;
|
||||||
|
@ -531,7 +533,7 @@ JX.install('DiffChangesetList', {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._setSelectionState(items[cursor]);
|
this._setSelectionState(items[cursor], true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSelectionState: function() {
|
_getSelectionState: function() {
|
||||||
|
@ -554,9 +556,9 @@ JX.install('DiffChangesetList', {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
_setSelectionState: function(item) {
|
_setSelectionState: function(item, scroll) {
|
||||||
this._cursorItem = item;
|
this._cursorItem = item;
|
||||||
this._redrawSelection(true);
|
this._redrawSelection(scroll);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
@ -598,7 +600,7 @@ JX.install('DiffChangesetList', {
|
||||||
|
|
||||||
var state = this._getSelectionState();
|
var state = this._getSelectionState();
|
||||||
if (state.cursor !== null) {
|
if (state.cursor !== null) {
|
||||||
this._setSelectionState(state.items[state.cursor]);
|
this._setSelectionState(state.items[state.cursor], false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -910,7 +912,7 @@ JX.install('DiffChangesetList', {
|
||||||
if (selection.cursor !== null) {
|
if (selection.cursor !== null) {
|
||||||
item = selection.items[selection.cursor];
|
item = selection.items[selection.cursor];
|
||||||
if (item.target === inline) {
|
if (item.target === inline) {
|
||||||
this._setSelectionState(null);
|
this._setSelectionState(null, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -922,7 +924,7 @@ JX.install('DiffChangesetList', {
|
||||||
for (var ii = 0; ii < items.length; ii++) {
|
for (var ii = 0; ii < items.length; ii++) {
|
||||||
item = items[ii];
|
item = items[ii];
|
||||||
if (item.target === inline) {
|
if (item.target === inline) {
|
||||||
this._setSelectionState(item);
|
this._setSelectionState(item, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1339,7 +1341,7 @@ JX.install('DiffChangesetList', {
|
||||||
var unsaved = [];
|
var unsaved = [];
|
||||||
var unsubmitted = [];
|
var unsubmitted = [];
|
||||||
var undone = [];
|
var undone = [];
|
||||||
var all = [];
|
var done = [];
|
||||||
|
|
||||||
for (var ii = 0; ii < changesets.length; ii++) {
|
for (var ii = 0; ii < changesets.length; ii++) {
|
||||||
var inlines = changesets[ii].getInlines();
|
var inlines = changesets[ii].getInlines();
|
||||||
|
@ -1350,14 +1352,14 @@ JX.install('DiffChangesetList', {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
all.push(inline);
|
|
||||||
|
|
||||||
if (inline.isEditing()) {
|
if (inline.isEditing()) {
|
||||||
unsaved.push(inline);
|
unsaved.push(inline);
|
||||||
} else if (inline.isDraft()) {
|
} else if (inline.isDraft()) {
|
||||||
unsubmitted.push(inline);
|
unsubmitted.push(inline);
|
||||||
} else if (!inline.isDone()) {
|
} else if (!inline.isDone()) {
|
||||||
undone.push(inline);
|
undone.push(inline);
|
||||||
|
} else {
|
||||||
|
done.push(inline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1375,6 +1377,7 @@ JX.install('DiffChangesetList', {
|
||||||
var pht = this.getTranslations();
|
var pht = this.getTranslations();
|
||||||
var unsaved_button = this._getUnsavedButton();
|
var unsaved_button = this._getUnsavedButton();
|
||||||
var unsubmitted_button = this._getUnsubmittedButton();
|
var unsubmitted_button = this._getUnsubmittedButton();
|
||||||
|
var done_button = this._getDoneButton();
|
||||||
|
|
||||||
if (unsaved.length) {
|
if (unsaved.length) {
|
||||||
unsaved_button.setText(unsaved.length + ' ' + pht('Unsaved'));
|
unsaved_button.setText(unsaved.length + ' ' + pht('Unsaved'));
|
||||||
|
@ -1391,6 +1394,30 @@ JX.install('DiffChangesetList', {
|
||||||
JX.DOM.hide(unsubmitted_button.getNode());
|
JX.DOM.hide(unsubmitted_button.getNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (done.length || undone.length) {
|
||||||
|
done_button.setText([
|
||||||
|
done.length,
|
||||||
|
' / ',
|
||||||
|
(done.length + undone.length),
|
||||||
|
' ',
|
||||||
|
pht('Comments')
|
||||||
|
]);
|
||||||
|
|
||||||
|
JX.DOM.show(done_button.getNode());
|
||||||
|
|
||||||
|
// If any comments are not marked "Done", this cycles through the
|
||||||
|
// missing comments. Otherwise, it cycles through all the saved
|
||||||
|
// comments.
|
||||||
|
if (undone.length) {
|
||||||
|
this._doneMode = 'undone';
|
||||||
|
} else {
|
||||||
|
this._doneMode = 'done';
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
JX.DOM.hide(done_button.getNode());
|
||||||
|
}
|
||||||
|
|
||||||
var path_view = [icon, ' ', changeset.getDisplayPath()];
|
var path_view = [icon, ' ', changeset.getDisplayPath()];
|
||||||
|
|
||||||
var buttons_attrs = {
|
var buttons_attrs = {
|
||||||
|
@ -1399,7 +1426,8 @@ JX.install('DiffChangesetList', {
|
||||||
|
|
||||||
var buttons_list = [
|
var buttons_list = [
|
||||||
unsaved_button.getNode(),
|
unsaved_button.getNode(),
|
||||||
unsubmitted_button.getNode()
|
unsubmitted_button.getNode(),
|
||||||
|
done_button.getNode()
|
||||||
];
|
];
|
||||||
|
|
||||||
var buttons_view = JX.$N('div', buttons_attrs, buttons_list);
|
var buttons_view = JX.$N('div', buttons_attrs, buttons_list);
|
||||||
|
@ -1446,6 +1474,22 @@ JX.install('DiffChangesetList', {
|
||||||
return this._unsubmittedButton;
|
return this._unsubmittedButton;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_getDoneButton: function() {
|
||||||
|
if (!this._doneButton) {
|
||||||
|
var button = new JX.PHUIXButtonView()
|
||||||
|
.setIcon('fa-comment')
|
||||||
|
.setButtonType(JX.PHUIXButtonView.BUTTONTYPE_SIMPLE);
|
||||||
|
|
||||||
|
var node = button.getNode();
|
||||||
|
|
||||||
|
var ondone = JX.bind(this, this._ondoneclick);
|
||||||
|
JX.DOM.listen(node, 'click', null, ondone);
|
||||||
|
|
||||||
|
this._doneButton = button;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._doneButton;
|
||||||
|
},
|
||||||
_onunsavedclick: function(e) {
|
_onunsavedclick: function(e) {
|
||||||
e.kill();
|
e.kill();
|
||||||
|
|
||||||
|
@ -1470,6 +1514,18 @@ JX.install('DiffChangesetList', {
|
||||||
this._onjumpkey(1, options);
|
this._onjumpkey(1, options);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_ondoneclick: function(e) {
|
||||||
|
e.kill();
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
filter: 'comment',
|
||||||
|
wrap: true,
|
||||||
|
attribute: this._doneMode
|
||||||
|
};
|
||||||
|
|
||||||
|
this._onjumpkey(1, options);
|
||||||
|
},
|
||||||
|
|
||||||
_getBannerNode: function() {
|
_getBannerNode: function() {
|
||||||
if (!this._bannerNode) {
|
if (!this._bannerNode) {
|
||||||
var attributes = {
|
var attributes = {
|
||||||
|
|
Loading…
Reference in a new issue