js: put a link to Atom feed on top of the main postbox

This commit is contained in:
Vincent Bernat 2018-04-22 13:00:22 +02:00
parent a89debbc9c
commit bceb69518b
5 changed files with 24 additions and 1 deletions

View File

@ -15,6 +15,14 @@
color: #555; color: #555;
font-weight: bold; font-weight: bold;
} }
#isso-thread > .isso-feedlink {
float: right;
padding-left: 1em;
}
#isso-thread > .isso-feedlink > a {
font-size: 0.8em;
vertical-align: bottom;
}
#isso-thread .textarea { #isso-thread .textarea {
min-height: 58px; min-height: 58px;
outline: 0; outline: 0;
@ -119,10 +127,12 @@
color: gray !important; color: gray !important;
clear: left; clear: left;
} }
.isso-feedlink,
.isso-comment > div.text-wrapper > .isso-comment-footer a { .isso-comment > div.text-wrapper > .isso-comment-footer a {
font-weight: bold; font-weight: bold;
text-decoration: none; text-decoration: none;
} }
.isso-feedlink:hover,
.isso-comment > div.text-wrapper > .isso-comment-footer a:hover { .isso-comment > div.text-wrapper > .isso-comment-footer a:hover {
color: #111111 !important; color: #111111 !important;
text-shadow: #aaaaaa 0 0 1px !important; text-shadow: #aaaaaa 0 0 1px !important;
@ -152,6 +162,7 @@
.isso-postbox { .isso-postbox {
max-width: 68em; max-width: 68em;
margin: 0 auto 2em; margin: 0 auto 2em;
clear: right;
} }
.isso-postbox > .form-wrapper { .isso-postbox > .form-wrapper {
display: block; display: block;

View File

@ -191,6 +191,10 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) {
return deferred.promise; return deferred.promise;
}; };
var feed = function(tid) {
return endpoint + "/feed?" + qs({uri: tid || location});
}
return { return {
endpoint: endpoint, endpoint: endpoint,
salt: salt, salt: salt,
@ -202,6 +206,7 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) {
fetch: fetch, fetch: fetch,
count: count, count: count,
like: like, like: like,
dislike: dislike dislike: dislike,
feed: feed
}; };
}); });

View File

@ -7,6 +7,7 @@ define({
"num-comments": "One Comment\n{{ n }} Comments", "num-comments": "One Comment\n{{ n }} Comments",
"no-comments": "No Comments Yet", "no-comments": "No Comments Yet",
"atom-feed": "Atom feed",
"comment-reply": "Reply", "comment-reply": "Reply",
"comment-edit": "Edit", "comment-edit": "Edit",

View File

@ -6,6 +6,7 @@ define({
"postbox-submit": "Soumettre", "postbox-submit": "Soumettre",
"num-comments": "{{ n }} commentaire\n{{ n }} commentaires", "num-comments": "{{ n }} commentaire\n{{ n }} commentaires",
"no-comments": "Aucun commentaire pour l'instant", "no-comments": "Aucun commentaire pour l'instant",
"atom-feed": "Flux Atom",
"comment-reply": "Répondre", "comment-reply": "Répondre",
"comment-edit": "Éditer", "comment-edit": "Éditer",
"comment-save": "Enregistrer", "comment-save": "Enregistrer",

View File

@ -27,6 +27,11 @@ require(["app/lib/ready", "app/config", "app/i18n", "app/api", "app/isso", "app/
return console.log("abort, #isso-thread is missing"); return console.log("abort, #isso-thread is missing");
} }
var feedLink = $.new('a', i18n.translate('atom-feed'));
var feedLinkWrapper = $.new('span.isso-feedlink');
feedLink.href = api.feed($("#isso-thread").getAttribute("data-isso-id"));
feedLinkWrapper.append(feedLink);
$("#isso-thread").append(feedLinkWrapper);
$("#isso-thread").append($.new('h4')); $("#isso-thread").append($.new('h4'));
$("#isso-thread").append(new isso.Postbox(null)); $("#isso-thread").append(new isso.Postbox(null));
$("#isso-thread").append('<div id="isso-root"></div>'); $("#isso-thread").append('<div id="isso-root"></div>');