Add a publish button on article view.

This commit is contained in:
Bonbadil 2014-10-15 22:00:32 +02:00
parent 2bf7e97c55
commit 2a2d35dfde
4 changed files with 70 additions and 2 deletions

View file

@ -54,6 +54,8 @@ App.prototype.after_login = function(backend) {
_this.toggleCurrentUnread();
} else if(url == "#starred") {
_this.toggleStarred();
} else if(url == "#published") {
_this.togglePublished();
} else if(url == "#logout") {
_this.logout();
} else if(url == "#reset-info") {
@ -109,6 +111,7 @@ App.prototype.after_login = function(backend) {
this.backend = new Pond(this, localStorage.server_url, localStorage.session_id)
} else {
this.backend = new TinyTinyRSS(this, localStorage.server_url, localStorage.session_id);
$("#setpublished").addClass("active");
}
var numArticles = localStorage.numArticles;
@ -346,6 +349,12 @@ App.prototype.showFull = function(article, slide_back) {
$("#setstarred").innerHTML = "☆";
}
if(article.published) {
$("#setpublished").innerHTML = "U";
} else {
$("#setpublished").innerHTML = "P";
}
};
App.prototype.showNext = function() {
@ -455,6 +464,23 @@ App.prototype.toggleStarred = function() {
};
App.prototype.togglePublished = function() {
var article = this.unread_articles[this.currentIndex];
if(!article) return; // happens if we're not on a full article site
if(!article.published) {
article.published = true;
this.backend.setArticlePublished(article);
$("#setpublished").innerHTML = "U";
}
else {
article.published = false;
this.backend.setArticleUnpublished(article);
$("#setpublished").innerHTML = "P";
}
};
App.prototype.goToList = function() {
this.changeToPage("#list");
};