Merge branch 'magic' into 1.0.x
This commit is contained in:
commit
17dc1c8703
44
js/util.js
44
js/util.js
@ -424,6 +424,7 @@ var SN = { // StatusNet
|
||||
.fadeIn(2500);
|
||||
SN.U.NoticeWithAttachment($('#'+notice.id));
|
||||
SN.U.NoticeReplyTo($('#'+notice.id));
|
||||
SN.U.switchInputFormTab("placeholder");
|
||||
}
|
||||
} else {
|
||||
// Not on a timeline that this belongs on?
|
||||
@ -1292,7 +1293,13 @@ var SN = { // StatusNet
|
||||
$('#input_form_nav_'+tag).addClass('current');
|
||||
|
||||
$('.input_form.current').removeClass('current');
|
||||
$('#input_form_'+tag).addClass('current');
|
||||
$('#input_form_'+tag)
|
||||
.addClass('current')
|
||||
.find('.ajax-notice').each(function() {
|
||||
var form = $(this);
|
||||
SN.Init.NoticeFormSetup(form);
|
||||
})
|
||||
.find('textarea:first').focus();
|
||||
}
|
||||
},
|
||||
|
||||
@ -1307,13 +1314,31 @@ var SN = { // StatusNet
|
||||
*/
|
||||
NoticeForm: function() {
|
||||
if ($('body.user_in').length > 0) {
|
||||
$('.ajax-notice').each(function() {
|
||||
var form = $(this);
|
||||
SN.Init.NoticeFormSetup(form);
|
||||
// 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').bind('click', function(e) {
|
||||
var currentForm = $('#content .input_forms div.current');
|
||||
if (currentForm.length > 0) {
|
||||
if ($('#content .input_forms').has(e.target).length == 0) {
|
||||
// If all fields are empty, switch back to the placeholder.
|
||||
var fields = currentForm.find('textarea, input[type=text], input[type=""]');
|
||||
var anything = false;
|
||||
fields.each(function() {
|
||||
anything = anything || $(this).val();
|
||||
});
|
||||
if (!anything) {
|
||||
SN.U.switchInputFormTab("placeholder");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var openReplies = $('li.notice-reply');
|
||||
if (openReplies.length > 0) {
|
||||
var target = $(e.target);
|
||||
@ -1344,10 +1369,13 @@ var SN = { // StatusNet
|
||||
* @param {jQuery} form
|
||||
*/
|
||||
NoticeFormSetup: function(form) {
|
||||
SN.U.NoticeLocationAttach(form);
|
||||
SN.U.FormNoticeXHR(form);
|
||||
SN.U.FormNoticeEnhancements(form);
|
||||
SN.U.NoticeDataAttach(form);
|
||||
if (!form.data('NoticeFormSetup')) {
|
||||
SN.U.NoticeLocationAttach(form);
|
||||
SN.U.FormNoticeXHR(form);
|
||||
SN.U.FormNoticeEnhancements(form);
|
||||
SN.U.NoticeDataAttach(form);
|
||||
form.data('NoticeFormSetup', true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
2
js/util.min.js
vendored
2
js/util.min.js
vendored
File diff suppressed because one or more lines are too long
@ -601,10 +601,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||
$attrs = array('id' => 'input_form_nav_'.$tag,
|
||||
'class' => 'input_form_nav_tab');
|
||||
|
||||
if ($tag == 'status') {
|
||||
$attrs['class'] .= ' current';
|
||||
}
|
||||
|
||||
$this->elementStart('li', $attrs);
|
||||
|
||||
$this->element('a',
|
||||
@ -615,15 +611,18 @@ 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 => $title) {
|
||||
|
||||
$attrs = array('class' => 'input_form',
|
||||
'id' => 'input_form_'.$tag);
|
||||
|
||||
if ($tag == 'status') {
|
||||
$attrs['class'] .= ' current';
|
||||
}
|
||||
|
||||
$this->elementStart('div', $attrs);
|
||||
|
||||
$form = null;
|
||||
|
60
lib/noticeplaceholderform.php
Normal file
60
lib/noticeplaceholderform.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?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!
|
||||
$placeholder = _('Update your status...');
|
||||
$this->out->elementStart('div', 'form_notice_placeholder');
|
||||
$this->out->element('input', array('class' => 'placeholder',
|
||||
'value' => $placeholder));
|
||||
$this->out->elementEnd('div');
|
||||
}
|
||||
}
|
@ -273,8 +273,11 @@ address {
|
||||
display: none; /* XXX move into input with js */
|
||||
}
|
||||
|
||||
.form_notice textarea {
|
||||
.form_notice textarea,
|
||||
.form_notice_placeholder .placeholder {
|
||||
width: 473px;
|
||||
}
|
||||
.form_notice textarea {
|
||||
height: 42px;
|
||||
padding: 6px 10px 18px 10px;
|
||||
border: 1px solid #a6a6a6;
|
||||
|
Loading…
Reference in New Issue
Block a user