Add a publish button on article view.
This commit is contained in:
parent
2bf7e97c55
commit
2a2d35dfde
4 changed files with 70 additions and 2 deletions
26
js/App.js
26
js/App.js
|
@ -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");
|
||||
};
|
||||
|
|
Reference in a new issue