This commit is contained in:
Jeena Paradies 2012-11-22 02:06:55 +01:00
parent 2badd56b2b
commit accc5e5286
5 changed files with 51 additions and 12 deletions

View file

@ -154,7 +154,7 @@ function(HostApp, Paths, Hmac) {
}
Oauth.prototype.logout = function() {
return false;
}
return Oauth;

View file

@ -113,6 +113,12 @@ function(Core, Paths, HostApp, URI) {
Core.prototype.sendNewMessage.call(this, content, in_reply_to_status_id, in_reply_to_entity, callback);
}
Timeline.prototype.remove = function(id) {
var _this = this;
var callback = function(data) { _this.getNewData(); }
Core.prototype.remove.call(this, id, callback);
}
return Timeline;
});

View file

@ -36,6 +36,12 @@ function(jQuery, Paths, URI, HostApp, Followings) {
retweet.innerText = " ";
retweet.href = "#";
// item.appendChild(retweet); // FIXME
var remove = a.cloneNode();
remove.className = "remove";
remove.innerText = " ";
remove.href = "#";
item.appendChild(remove);
var image = document.createElement("img");
@ -124,7 +130,8 @@ function(jQuery, Paths, URI, HostApp, Followings) {
ago: ago,
source: source,
geo: geo,
images: images
images: images,
remove: remove
}
return jQuery.extend(true, {}, this.template);
@ -135,9 +142,18 @@ function(jQuery, Paths, URI, HostApp, Followings) {
var _this = this;
var template = this.getTemplate();
template.item.id = "post-" + status.id;
if (HostApp.stringForKey("entity") == status.entity) {
template.remove.onclick = function() {
_this.remove(status.id);
return false;
}
} else {
template.remove.style.display = "none";
}
template.reply_to.onclick = function() {
var mentions = [];
@ -256,7 +272,15 @@ function(jQuery, Paths, URI, HostApp, Followings) {
data["mentions"] = mentions;
}
Paths.getURL(url.toString(), http_method, callback, JSON.stringify(data)); // FIXME: error callback
Paths.getURL(url.toString(), http_method, callback, JSON.stringify(data));
}
Core.prototype.remove = function(id, callback) {
if (confirm("Really delete this post?")) {
var url = URI(Paths.mkApiRootPath("/posts/" + id));
Paths.getURL(url.toString(), "DELETE", callback);
}
}