From 40412b6b79fd44b267e921b4c9f80d0616318f3e Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 8 Jan 2015 18:04:46 +0100 Subject: [PATCH] status update placeholder removed, javascript not required to post --- js/util.js | 46 ++++++++++++-------------- lib/action.php | 13 ++------ lib/noticeplaceholderform.php | 61 ----------------------------------- theme/base/css/display.css | 3 +- 4 files changed, 25 insertions(+), 98 deletions(-) delete mode 100644 lib/noticeplaceholderform.php diff --git a/js/util.js b/js/util.js index 82ca6e4bce..6fabb1e13b 100644 --- a/js/util.js +++ b/js/util.js @@ -433,7 +433,7 @@ var SN = { // StatusNet .css({display: 'none'}) .fadeIn(2500); SN.U.NoticeWithAttachment($('#' + notice.id)); - SN.U.switchInputFormTab("placeholder"); + SN.U.switchInputFormTab(null); } } else { // Not on a timeline that this belongs on? @@ -1382,14 +1382,10 @@ var SN = { // StatusNet * * @param {String} tag */ - switchInputFormTab: function (tag) { - // The one that's current isn't current anymore - $('.input_form_nav_tab.current').removeClass('current'); - if (tag == 'placeholder') { - // Hack: when showing the placeholder, mark the tab - // as current for 'Status'. - $('#input_form_nav_status').addClass('current'); - } else { + switchInputFormTab: function (tag) { + // The one that's current isn't current anymore + $('.input_form_nav_tab.current').removeClass('current'); + if (tag != null) { $('#input_form_nav_' + tag).addClass('current'); } @@ -1401,17 +1397,22 @@ var SN = { // StatusNet return; } - $('.input_form.current').removeClass('current'); - $('#input_form_' + tag) - .addClass('current') - .find('.ajax-notice').each(function () { - var form = $(this); - SN.Init.NoticeFormSetup(form); - }) - .find('.notice_data-text').focus(); + $('.input_form.current').removeClass('current'); + if (tag == null) { + // we're done here, no new inputform to focus on + return false; + } - return false; - }, + $('#input_form_' + tag) + .addClass('current') + .find('.ajax-notice').each(function () { + var form = $(this); + SN.Init.NoticeFormSetup(form); + }) + .find('.notice_data-text').focus(); + + return false; + }, showMoreMenuItems: function (menuid) { $('#' + menuid + ' .more_link').remove(); @@ -1436,11 +1437,6 @@ var SN = { // StatusNet // SN.Init.NoticeFormSetup() will get run // when forms get displayed for the first time... - // Hack to initialize the placeholder at top - $('#input_form_placeholder input.placeholder').focus(function () { - SN.U.switchInputFormTab("status"); - }); - // Make inline reply forms self-close when clicking out. $('body').on('click', function (e) { var currentForm = $('#content .input_forms div.current'); @@ -1453,7 +1449,7 @@ var SN = { // StatusNet anything = anything || $(this).val(); }); if (!anything) { - SN.U.switchInputFormTab("placeholder"); + SN.U.switchInputFormTab(null); } } } diff --git a/lib/action.php b/lib/action.php index 4909af9926..cc02305ffe 100644 --- a/lib/action.php +++ b/lib/action.php @@ -736,9 +736,6 @@ class Action extends HTMLOutputter // lawsuit 'class' => 'input_form_nav_tab'); if ($tag == 'status') { - // We're actually showing the placeholder form, - // but we special-case the 'Status' tab as if - // it were a small version of it. $attrs['class'] .= ' current'; } $this->elementStart('li', $attrs); @@ -752,16 +749,12 @@ class Action extends HTMLOutputter // lawsuit $this->elementEnd('ul'); - $attrs = array('class' => 'input_form current', - 'id' => 'input_form_placeholder'); - $this->elementStart('div', $attrs); - $form = new NoticePlaceholderForm($this); - $form->show(); - $this->elementEnd('div'); - foreach ($tabs as $tag => $data) { $attrs = array('class' => 'input_form', 'id' => 'input_form_'.$tag); + if ($tag == 'status') { + $attrs['class'] .= ' current'; + } $this->elementStart('div', $attrs); diff --git a/lib/noticeplaceholderform.php b/lib/noticeplaceholderform.php deleted file mode 100644 index 87e64fb8d0..0000000000 --- a/lib/noticeplaceholderform.php +++ /dev/null @@ -1,61 +0,0 @@ -. - * - * @category Form - * @package StatusNet - * @author Brion Vibber - * @copyright 2011 StatusNet, Inc. - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - */ - -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} - -require_once INSTALLDIR.'/lib/form.php'; - -/** - * Placeholder form for posting a notice - * - * Frequently-used form for posting a notice - * - * @category Form - * @package StatusNet - * @author Brion Vibber - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://status.net/ - * - * @see HTMLOutputter - */ -class NoticePlaceholderForm extends Widget -{ - function show() - { - // Similar to that for inline replies, but not quite! - // TRANS: Field label for notice text. - $placeholder = _('Update your status...'); - $this->out->elementStart('div', 'form_notice_placeholder'); - $this->out->element('input', array('class' => 'placeholder', - 'value' => $placeholder)); - $this->out->elementEnd('div'); - } -} diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 4b68ae1ade..4be2d61e28 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -248,15 +248,14 @@ address .poweredby { /* input forms */ .input_forms { - float: left; position: relative; margin-bottom: 10px; border-bottom: 1px dotted #ccc; + width: 100%; } #input_form_nav { float: left; - width: 100%; margin-bottom: 10px; list-style-type: none; } -- 2.39.5