summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-14 20:20:56 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-14 20:20:56 +0100
commit245ce015f565da0626c70340d6e1710056245c52 (patch)
tree124d8fb0921d29407264c367320fcd4bb00e9978 /public/assets/js/lib/views
parent3a42fe7ad797a6f9cf747d2d358015ac992765a7 (diff)
css
Diffstat (limited to 'public/assets/js/lib/views')
-rw-r--r--public/assets/js/lib/views/index/index.js1
-rw-r--r--public/assets/js/lib/views/login/login.js1
-rw-r--r--public/assets/js/lib/views/login/signup.js1
-rw-r--r--public/assets/js/lib/views/profile/profile.js57
4 files changed, 51 insertions, 9 deletions
diff --git a/public/assets/js/lib/views/index/index.js b/public/assets/js/lib/views/index/index.js
index 4e1a801..fdc7a29 100644
--- a/public/assets/js/lib/views/index/index.js
+++ b/public/assets/js/lib/views/index/index.js
@@ -25,6 +25,7 @@ var IndexView = View.extend({
this.threadbox.options.latest = true
this.threadbox.options.welcome = true
$.get(this.action, this.populate.bind(this))
+ $("body").addClass("index")
}
},
diff --git a/public/assets/js/lib/views/login/login.js b/public/assets/js/lib/views/login/login.js
index 0144006..6e810d6 100644
--- a/public/assets/js/lib/views/login/login.js
+++ b/public/assets/js/lib/views/login/login.js
@@ -8,6 +8,7 @@ var LoginView = FormView.extend({
this.__super__.initialize.call(this)
$("body").removeClass("loading")
this.$("[name=username]").focus()
+ $("body").addClass("login")
},
showErrors: function(err){
diff --git a/public/assets/js/lib/views/login/signup.js b/public/assets/js/lib/views/login/signup.js
index d3d407d..f37696f 100644
--- a/public/assets/js/lib/views/login/signup.js
+++ b/public/assets/js/lib/views/login/signup.js
@@ -8,6 +8,7 @@ var SignupView = FormView.extend({
this.__super__.initialize.call(this)
$("body").removeClass("loading")
this.$("[name=username]").focus()
+ $("body").addClass("signup")
},
validate: function(){
diff --git a/public/assets/js/lib/views/profile/profile.js b/public/assets/js/lib/views/profile/profile.js
index 1b3e496..077db4e 100644
--- a/public/assets/js/lib/views/profile/profile.js
+++ b/public/assets/js/lib/views/profile/profile.js
@@ -26,19 +26,58 @@ var ProfileView = View.extend({
$(".edit_profile").hide()
}
this.$("img").attr("src", profile_image(username))
- var fields = "username realname phone location".split(" ").map((key) => {
+ var fields = [
+ ["username", "Username"],
+ ["realname", "Real Name"],
+ ["location", "Location"],
+ ["phone", "Phone"],
+ ].map(pair => {
+ var key = pair[0], label = pair[1]
if (! user[key]) return;
- var t = this.template.replace(/{{key}}/, sanitize(key))
- .replace(/{{value}}/, sanitize(user[key]))
- $table.append(t)
+ return [key, sanitize(user[key])]
})
- var fields = "firstseen lastseen".split(" ").map((key) => {
+
+ if (user.email) {
+ fields.push([
+ 'Email',
+ '<a href="mailto:' + sanitize(user.email) + '">' + sanitize(user.email) + '</a>'
+ ])
+ }
+ if (user.twitter) {
+ if (user.twitter.match(/^http/)) {
+ var partz = user.twitter.split('/')
+ if (partz.length > 2) {
+ var handle = sanitize(partz[3])
+ fields.push([
+ 'Twitter',
+ '<a href="https://twitter.com/' + handle + '">@' + handle + '</a>'
+ ])
+ }
+ } else {
+ var handle = sanitize(user.twitter)
+ fields.push([
+ 'Twitter',
+ '<a href="https://twitter.com/' + handle + '">@' + handle + '</a>'
+ ])
+ }
+ }
+ if (user.website) {
+ var websit = sanitize(user.website)
+ fields.push([
+ 'Website',
+ '<a href="https://twitter.com/' + website + '">' + website + '</a>'
+ ])
+ }
+
+ fields = [
+ ["firstseen", "First Seen"],
+ ["lastseen", "Last Seen"],
+ ].split(" ").map((key) => {
+ var key = pair[0], label = pair[1]
if (! user[key]) return;
var date = verbose_date(user[key])
- var t = this.template.replace(/{{key}}/, sanitize(key))
- .replace(/{{value}}/, date[0] + ' <small>' + date[1] + '</small>')
- $table.append(t)
- })
+ return [key, date[0] + ' <small>' + date[1] + '</small>']
+ }).concat(fields)
var t = this.template.replace(/{{key}}/, "&nbsp;")
.replace(/{{value}}/, '<a href="/mail/compose/' + username + '">send ' + username + ' a message</a>')