mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Remove Ponder voting UI
Summary: Ref T6920, This just removes the old voting UI from Ponder. Test Plan: Visit a Question, no voting UI Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T6920 Differential Revision: https://secure.phabricator.com/D13827
This commit is contained in:
parent
f98f5a081e
commit
0c3f74663c
6 changed files with 2 additions and 215 deletions
|
@ -93,7 +93,7 @@ return array(
|
|||
'rsrc/css/application/policy/policy-edit.css' => '815c66f7',
|
||||
'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43',
|
||||
'rsrc/css/application/policy/policy.css' => '957ea14c',
|
||||
'rsrc/css/application/ponder/ponder-view.css' => 'fcd6b398',
|
||||
'rsrc/css/application/ponder/ponder-view.css' => '4e557c89',
|
||||
'rsrc/css/application/projects/project-icon.css' => '4e3eaa5a',
|
||||
'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733',
|
||||
'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5',
|
||||
|
@ -400,7 +400,6 @@ return array(
|
|||
'rsrc/js/application/phortune/phortune-credit-card-form.js' => '2290aeef',
|
||||
'rsrc/js/application/policy/behavior-policy-control.js' => '7d470398',
|
||||
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '5e9f347c',
|
||||
'rsrc/js/application/ponder/behavior-votebox.js' => '4e9b766b',
|
||||
'rsrc/js/application/projects/behavior-project-boards.js' => 'ba4fa35c',
|
||||
'rsrc/js/application/projects/behavior-project-create.js' => '065227cc',
|
||||
'rsrc/js/application/projects/behavior-reorder-columns.js' => 'e1d25dfb',
|
||||
|
@ -632,7 +631,6 @@ return array(
|
|||
'javelin-behavior-phui-object-box-tabs' => '2bfa2836',
|
||||
'javelin-behavior-policy-control' => '7d470398',
|
||||
'javelin-behavior-policy-rule-editor' => '5e9f347c',
|
||||
'javelin-behavior-ponder-votebox' => '4e9b766b',
|
||||
'javelin-behavior-project-boards' => 'ba4fa35c',
|
||||
'javelin-behavior-project-create' => '065227cc',
|
||||
'javelin-behavior-quicksand-blacklist' => '7927a7d3',
|
||||
|
@ -811,7 +809,7 @@ return array(
|
|||
'policy-css' => '957ea14c',
|
||||
'policy-edit-css' => '815c66f7',
|
||||
'policy-transaction-detail-css' => '82100a43',
|
||||
'ponder-view-css' => 'fcd6b398',
|
||||
'ponder-view-css' => '4e557c89',
|
||||
'project-icon-css' => '4e3eaa5a',
|
||||
'raphael-core' => '51ee6b43',
|
||||
'raphael-g' => '40dde778',
|
||||
|
@ -1142,13 +1140,6 @@ return array(
|
|||
'javelin-stratcom',
|
||||
'javelin-dom',
|
||||
),
|
||||
'4e9b766b' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-util',
|
||||
'javelin-stratcom',
|
||||
'javelin-request',
|
||||
),
|
||||
'4fdb476d' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
|
|
@ -3428,7 +3428,6 @@ phutil_register_library_map(array(
|
|||
'PonderSearchIndexer' => 'applications/ponder/search/PonderSearchIndexer.php',
|
||||
'PonderTransactionFeedStory' => 'applications/ponder/feed/PonderTransactionFeedStory.php',
|
||||
'PonderVotableInterface' => 'applications/ponder/storage/PonderVotableInterface.php',
|
||||
'PonderVotableView' => 'applications/ponder/view/PonderVotableView.php',
|
||||
'PonderVote' => 'applications/ponder/constants/PonderVote.php',
|
||||
'PonderVoteEditor' => 'applications/ponder/editor/PonderVoteEditor.php',
|
||||
'PonderVoteSaveController' => 'applications/ponder/controller/PonderVoteSaveController.php',
|
||||
|
@ -7628,7 +7627,6 @@ phutil_register_library_map(array(
|
|||
'PonderSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||
'PonderSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
|
||||
'PonderTransactionFeedStory' => 'PhabricatorApplicationTransactionFeedStory',
|
||||
'PonderVotableView' => 'AphrontView',
|
||||
'PonderVote' => 'PonderConstants',
|
||||
'PonderVoteEditor' => 'PhabricatorEditor',
|
||||
'PonderVoteSaveController' => 'PonderController',
|
||||
|
|
|
@ -155,16 +155,9 @@ final class PonderQuestionViewController extends PonderController {
|
|||
|
||||
$view->invokeWillRenderEvent();
|
||||
|
||||
$votable = id(new PonderVotableView())
|
||||
->setPHID($question->getPHID())
|
||||
->setURI($this->getApplicationURI('vote/'))
|
||||
->setCount($question->getVoteCount())
|
||||
->setVote($question->getUserVote());
|
||||
|
||||
$view->addSectionHeader(pht('Question'));
|
||||
$view->addTextContent(
|
||||
array(
|
||||
$votable,
|
||||
phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
|
@ -334,16 +327,9 @@ final class PonderQuestionViewController extends PonderController {
|
|||
|
||||
$view->invokeWillRenderEvent();
|
||||
|
||||
$votable = id(new PonderVotableView())
|
||||
->setPHID($answer->getPHID())
|
||||
->setURI($this->getApplicationURI('vote/'))
|
||||
->setCount($answer->getVoteCount())
|
||||
->setVote($answer->getUserVote());
|
||||
|
||||
$view->addSectionHeader(pht('Answer'));
|
||||
$view->addTextContent(
|
||||
array(
|
||||
$votable,
|
||||
phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PonderVotableView extends AphrontView {
|
||||
|
||||
private $phid;
|
||||
private $uri;
|
||||
private $count;
|
||||
private $vote;
|
||||
|
||||
public function setPHID($phid) {
|
||||
$this->phid = $phid;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setURI($uri) {
|
||||
$this->uri = $uri;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCount($count) {
|
||||
$this->count = $count;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setVote($vote) {
|
||||
$this->vote = $vote;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
require_celerity_resource('ponder-view-css');
|
||||
require_celerity_resource('javelin-behavior-ponder-votebox');
|
||||
|
||||
Javelin::initBehavior('ponder-votebox', array());
|
||||
|
||||
$uri = id(new PhutilURI($this->uri))->alter('phid', $this->phid);
|
||||
|
||||
$up = javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => (string)$uri,
|
||||
'sigil' => 'upvote',
|
||||
'mustcapture' => true,
|
||||
'class' => ($this->vote > 0) ? 'ponder-vote-active' : null,
|
||||
),
|
||||
"\xE2\x96\xB2");
|
||||
|
||||
$down = javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => (string)$uri,
|
||||
'sigil' => 'downvote',
|
||||
'mustcapture' => true,
|
||||
'class' => ($this->vote < 0) ? 'ponder-vote-active' : null,
|
||||
),
|
||||
"\xE2\x96\xBC");
|
||||
|
||||
$count = javelin_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'ponder-vote-count',
|
||||
'sigil' => 'ponder-vote-count',
|
||||
),
|
||||
$this->count);
|
||||
|
||||
return javelin_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'ponder-votable',
|
||||
'sigil' => 'ponder-votable',
|
||||
'meta' => array(
|
||||
'count' => (int)$this->count,
|
||||
'vote' => (int)$this->vote,
|
||||
),
|
||||
),
|
||||
array(
|
||||
javelin_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'ponder-votebox',
|
||||
),
|
||||
array($up, $count, $down)),
|
||||
phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'ponder-votebox-content',
|
||||
),
|
||||
$this->renderChildren()),
|
||||
));
|
||||
}
|
||||
|
||||
}
|
|
@ -2,45 +2,6 @@
|
|||
* @provides ponder-view-css
|
||||
*/
|
||||
|
||||
.ponder-votable {
|
||||
float: right;
|
||||
margin: 4px 0 4px 24px;
|
||||
}
|
||||
|
||||
.ponder-votebox {
|
||||
border-radius: 4px;
|
||||
background: #f3f3f3;
|
||||
border: 1px solid {$blueborder};
|
||||
text-align: center;
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
.ponder-votebox a {
|
||||
font-size: 20px;
|
||||
line-height: 24px;
|
||||
display: block;
|
||||
|
||||
text-decoration: none;
|
||||
color: #aaaaaa;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.ponder-votebox a.ponder-vote-active {
|
||||
color: {$blue};
|
||||
}
|
||||
|
||||
.ponder-votebox a:hover {
|
||||
color: #ffffff;
|
||||
background: {$blue};
|
||||
}
|
||||
|
||||
.ponder-vote-count {
|
||||
color: {$darkbluetext};
|
||||
font-size: {$biggerfontsize};
|
||||
line-height: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ponder-show-comments {
|
||||
text-align: center;
|
||||
padding: 8px;
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
* @provides javelin-behavior-ponder-votebox
|
||||
* @requires javelin-behavior
|
||||
* javelin-dom
|
||||
* javelin-util
|
||||
* javelin-stratcom
|
||||
* javelin-request
|
||||
*/
|
||||
|
||||
JX.behavior('ponder-votebox', function() {
|
||||
|
||||
function handle_vote(e, vote) {
|
||||
e.kill();
|
||||
|
||||
var root = e.getNode('ponder-votable');
|
||||
var data = e.getNodeData('ponder-votable');
|
||||
|
||||
if (data.vote != vote) {
|
||||
// Remove the user's current vote, if they have one.
|
||||
data.count -= data.vote;
|
||||
data.vote = vote;
|
||||
data.count += vote;
|
||||
} else {
|
||||
// User is undoing their vote.
|
||||
data.vote = 0;
|
||||
data.count -= vote;
|
||||
}
|
||||
|
||||
var upv = JX.DOM.find(root, 'a', 'upvote');
|
||||
JX.DOM.alterClass(upv, 'ponder-vote-active', (data.vote > 0));
|
||||
|
||||
var downv = JX.DOM.find(root, 'a', 'downvote');
|
||||
JX.DOM.alterClass(downv, 'ponder-vote-active', (data.vote < 0));
|
||||
|
||||
JX.DOM.setContent(
|
||||
JX.DOM.find(root, 'div', 'ponder-vote-count'),
|
||||
data.count);
|
||||
|
||||
new JX.Request(e.getTarget().href, JX.bag)
|
||||
.setData({vote: data.vote})
|
||||
.send();
|
||||
}
|
||||
|
||||
JX.Stratcom.listen(
|
||||
'click',
|
||||
'downvote',
|
||||
function(e) {
|
||||
handle_vote(e, -1);
|
||||
});
|
||||
|
||||
JX.Stratcom.listen(
|
||||
'click',
|
||||
'upvote',
|
||||
function(e) {
|
||||
handle_vote(e, 1);
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue