summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/keywords/keywords.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-22 07:11:26 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-22 07:11:26 +0100
commitfa4ed0f3b1ce5decfc6ee59d38e63e78a7793de4 (patch)
tree74658c754cbdff432aa8dc8b4f3521c993993c45 /public/assets/js/lib/views/keywords/keywords.js
parent1a67f6f262364ee4fed0c1538ef2f41d772bf1b1 (diff)
new keyword form
Diffstat (limited to 'public/assets/js/lib/views/keywords/keywords.js')
-rw-r--r--public/assets/js/lib/views/keywords/keywords.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/public/assets/js/lib/views/keywords/keywords.js b/public/assets/js/lib/views/keywords/keywords.js
index 37fab16..9b2eadc 100644
--- a/public/assets/js/lib/views/keywords/keywords.js
+++ b/public/assets/js/lib/views/keywords/keywords.js
@@ -1,22 +1,23 @@
var KeywordsView = View.extend({
-
+
el: "#keyword_list",
-
+
events: {
},
-
+
action: "/api/keywords/statistics",
-
+
initialize: function(opt){
this.template = this.$(".template").html()
+ this.form = new NewKeywordForm ({ parent: this })
},
-
+
load: function(){
$.get(this.action, this.populate.bind(this))
},
-
+
populate: function(data){
- console.log(data)
+ // console.log(data)
var keywordThreads = {}
data.threadGroups.forEach(kw => {
keywordThreads[kw.keyword] = kw
@@ -29,16 +30,18 @@ var KeywordsView = View.extend({
var thread = keywordThreads[keyword.keyword.toLowerCase()] || {
title: '',
}
- // {
+ // {
// keyword: "warez",
// sum(`viewed`): "498",
// id: 701,
// title: "EMS SYNTHI PLUG FOR MAC",
// lastmodified: 1192401724
// },
- console.log(keyword, thread)
+ // console.log(keyword, thread)
var viewed = thread['sum(`viewed`)']
var views = viewed ? hush_views(viewed) : ['','']
+ var threadCountNum = thread['count(*)']
+ var threadCount = threadCountNum ? hush_threads(threadCountNum) : ['','']
var dot = privacy_dot(thread.privacy)
var datetime = verbose_date(keyword.createdate)
var age = get_age(thread.lastmodified)
@@ -53,6 +56,8 @@ var KeywordsView = View.extend({
.replace(/{{time}}/g, datetime[1])
.replace(/{{date_class}}/g, carbon_date(thread.lastmodified) )
.replace(/{{views}}/g, views[1])
+ .replace(/{{threadcount}}/, threadCount[1])
+ .replace(/{{threadcount_class}}/, threadCount[0])
// .replace(/{{comments}}/g, comments[1])
// .replace(/{{files}}/g, files[1])
// .replace(/{{size}}/g, size[1] )
@@ -68,4 +73,4 @@ var KeywordsView = View.extend({
$("body").removeClass('loading')
},
-}) \ No newline at end of file
+})