Clean up threaded notices vs replies classes, and fixed realtime's threaded behavior to only run on threaded lists

This commit is contained in:
Brion Vibber 2011-03-01 16:08:37 -08:00
parent 9fd2ee86f3
commit 764d069ccd
6 changed files with 23 additions and 23 deletions

View File

@ -575,16 +575,16 @@ var SN = { // StatusNet
// Find the threaded replies view we'll be adding to... // Find the threaded replies view we'll be adding to...
var list = notice.closest('.notices'); var list = notice.closest('.notices');
if (list.hasClass('threaded-notices')) { if (list.hasClass('threaded-replies')) {
// We're replying to a reply; use reply form on the end of this list. // We're replying to a reply; use reply form on the end of this list.
// We'll add our form at the end of this; grab the root notice. // We'll add our form at the end of this; grab the root notice.
parentNotice = list.closest('.notice'); parentNotice = list.closest('.notice');
} else { } else {
// We're replying to a parent notice; pull its threaded list // We're replying to a parent notice; pull its threaded list
// and we'll add on the end of it. Will add if needed. // and we'll add on the end of it. Will add if needed.
list = $('ul.threaded-notices', notice); list = $('ul.threaded-replies', notice);
if (list.length == 0) { if (list.length == 0) {
list = $('<ul class="notices threaded-notices xoxo"></ul>'); list = $('<ul class="notices threaded-replies xoxo"></ul>');
notice.append(list); notice.append(list);
} }
} }
@ -731,7 +731,7 @@ var SN = { // StatusNet
}, },
NoticeInlineReplyPlaceholder: function(notice) { NoticeInlineReplyPlaceholder: function(notice) {
var list = notice.find('ul.threaded-notices'); var list = notice.find('ul.threaded-replies');
var placeholder = $('<li class="notice-reply-placeholder">' + var placeholder = $('<li class="notice-reply-placeholder">' +
'<input class="placeholder">' + '<input class="placeholder">' +
'</li>'); '</li>');
@ -749,7 +749,7 @@ var SN = { // StatusNet
* Uses 'live' rather than 'bind', so applies to future as well as present items. * Uses 'live' rather than 'bind', so applies to future as well as present items.
*/ */
NoticeInlineReplySetup: function() { NoticeInlineReplySetup: function() {
$('.threaded-notices').each(function() { $('.threaded-replies').each(function() {
var list = $(this); var list = $(this);
var notice = list.closest('.notice'); var notice = list.closest('.notice');
SN.U.NoticeInlineReplyPlaceholder(notice); SN.U.NoticeInlineReplyPlaceholder(notice);

2
js/util.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -64,7 +64,7 @@ class ThreadedNoticeList extends NoticeList
{ {
$this->out->elementStart('div', array('id' =>'notices_primary')); $this->out->elementStart('div', array('id' =>'notices_primary'));
$this->out->element('h2', null, _('Notices')); $this->out->element('h2', null, _('Notices'));
$this->out->elementStart('ol', array('class' => 'notices xoxo')); $this->out->elementStart('ol', array('class' => 'notices threaded-notices xoxo'));
$cnt = 0; $cnt = 0;
$conversations = array(); $conversations = array();
@ -182,7 +182,7 @@ class ThreadedNoticeListItem extends NoticeListItem
} }
if ($notices) { if ($notices) {
$this->out->elementStart('ul', 'notices threaded-notices xoxo'); $this->out->elementStart('ul', 'notices threaded-replies xoxo');
if ($moreCutoff) { if ($moreCutoff) {
$item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out); $item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out);
$item->show(); $item->show();

View File

@ -169,7 +169,7 @@ RealtimeUpdate = {
var list = $("#notices_primary .notices:first") var list = $("#notices_primary .notices:first")
var prepend = true; var prepend = true;
var threaded = true; var threaded = list.hasClass('threaded-notices');
if (threaded && data.in_reply_to_status_id) { if (threaded && data.in_reply_to_status_id) {
// aho! // aho!
var parent = $('#notice-' + data.in_reply_to_status_id); var parent = $('#notice-' + data.in_reply_to_status_id);
@ -179,12 +179,12 @@ RealtimeUpdate = {
// Check the parent notice to make sure it's not a reply itself. // Check the parent notice to make sure it's not a reply itself.
// If so, use it's parent as the parent. // If so, use it's parent as the parent.
var parentList = parent.closest('.notices'); var parentList = parent.closest('.notices');
if (parentList.hasClass('threaded-notices')) { if (parentList.hasClass('threaded-replies')) {
parent = parentList.closest('.notice'); parent = parentList.closest('.notice');
} }
list = parent.find('.threaded-notices'); list = parent.find('.threaded-replies');
if (list.length == 0) { if (list.length == 0) {
list = $('<ul class="notices threaded-notices xoxo"></ul>'); list = $('<ul class="notices threaded-replies xoxo"></ul>');
parent.append(list); parent.append(list);
} }
prepend = false; prepend = false;

File diff suppressed because one or more lines are too long

View File

@ -1106,38 +1106,38 @@ border-top-style:solid;
} }
/* Threaded notices sublist */ /* Threaded notices sublist */
#content .notices .threaded-notices { #content .notices .threaded-replies {
margin-left: 10%; margin-left: 10%;
width: 90%; width: 90%;
background: #e4e8f1; background: #e4e8f1;
} }
#content .threaded-notices .notice .author .photo { #content .threaded-replies .notice .author .photo {
left: 8px; left: 8px;
width: 32px; width: 32px;
height: 32px; height: 32px;
} }
.threaded-notices .notice-reply { .threaded-replies .notice-reply {
margin: 8px; margin: 8px;
} }
.threaded-notices .notice-reply textarea, .threaded-replies .notice-reply textarea,
.threaded-notices .notice-reply-placeholder input.placeholder { .threaded-replies .notice-reply-placeholder input.placeholder {
margin-left: 0; margin-left: 0;
width: 95%; width: 95%;
} }
.threaded-notices .notice-reply-placeholder input.placeholder { .threaded-replies .notice-reply-placeholder input.placeholder {
color: gray; color: gray;
margin-left: 8px; /* ?? */ margin-left: 8px; /* ?? */
margin-bottom: 8px; margin-bottom: 8px;
} }
.threaded-notices .notice-reply .controls { .threaded-replies .notice-reply .controls {
text-align: right; text-align: right;
} }
.threaded-notices .notice-reply-comments { .threaded-replies .notice-reply-comments {
margin: 8px; margin: 8px;
} }
.threaded-notices .response, .threaded-replies .response,
.threaded-notices .source { .threaded-replies .source {
/* Hide these for ajax/realtime sourced notices */ /* Hide these for ajax/realtime sourced notices */
display: none; display: none;
} }