From 985c7f54fa1dc854cfed09f404c79dd83bdf2636 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 14 May 2018 18:54:32 +0200 Subject: new views and such --- public/assets/js/lib/views/admin/adminz.js | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 public/assets/js/lib/views/admin/adminz.js (limited to 'public/assets/js/lib/views/admin/adminz.js') diff --git a/public/assets/js/lib/views/admin/adminz.js b/public/assets/js/lib/views/admin/adminz.js new file mode 100644 index 0000000..caed86d --- /dev/null +++ b/public/assets/js/lib/views/admin/adminz.js @@ -0,0 +1,39 @@ +var AdminView = View.extend({ + + events: { + }, + + action: "/api/admin", + + initialize: function(opt){ + // this.hootbox = new HootBox ({ parent: this }) + this.password = new ChangePasswordForm ({ parent: this }) + this.lastlog = new LastLog ({ parent: this }) + }, + + load: function(){ + $("body").addClass("index").addClass("admin") + $.get(this.action, this.populate.bind(this)) + }, + + populate: function(data){ + $("body").removeClass('loading') + console.log(data) + this.password.load(data.usernames) + this.lastlog.load(data.lastlog) + if (data.mail.count) { + $(".alert").show().html( + "" + + "You have " + + data.mail.count + + " new message" + + courtesy_s(data.mail.count) + + "!") + if (is_mobile) { + $("#content").prepend( $(".alert") ) + } + } + $(".search_form input").focus() + }, + +}) -- cgit v1.2.3-70-g09d2