better conversation view

This commit is contained in:
jeena 2013-09-09 00:36:31 +02:00
parent 25e3f203e6
commit 037f382d72
5 changed files with 120 additions and 35 deletions

View file

@ -0,0 +1,25 @@
define([
],
function() {
function ConversationNode(dom_node) {
this.dom_node = dom_node;
this.parent = null;
this.children = [];
}
ConversationNode.prototype.addChild = function(node) {
this.children.push(node);
node.parent = this;
};
ConversationNode.prototype.toString = function() {
return "{ \"" + this.dom_node.status.entity + "\": [" + this.children.toString() + "]}";
};
return ConversationNode;
});

View file

@ -37,7 +37,11 @@ function(jQuery, APICalls, URI, HostApp, Markdown) {
var a = document.createElement("a");
var item = document.createElement("li");
var li = document.createElement("li");
var item = document.createElement("div");
item.className = "post";
li.appendChild(item);
var aside = document.createElement("aside");
item.appendChild(aside);
@ -143,6 +147,7 @@ function(jQuery, APICalls, URI, HostApp, Markdown) {
from.appendChild(source)
this.template = {
li: li,
item: item,
reply_to: reply_to,
is_private: is_private,
@ -188,8 +193,8 @@ function(jQuery, APICalls, URI, HostApp, Markdown) {
var template = this.getTemplate();
template.item.id = "post-" + status.id + "-" + this.action;
template.item.status = status;
template.li.id = "post-" + status.id + "-" + this.action;
template.li.status = status;
if (HostApp.stringForKey("entity") == status.entity && typeof status.__repost == "undefined") {
template.remove.onclick = function() {
@ -206,7 +211,7 @@ function(jQuery, APICalls, URI, HostApp, Markdown) {
}
if (HostApp.stringForKey("entity") == status.entity) {
template.item.className += " own";
template.li.className += " own";
}
template.reply_to.onclick = function() {
@ -361,7 +366,7 @@ function(jQuery, APICalls, URI, HostApp, Markdown) {
}
}
return template.item;
return template.li;
}