From c9e42fab4fb882325fade47765627bc41fd7eb99 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 31 Mar 2013 14:41:33 -0700 Subject: [PATCH] Fix Control + Enter for Pontificate Summary: Simplifies the Pontificate button and makes Control + Enter work again. Test Plan: Submitted the form by clicking, hitting return, hitting control+enter. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D5472 --- src/__celerity_resource_map__.php | 2 +- src/__phutil_library_map__.php | 2 -- .../controller/ConpherenceViewController.php | 6 ++-- .../view/ConpherencePontificateControl.php | 29 ------------------- .../conpherence/behavior-pontificate.js | 5 +++- 5 files changed, 9 insertions(+), 35 deletions(-) delete mode 100644 src/applications/conpherence/view/ConpherencePontificateControl.php diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index ffc0fdb25b..17c7065615 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -1206,7 +1206,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-conpherence-pontificate' => array( - 'uri' => '/res/e5a0ce39/rsrc/js/application/conpherence/behavior-pontificate.js', + 'uri' => '/res/a5f5b42c/rsrc/js/application/conpherence/behavior-pontificate.js', 'type' => 'js', 'requires' => array( diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 5ed1d203e8..26ab7dee34 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -238,7 +238,6 @@ phutil_register_library_map(array( 'ConpherenceParticipantQuery' => 'applications/conpherence/query/ConpherenceParticipantQuery.php', 'ConpherenceParticipationStatus' => 'applications/conpherence/constants/ConpherenceParticipationStatus.php', 'ConpherencePeopleMenuEventListener' => 'applications/conpherence/events/ConpherencePeopleMenuEventListener.php', - 'ConpherencePontificateControl' => 'applications/conpherence/view/ConpherencePontificateControl.php', 'ConpherenceReplyHandler' => 'applications/conpherence/mail/ConpherenceReplyHandler.php', 'ConpherenceSettings' => 'applications/conpherence/constants/ConpherenceSettings.php', 'ConpherenceThread' => 'applications/conpherence/storage/ConpherenceThread.php', @@ -1948,7 +1947,6 @@ phutil_register_library_map(array( 'ConpherenceParticipantQuery' => 'PhabricatorOffsetPagedQuery', 'ConpherenceParticipationStatus' => 'ConpherenceConstants', 'ConpherencePeopleMenuEventListener' => 'PhutilEventListener', - 'ConpherencePontificateControl' => 'AphrontFormControl', 'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler', 'ConpherenceSettings' => 'ConpherenceConstants', 'ConpherenceThread' => diff --git a/src/applications/conpherence/controller/ConpherenceViewController.php b/src/applications/conpherence/controller/ConpherenceViewController.php index f5c6a1c2ae..5ae7710927 100644 --- a/src/applications/conpherence/controller/ConpherenceViewController.php +++ b/src/applications/conpherence/controller/ConpherenceViewController.php @@ -82,6 +82,8 @@ final class ConpherenceViewController extends ->setID($form_id) ->setAction($update_uri) ->setFlexible(true) + ->addSigil('conpherence-pontificate') + ->setWorkflow(true) ->setUser($user) ->addHiddenInput('action', 'message') ->addHiddenInput('latest_transaction_id', $latest_transaction_id) @@ -90,8 +92,8 @@ final class ConpherenceViewController extends ->setUser($user) ->setName('text')) ->appendChild( - id(new ConpherencePontificateControl()) - ->setFormID($form_id)) + id(new AphrontFormSubmitControl()) + ->setValue(pht('Pontificate'))) ->render(); $scrollbutton = javelin_tag( diff --git a/src/applications/conpherence/view/ConpherencePontificateControl.php b/src/applications/conpherence/view/ConpherencePontificateControl.php deleted file mode 100644 index 5b7a8ec2ac..0000000000 --- a/src/applications/conpherence/view/ConpherencePontificateControl.php +++ /dev/null @@ -1,29 +0,0 @@ -formID = $form_id; - return $this; - } - public function getFormID() { - return $this->formID; - } - - protected function getCustomControlClass() { - return 'aphront-form-control-submit'; - } - - protected function renderInput() { - - return javelin_tag( - 'button', - array ( - 'sigil' => 'conpherence-pontificate', - ), - pht('Pontificate')); - } - -} diff --git a/webroot/rsrc/js/application/conpherence/behavior-pontificate.js b/webroot/rsrc/js/application/conpherence/behavior-pontificate.js index e2a9f7dea9..c344e474dd 100644 --- a/webroot/rsrc/js/application/conpherence/behavior-pontificate.js +++ b/webroot/rsrc/js/application/conpherence/behavior-pontificate.js @@ -49,6 +49,9 @@ JX.behavior('conpherence-pontificate', function(config) { .start(); }; - JX.Stratcom.listen('click', 'conpherence-pontificate', onsubmit); + JX.Stratcom.listen( + ['submit', 'didSyntheticSubmit'], + 'conpherence-pontificate', + onsubmit); });