diff --git a/resources/celerity/map.php b/resources/celerity/map.php index da014bccde..10a54b7e8e 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -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', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index d52f761126..36675ef9f5 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php index c5349c5eab..cad39b4135 100644 --- a/src/applications/ponder/controller/PonderQuestionViewController.php +++ b/src/applications/ponder/controller/PonderQuestionViewController.php @@ -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( diff --git a/src/applications/ponder/view/PonderVotableView.php b/src/applications/ponder/view/PonderVotableView.php deleted file mode 100644 index dbd6ba32a8..0000000000 --- a/src/applications/ponder/view/PonderVotableView.php +++ /dev/null @@ -1,92 +0,0 @@ -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()), - )); - } - -} diff --git a/webroot/rsrc/css/application/ponder/ponder-view.css b/webroot/rsrc/css/application/ponder/ponder-view.css index 237c3e7676..4cf9509281 100644 --- a/webroot/rsrc/css/application/ponder/ponder-view.css +++ b/webroot/rsrc/css/application/ponder/ponder-view.css @@ -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; diff --git a/webroot/rsrc/js/application/ponder/behavior-votebox.js b/webroot/rsrc/js/application/ponder/behavior-votebox.js deleted file mode 100644 index 47e750bcb7..0000000000 --- a/webroot/rsrc/js/application/ponder/behavior-votebox.js +++ /dev/null @@ -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); - }); -});