mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 21:02:41 +01:00
Make durable column sticky across requests
Summary: When you open the column, keep it open on future requests. Test Plan: Opened column, clicked to Conpherence (no column), clicked elsewhere (column again), reloaded page (column), closed column, clicked something (no column). Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D12038
This commit is contained in:
parent
6fa507987d
commit
88b46063b4
5 changed files with 97 additions and 34 deletions
|
@ -44,7 +44,7 @@ return array(
|
||||||
'rsrc/css/application/config/config-welcome.css' => '6abd79be',
|
'rsrc/css/application/config/config-welcome.css' => '6abd79be',
|
||||||
'rsrc/css/application/config/setup-issue.css' => '22270af2',
|
'rsrc/css/application/config/setup-issue.css' => '22270af2',
|
||||||
'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2',
|
'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2',
|
||||||
'rsrc/css/application/conpherence/durable-column.css' => '9207426d',
|
'rsrc/css/application/conpherence/durable-column.css' => '7abcc3f2',
|
||||||
'rsrc/css/application/conpherence/menu.css' => 'c6ac5299',
|
'rsrc/css/application/conpherence/menu.css' => 'c6ac5299',
|
||||||
'rsrc/css/application/conpherence/message-pane.css' => '5930260a',
|
'rsrc/css/application/conpherence/message-pane.css' => '5930260a',
|
||||||
'rsrc/css/application/conpherence/notification.css' => '04a6e10a',
|
'rsrc/css/application/conpherence/notification.css' => '04a6e10a',
|
||||||
|
@ -353,7 +353,7 @@ return array(
|
||||||
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
||||||
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
|
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
|
||||||
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'efef202b',
|
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'efef202b',
|
||||||
'rsrc/js/application/conpherence/behavior-durable-column.js' => '1eef9f26',
|
'rsrc/js/application/conpherence/behavior-durable-column.js' => 'aa3b6c22',
|
||||||
'rsrc/js/application/conpherence/behavior-menu.js' => 'e476c952',
|
'rsrc/js/application/conpherence/behavior-menu.js' => 'e476c952',
|
||||||
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
|
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
|
||||||
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
|
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
|
||||||
|
@ -515,7 +515,7 @@ return array(
|
||||||
'changeset-view-manager' => '88be0133',
|
'changeset-view-manager' => '88be0133',
|
||||||
'config-options-css' => '7fedf08b',
|
'config-options-css' => '7fedf08b',
|
||||||
'config-welcome-css' => '6abd79be',
|
'config-welcome-css' => '6abd79be',
|
||||||
'conpherence-durable-column-view' => '9207426d',
|
'conpherence-durable-column-view' => '7abcc3f2',
|
||||||
'conpherence-menu-css' => 'c6ac5299',
|
'conpherence-menu-css' => 'c6ac5299',
|
||||||
'conpherence-message-pane-css' => '5930260a',
|
'conpherence-message-pane-css' => '5930260a',
|
||||||
'conpherence-notification-css' => '04a6e10a',
|
'conpherence-notification-css' => '04a6e10a',
|
||||||
|
@ -586,7 +586,7 @@ return array(
|
||||||
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
|
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
|
||||||
'javelin-behavior-diffusion-pull-lastmodified' => '2b228192',
|
'javelin-behavior-diffusion-pull-lastmodified' => '2b228192',
|
||||||
'javelin-behavior-doorkeeper-tag' => 'e5822781',
|
'javelin-behavior-doorkeeper-tag' => 'e5822781',
|
||||||
'javelin-behavior-durable-column' => '1eef9f26',
|
'javelin-behavior-durable-column' => 'aa3b6c22',
|
||||||
'javelin-behavior-error-log' => '6882e80a',
|
'javelin-behavior-error-log' => '6882e80a',
|
||||||
'javelin-behavior-fancy-datepicker' => 'c51ae228',
|
'javelin-behavior-fancy-datepicker' => 'c51ae228',
|
||||||
'javelin-behavior-global-drag-and-drop' => '07f199d8',
|
'javelin-behavior-global-drag-and-drop' => '07f199d8',
|
||||||
|
@ -956,15 +956,6 @@ return array(
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
'javelin-reactor-dom',
|
'javelin-reactor-dom',
|
||||||
),
|
),
|
||||||
'1eef9f26' => array(
|
|
||||||
'javelin-behavior',
|
|
||||||
'javelin-dom',
|
|
||||||
'javelin-stratcom',
|
|
||||||
'javelin-scrollbar',
|
|
||||||
'javelin-quicksand',
|
|
||||||
'phabricator-keyboard-shortcut',
|
|
||||||
'conpherence-thread-manager',
|
|
||||||
),
|
|
||||||
'1feea462' => array(
|
'1feea462' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
|
@ -1666,6 +1657,15 @@ return array(
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
'phabricator-prefab',
|
'phabricator-prefab',
|
||||||
),
|
),
|
||||||
|
'aa3b6c22' => array(
|
||||||
|
'javelin-behavior',
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-stratcom',
|
||||||
|
'javelin-scrollbar',
|
||||||
|
'javelin-quicksand',
|
||||||
|
'phabricator-keyboard-shortcut',
|
||||||
|
'conpherence-thread-manager',
|
||||||
|
),
|
||||||
'b1f0ccee' => array(
|
'b1f0ccee' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
|
|
|
@ -5,6 +5,7 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
|
||||||
private $conpherences;
|
private $conpherences;
|
||||||
private $selectedConpherence;
|
private $selectedConpherence;
|
||||||
private $transactions;
|
private $transactions;
|
||||||
|
private $visible;
|
||||||
|
|
||||||
public function setConpherences(array $conpherences) {
|
public function setConpherences(array $conpherences) {
|
||||||
assert_instances_of($conpherences, 'ConpherenceThread');
|
assert_instances_of($conpherences, 'ConpherenceThread');
|
||||||
|
@ -36,16 +37,40 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
|
||||||
return $this->transactions;
|
return $this->transactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setVisible($visible) {
|
||||||
|
$this->visible = $visible;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVisible() {
|
||||||
|
return $this->visible;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getTagAttributes() {
|
protected function getTagAttributes() {
|
||||||
|
if ($this->getVisible()) {
|
||||||
|
$style = null;
|
||||||
|
} else {
|
||||||
|
$style = 'display: none;';
|
||||||
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'id' => 'conpherence-durable-column',
|
'id' => 'conpherence-durable-column',
|
||||||
'class' => 'conpherence-durable-column',
|
'class' => 'conpherence-durable-column',
|
||||||
'style' => 'display: none;',
|
'style' => $style,
|
||||||
'sigil' => 'conpherence-durable-column',
|
'sigil' => 'conpherence-durable-column',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTagContent() {
|
protected function getTagContent() {
|
||||||
|
$column_key = PhabricatorUserPreferences::PREFERENCE_CONPHERENCE_COLUMN;
|
||||||
|
|
||||||
|
Javelin::initBehavior(
|
||||||
|
'durable-column',
|
||||||
|
array(
|
||||||
|
'visible' => $this->getVisible(),
|
||||||
|
'settingsURI' => '/settings/adjust/?key='.$column_key,
|
||||||
|
));
|
||||||
|
|
||||||
$classes = array();
|
$classes = array();
|
||||||
$classes[] = 'conpherence-durable-column-header';
|
$classes[] = 'conpherence-durable-column-header';
|
||||||
$classes[] = 'sprite-main-header';
|
$classes[] = 'sprite-main-header';
|
||||||
|
|
|
@ -32,6 +32,7 @@ final class PhabricatorUserPreferences extends PhabricatorUserDAO {
|
||||||
const PREFERENCE_DIFF_FILETREE = 'diff-filetree';
|
const PREFERENCE_DIFF_FILETREE = 'diff-filetree';
|
||||||
|
|
||||||
const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications';
|
const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications';
|
||||||
|
const PREFERENCE_CONPHERENCE_COLUMN = 'conpherence-column';
|
||||||
|
|
||||||
// These are in an unusual order for historic reasons.
|
// These are in an unusual order for historic reasons.
|
||||||
const MAILTAG_PREFERENCE_NOTIFY = 0;
|
const MAILTAG_PREFERENCE_NOTIFY = 0;
|
||||||
|
|
|
@ -108,16 +108,18 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle() {
|
public function getDurableColumnVisible() {
|
||||||
$use_glyph = true;
|
$column_key = PhabricatorUserPreferences::PREFERENCE_CONPHERENCE_COLUMN;
|
||||||
|
return (bool)$this->getUserPreference($column_key, 0);
|
||||||
$request = $this->getRequest();
|
|
||||||
if ($request) {
|
|
||||||
$user = $request->getUser();
|
|
||||||
if ($user && $user->loadPreferences()->getPreference(
|
|
||||||
PhabricatorUserPreferences::PREFERENCE_TITLES) !== 'glyph') {
|
|
||||||
$use_glyph = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getTitle() {
|
||||||
|
$glyph_key = PhabricatorUserPreferences::PREFERENCE_TITLES;
|
||||||
|
if ($this->getUserPreference($glyph_key) == 'text') {
|
||||||
|
$use_glyph = false;
|
||||||
|
} else {
|
||||||
|
$use_glyph = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = parent::getTitle();
|
$title = parent::getTitle();
|
||||||
|
@ -416,12 +418,11 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
|
||||||
|
|
||||||
$durable_column = null;
|
$durable_column = null;
|
||||||
if ($this->getShowDurableColumn()) {
|
if ($this->getShowDurableColumn()) {
|
||||||
|
$is_visible = $this->getDurableColumnVisible();
|
||||||
$durable_column = id(new ConpherenceDurableColumnView())
|
$durable_column = id(new ConpherenceDurableColumnView())
|
||||||
->setSelectedConpherence(null)
|
->setSelectedConpherence(null)
|
||||||
->setUser($user);
|
->setUser($user)
|
||||||
Javelin::initBehavior(
|
->setVisible($is_visible);
|
||||||
'durable-column',
|
|
||||||
array());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Javelin::initBehavior('quicksand-blacklist', array(
|
Javelin::initBehavior('quicksand-blacklist', array(
|
||||||
|
@ -611,4 +612,18 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
|
||||||
return array_mergev($blacklist);
|
return array_mergev($blacklist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getUserPreference($key, $default = null) {
|
||||||
|
$request = $this->getRequest();
|
||||||
|
if (!$request) {
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = $request->getUser();
|
||||||
|
if (!$user) {
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $user->loadPreferences()->getPreference($key, $default);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,19 @@
|
||||||
* conpherence-thread-manager
|
* conpherence-thread-manager
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JX.behavior('durable-column', function() {
|
JX.behavior('durable-column', function(config, statics) {
|
||||||
|
// TODO: Currently, updating the column sends the entire column back. This
|
||||||
|
// includes the `durable-column` behavior itself, which tries to re-initialize
|
||||||
|
// the column. Detect this and bail.
|
||||||
|
//
|
||||||
|
// If ThreadManager gets separated into a UI part and a thread part (which
|
||||||
|
// seems likely), responses may no longer ship back the entire column. This
|
||||||
|
// might let us remove this check.
|
||||||
|
if (statics.initialized) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
statics.initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
var show = false;
|
var show = false;
|
||||||
var loadThreadID = null;
|
var loadThreadID = null;
|
||||||
|
@ -27,10 +39,7 @@ JX.behavior('durable-column', function() {
|
||||||
return JX.DOM.find(column, 'div', 'conpherence-durable-column-main');
|
return JX.DOM.find(column, 'div', 'conpherence-durable-column-main');
|
||||||
}
|
}
|
||||||
|
|
||||||
function _toggleColumn() {
|
function _toggleColumn(explicit) {
|
||||||
if (window.location.pathname.indexOf('/conpherence/') === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
show = !show;
|
show = !show;
|
||||||
JX.DOM.alterClass(frame, 'with-durable-column', show);
|
JX.DOM.alterClass(frame, 'with-durable-column', show);
|
||||||
var column = JX.$('conpherence-durable-column');
|
var column = JX.$('conpherence-durable-column');
|
||||||
|
@ -42,10 +51,18 @@ JX.behavior('durable-column', function() {
|
||||||
}
|
}
|
||||||
JX.Stratcom.invoke('resize');
|
JX.Stratcom.invoke('resize');
|
||||||
JX.Quicksand.setFrame(show ? quick : null);
|
JX.Quicksand.setFrame(show ? quick : null);
|
||||||
|
|
||||||
|
// If this was an explicit toggle action from the user, save their
|
||||||
|
// preference.
|
||||||
|
if (explicit) {
|
||||||
|
new JX.Request(config.settingsURI)
|
||||||
|
.setData({value: (show ? 1 : 0)})
|
||||||
|
.send();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new JX.KeyboardShortcut('\\', 'Toggle Conpherence Column')
|
new JX.KeyboardShortcut('\\', 'Toggle Conpherence Column')
|
||||||
.setHandler(_toggleColumn)
|
.setHandler(JX.bind(null, _toggleColumn, true))
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
scrollbar = new JX.Scrollbar(_getColumnScrollNode());
|
scrollbar = new JX.Scrollbar(_getColumnScrollNode());
|
||||||
|
@ -55,6 +72,7 @@ JX.behavior('durable-column', function() {
|
||||||
/* Conpherence Thread Manager configuration - lots of display
|
/* Conpherence Thread Manager configuration - lots of display
|
||||||
* callbacks.
|
* callbacks.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var threadManager = new JX.ConpherenceThreadManager();
|
var threadManager = new JX.ConpherenceThreadManager();
|
||||||
threadManager.setMinimalDisplay(true);
|
threadManager.setMinimalDisplay(true);
|
||||||
threadManager.setLoadThreadURI('/conpherence/columnview/');
|
threadManager.setLoadThreadURI('/conpherence/columnview/');
|
||||||
|
@ -216,4 +234,8 @@ JX.behavior('durable-column', function() {
|
||||||
'conpherence-message-form',
|
'conpherence-message-form',
|
||||||
_sendMessage);
|
_sendMessage);
|
||||||
|
|
||||||
|
if (config.visible) {
|
||||||
|
_toggleColumn(false);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue