status update placeholder removed, javascript not required to post

This commit is contained in:
Mikael Nordfeldth 2015-01-08 18:04:46 +01:00
parent 370341ce31
commit 40412b6b79
4 changed files with 25 additions and 98 deletions

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -1,61 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
*
* Form for posting a notice
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category Form
* @package StatusNet
* @author Brion Vibber <brion@status.net>
* @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 <brion@status.net>
* @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');
}
}

View File

@ -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;
}