summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorjulian laplace <julescarbon@gmail.com>2022-10-27 17:56:15 +0200
committerjulian laplace <julescarbon@gmail.com>2022-10-27 17:56:15 +0200
commit7ac985f220ccedb8c4c305e15521c94436aa3dfb (patch)
tree4941c03ba4278cf2562aad5abe45381c3239762b /public
parente2aff14776de097dca5b0b7fbafdef201558bf28 (diff)
add some post links and stuff
Diffstat (limited to 'public')
-rw-r--r--public/assets/css/hootstream.css4
-rw-r--r--public/assets/js/lib/views/details/details.js92
-rw-r--r--public/assets/js/lib/views/stream/hootfilters.js13
3 files changed, 63 insertions, 46 deletions
diff --git a/public/assets/css/hootstream.css b/public/assets/css/hootstream.css
index d0d10a2..da65bc5 100644
--- a/public/assets/css/hootstream.css
+++ b/public/assets/css/hootstream.css
@@ -396,6 +396,10 @@
#hootfilters .sortDesc input[type="radio"]:checked + span {
text-decoration: overline;
}
+#hootfilters div.editLink,
+#hootfilters div.classicLink {
+ margin-right: 0;
+}
/** Read more */
#hootevents .readMore {
diff --git a/public/assets/js/lib/views/details/details.js b/public/assets/js/lib/views/details/details.js
index 49230a3..465655b 100644
--- a/public/assets/js/lib/views/details/details.js
+++ b/public/assets/js/lib/views/details/details.js
@@ -1,64 +1,66 @@
var DetailsView = View.extend({
+ events: {},
- events: {
- },
-
action: "/api/thread/",
keywordAction: "/api/keyword/",
-
- initialize: function(opt){
- this.comments = new CommentsView ({ parent: this })
- this.files = new FilesView ({ parent: this })
- this.gallery = new GalleryView ({ parent: this })
- this.form = new CommentForm ({ parent: this })
- this.threadbox = new ThreadBox ({ parent: this })
- this.settings = new ThreadSettingsForm ({ parent: this })
- $(".settings_link").click(this.openSettings.bind(this))
+
+ initialize: function (opt) {
+ this.comments = new CommentsView({ parent: this });
+ this.files = new FilesView({ parent: this });
+ this.gallery = new GalleryView({ parent: this });
+ this.form = new CommentForm({ parent: this });
+ this.threadbox = new ThreadBox({ parent: this });
+ this.settings = new ThreadSettingsForm({ parent: this });
+ $(".settings_link").click(this.openSettings.bind(this));
},
-
- load: function(id){
- id = id.replace(/\D/g, "")
+
+ load: function (id) {
+ id = id.replace(/\D/g, "");
$.ajax({
method: "get",
url: this.action + id,
success: this.populate.bind(this),
error: app.router.error404,
- })
+ });
},
-
- populate: function(data){
- this.data = data
+
+ populate: function (data) {
+ this.data = data;
// console.log(data)
- set_background_color(data.thread.color || (data.keyword ? data.keyword.color : 'plain'))
- $("body").removeClass('loading')
- var thread = data.thread
- $("h1").html(sanitizeHTML(thread.title))
- $("title").html(sanitizeHTML(thread.title))
- $(".metadata").html(metadata(thread))
- $(".settings_link").attr("href", "/details/" + thread.id + "/settings")
- this.form.load(data.thread)
- this.comments.load(data.comments, data.thread)
- this.files.load(data.files, data.thread)
- this.gallery.load(this.files.sortedFiles, data.thread)
+ set_background_color(
+ data.thread.color || (data.keyword ? data.keyword.color : "plain")
+ );
+ $("body").removeClass("loading");
+ var thread = data.thread;
+ $("h1").html(sanitizeHTML(thread.title));
+ $("title").html(sanitizeHTML(thread.title));
+ $(".metadata").html(metadata(thread));
+ $(".stream_link").attr("href", "/stream/thread/" + thread.id);
+ $(".settings_link").attr("href", "/details/" + thread.id + "/settings");
+ this.form.load(data.thread);
+ this.comments.load(data.comments, data.thread);
+ this.files.load(data.files, data.thread);
+ this.gallery.load(this.files.sortedFiles, data.thread);
if (data.thread.keyword) {
- $.get(this.keywordAction + data.thread.keyword, this.populateKeyword.bind(this))
+ $.get(
+ this.keywordAction + data.thread.keyword,
+ this.populateKeyword.bind(this)
+ );
+ } else {
+ this.settings.loadThreads(null);
}
- else {
- this.settings.loadThreads(null)
- }
if (this.options.settings) {
- this.openSettings()
+ this.openSettings();
}
},
-
- populateKeyword: function(data){
- this.threadbox.load(data)
- this.settings.loadThreads(data.threads)
- },
-
- openSettings: function(e){
- e && e.preventDefault()
- this.settings.show()
+
+ populateKeyword: function (data) {
+ this.threadbox.load(data);
+ this.settings.loadThreads(data.threads);
},
-})
+ openSettings: function (e) {
+ e && e.preventDefault();
+ this.settings.show();
+ },
+});
diff --git a/public/assets/js/lib/views/stream/hootfilters.js b/public/assets/js/lib/views/stream/hootfilters.js
index 2f4e4ac..68f0cdd 100644
--- a/public/assets/js/lib/views/stream/hootfilters.js
+++ b/public/assets/js/lib/views/stream/hootfilters.js
@@ -15,6 +15,7 @@ var HootFilters = View.extend({
this.$hoots = this.$("[name=hoots]");
this.$sortOrder = this.$(".sort");
this.$sort = this.$("[name=sort]");
+ this.$editLink = this.$(".editLink");
this.$classicLink = this.$(".classicLink");
this.state = {
unset: true,
@@ -65,17 +66,27 @@ var HootFilters = View.extend({
this.$hoots.closest("label").toggle(hoots);
this.$files.closest("label").toggle(normal_files);
if (target.thread || target.keyword || target.username) {
- let classicHref, classicText;
+ let classicHref, classicText, editText, editHref;
if (target.thread) {
+ editHref = `/details/${target.thread}/settings`;
classicHref = `/details/${target.thread}`;
+ editText = "settings";
classicText = "thread";
} else if (target.keyword) {
+ editHref = `/post/${target.keyword}`;
classicHref = `/index/${target.keyword}`;
+ editText = "post";
classicText = "keyword";
} else if (target.username) {
classicHref = `/profile/${target.username}`;
classicText = "profile";
}
+ if (editHref) {
+ this.$editLink.show();
+ this.$editLink.find("a").attr("href", editHref).html(editText);
+ } else {
+ this.$editLink.hide();
+ }
this.$classicLink.show();
this.$classicLink.find("a").attr("href", classicHref).html(classicText);
} else {