From 260dbf9b58bee20ec163f7431bd076a50aa616cb Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Fri, 20 Apr 2012 12:13:59 +0200 Subject: [PATCH] wip: global UI refactoring Code cleanup. see #204 --- static/js/domains.js | 79 --------------------- static/js/email_listing.js | 31 --------- templates/common/email_listing.html | 76 --------------------- templates/common/viewmail.html | 9 ++- templates/registration/login.html | 102 ++++++++++++++-------------- 5 files changed, 55 insertions(+), 242 deletions(-) delete mode 100644 static/js/domains.js delete mode 100644 static/js/email_listing.js delete mode 100644 templates/common/email_listing.html diff --git a/static/js/domains.js b/static/js/domains.js deleted file mode 100644 index c0bf6ff6c..000000000 --- a/static/js/domains.js +++ /dev/null @@ -1,79 +0,0 @@ -(function($) { - var objtable = null; - - function new_clickcb(evt) { - var type = $("objects").get("name"); - var sizes = $("objects").get("rel").split(" "); - - evt.stop(); - SqueezeBox.open(this.rooturl + type + "/new/", { - size: {x: parseInt(sizes[0]), y: parseInt(sizes[1])}, - handler: 'iframe' - }); - }; - - function remove_clickcb(evt) { - evt.stop(); - if (this.objtable._selectedRows.length == 0) { - return; - } - var type = $("objects").get("name"); - var selection = ""; - - this.objtable._selectedRows.each(function(item) { - var options = JSON.decode(item.get("rel")); - - if (options != undefined && options.ui_disabled != undefined && - options.ui_disabled == "True") { - return; - } - if (selection != "") { - selection += ","; - } - selection += item.get("id"); - }); - if (selection == "") { - return; - } - new Confirmation( - this.rooturl + type + "/delete/", - "selection=" + selection, - gettext('Remove this selection?'), { - checkboxes: this.deloptions - } - ); - }; - - var methods = { - init: function(rooturl, deloptions) { - this.rooturl = rooturl; - if (deloptions != undefined) { - this.deloptions = deloptions; - } else { - this.deloptions = new Array(); - } - if ($("subcontent") != undefined) { - SqueezeBox.assign($("subcontent").getElements('a[class=boxed]'), { - parse: 'rel' - }); - } - setDivHeight("content", 20, 0); - this.objtable = new HtmlTable($("objects_table"), { - selectable: true - }); - - $$("a[name=new]").addEvent("click", new_clickcb); - $$("a[name=remove]").addEvent("click", remove_clickcb); - } - }; - - $.fn.Domains = function(method) { - if (methods[method]) { - return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); - } else if (typeof method === 'object' || !method) { - return methods.init.apply(this, arguments); - } else { - $.error(gettext('Unknown method: ') + method); - } - }; -})(jQuery); diff --git a/static/js/email_listing.js b/static/js/email_listing.js deleted file mode 100644 index 74bc06cd3..000000000 --- a/static/js/email_listing.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Shared functions between the webmail and the quarantine plugin. - * - */ - -function navbarcallback(event) { - event.stop(); - current_anchor.reset() - .setparams(navparams) - .updateparams(this.get("href")) - .update(); -} - -function updatelisting(resp) { - if (resp.url != undefined) { - history.baseurl(resp.url).update(); - return; - } - /*if (resp.menu != undefined) { - $("menubar").set("html", resp.menu); - parse_menubar("menubar"); - }*/ - if (resp.listing != undefined) { - $("#listing").html(resp.listing); - } - /*if ($defined(resp.navbar)) { - $("navbar").set("html", resp.navbar); - $$("#navbar a").addEvent("click", navbarcallback); - }*/ -} - diff --git a/templates/common/email_listing.html b/templates/common/email_listing.html deleted file mode 100644 index bdc66cc5b..000000000 --- a/templates/common/email_listing.html +++ /dev/null @@ -1,76 +0,0 @@ -{% extends "nlayout.html" %} -{% load i18n %} -{% load libextras %} -{% block html_head %} - - - - -{% block css %}{% endblock %} - -{% endblock %} -{% block content %} -{% block leftcol %}{% endblock %} -
{{ listing }}
-
-{% endblock %} -{% block footer %} - -{% endblock %} - diff --git a/templates/common/viewmail.html b/templates/common/viewmail.html index ae07d0593..438f6d069 100644 --- a/templates/common/viewmail.html +++ b/templates/common/viewmail.html @@ -1,8 +1,7 @@ - - - - + + + + diff --git a/templates/registration/login.html b/templates/registration/login.html index cdcf3c7a3..08d573c00 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -1,54 +1,54 @@ - -{% load i18n libextras %} - - - {% trans "Welcome to Modoboa" %} - - - - - - - {% url django.views.i18n.javascript_catalog as catalog_url %} - - - - -
-
-
- - - - + + +