diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-15 02:43:51 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-15 02:43:51 +0100 |
| commit | 1466563673ffe6c41ec9a18bf98565b8562ee4f3 (patch) | |
| tree | 1eb576380877d3231910ccbb634f33906210ab3f /public/assets/js/lib/views/details | |
| parent | 0541e7d7457d646dceca375b7fa6e1f382232772 (diff) | |
thread_users hackery
Diffstat (limited to 'public/assets/js/lib/views/details')
| -rw-r--r-- | public/assets/js/lib/views/details/settings.js | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/public/assets/js/lib/views/details/settings.js b/public/assets/js/lib/views/details/settings.js index b702908..1124826 100644 --- a/public/assets/js/lib/views/details/settings.js +++ b/public/assets/js/lib/views/details/settings.js @@ -16,6 +16,7 @@ var ThreadSettingsForm = FormView.extend({ initialize: function(){ this.__super__.initialize.call(this) this.template = this.$(".template").html() + this.allowedTemplate = this.$(".allowedTemplate").html() }, populate: function(){ @@ -47,6 +48,13 @@ var ThreadSettingsForm = FormView.extend({ }) $color.val(thread.color || keyword ? keyword.color : "") + this.fetchKeywords() +// this.fetchAllowedUsers(thread) + + $("body").removeClass("loading") + }, + + fetchKeywords: function(){ $.get('/api/keywords', function(data){ var $keyword = this.$('[name=keyword]') data.keywords @@ -60,10 +68,31 @@ var ThreadSettingsForm = FormView.extend({ }) $keyword.val(thread.keyword) }.bind(this)) - - $("body").removeClass("loading") }, +// fetchAllowedUsers: function(thread){ +// var usernameRegexp = new RegExp('{{username}}', g) +// $.get('/api/thread/' + thread.id + '/interested', function(data){ +// var $allowed = this.$(".allowed") +// var tmpl = this.allowedTemplate +// // make a lookup of existing users +// var allowed = {} +// thread.allowed.split(" ").forEach((username) => { +// +// }) +// // build the ui +// data.interestedUsers +// .map( (a) => a.username) +// .sort( (a,b) => a < b ? -1 : a === b ? 0 : 1 ) +// .forEach((username) => { +// var t = tmpl.replace(usernameRegexp, "") +// .replace('{{checked}}', +// $keyword.append(option) +// }) +// $keyword.val(thread.keyword) +// }.bind(this)) +// }, + validate: function(){ var errors = [] var title = $("[name=title]").val() |
