diff options
Diffstat (limited to 'public/assets/js/lib/views/index')
| -rw-r--r-- | public/assets/js/lib/views/index/index.js | 9 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/threadform.js | 22 |
2 files changed, 21 insertions, 10 deletions
diff --git a/public/assets/js/lib/views/index/index.js b/public/assets/js/lib/views/index/index.js index 3f217fc..edf5483 100644 --- a/public/assets/js/lib/views/index/index.js +++ b/public/assets/js/lib/views/index/index.js @@ -34,6 +34,15 @@ var IndexView = View.extend({ this.hootbox.load(data.hootbox) this.threadbox.load(data) this.lastlog.load(data.lastlog) + if (data.mail.count) { + $(".alert").show().html( + "<a href='/mail'>" + + "You have " + + data.mail.count + + " new message" + + courtesy_s(data.mail.count) + + "!</a>") + } $(".search_form input").focus() }, diff --git a/public/assets/js/lib/views/index/threadform.js b/public/assets/js/lib/views/index/threadform.js index 7a8e8ed..b2e1963 100644 --- a/public/assets/js/lib/views/index/threadform.js +++ b/public/assets/js/lib/views/index/threadform.js @@ -1,18 +1,18 @@ var ThreadForm = FormView.extend({ - + el: "#thread_form", - + events: { }, - + action: "/api/thread", method: "POST", - + initialize: function(){ this.__super__.initialize.call(this) this.template = this.$(".template").html() }, - + load: function(selected_keyword){ $.get("/api/keywords", function(data){ var tags = {} @@ -21,17 +21,19 @@ var ThreadForm = FormView.extend({ var opt = document.createElement('option') opt.value = kw opt.innerHTML = kw - if (selected_keyword === kw) { - opt.setAttribute("selected", "selected") - } tags[kw] = opt }) var sorted = Object.keys(tags).sort().map(kw => tags[kw]) this.$('[name=keyword]').append(sorted) + if (selected_keyword) { + this.$('[name=keyword]').val(selected_keyword) + } else { + this.$('[name=keyword]').val('unsorted') + } $("body").removeClass('loading') }.bind(this)) }, - + validate: function(){ var errors = [] var title = this.$("[name=title]").val() @@ -52,4 +54,4 @@ var ThreadForm = FormView.extend({ } window.location.href = "/details/" + data.id } -})
\ No newline at end of file +}) |
