summaryrefslogtreecommitdiff
path: root/public/assets
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets')
-rw-r--r--public/assets/js/lib/views/profile/profile.js42
-rw-r--r--public/assets/js/util/format.js2
2 files changed, 26 insertions, 18 deletions
diff --git a/public/assets/js/lib/views/profile/profile.js b/public/assets/js/lib/views/profile/profile.js
index 077db4e..2254bd5 100644
--- a/public/assets/js/lib/views/profile/profile.js
+++ b/public/assets/js/lib/views/profile/profile.js
@@ -1,20 +1,20 @@
var ProfileView = View.extend({
el: "#profile",
-
+
events: {
},
-
+
action: "/api/user/",
-
+
initialize: function(opt){
this.template = this.$(".template").html()
},
-
+
load: function(username){
$.get(this.action + username, this.populate.bind(this))
},
-
+
populate: function(user){
$("body").removeClass('loading')
var $table = this.$("table")
@@ -34,9 +34,9 @@ var ProfileView = View.extend({
].map(pair => {
var key = pair[0], label = pair[1]
if (! user[key]) return;
- return [key, sanitize(user[key])]
+ return [label, sanitize(user[key])]
})
-
+
if (user.email) {
fields.push([
'Email',
@@ -62,26 +62,34 @@ var ProfileView = View.extend({
}
}
if (user.website) {
- var websit = sanitize(user.website)
+ var website = sanitize(user.website)
fields.push([
'Website',
- '<a href="https://twitter.com/' + website + '">' + website + '</a>'
+ '<a href="' + sanitize(website) + '">' + sanitize(website) + '</a>'
])
}
-
- fields = [
+
+ fields = fields.concat([
["firstseen", "First Seen"],
["lastseen", "Last Seen"],
- ].split(" ").map((key) => {
+ ].map((pair) => {
var key = pair[0], label = pair[1]
if (! user[key]) return;
var date = verbose_date(user[key])
- return [key, date[0] + ' <small>' + date[1] + '</small>']
- }).concat(fields)
+ return [label, date[0] + ' <small>' + date[1] + '</small>']
+ }))
- var t = this.template.replace(/{{key}}/, "&nbsp;")
- .replace(/{{value}}/, '<a href="/mail/compose/' + username + '">send ' + username + ' a message</a>')
- $table.append(t)
+ fields.push([
+ '&nbsp;',
+ '<a href="/mail/compose/' + username + '">send ' + username + ' a message</a>'
+ ])
+
+ var rows = fields.filter(pair => !!pair).map(pair => {
+ var t = this.template.replace(/{{label}}/, pair[0])
+ .replace(/{{value}}/, pair[1])
+ return t
+ })
+ $table.append(rows.join(""))
},
})
diff --git a/public/assets/js/util/format.js b/public/assets/js/util/format.js
index 36a3d37..c765052 100644
--- a/public/assets/js/util/format.js
+++ b/public/assets/js/util/format.js
@@ -230,7 +230,7 @@ function make_link(file){
return file.filename
}
function profile_image(username){
- return "//s3.amazonaws.com/i.asdf.us/bucky/data/profile/" + username + ".jpg"
+ return "//s3.amazonaws.com/i.asdf.us/bucky/profile/" + username + ".jpg"
}
function make_thumb(file){
if (file.storage) {