From cbc599e721035dbec1a10b0230b3068c8bdf4d95 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Thu, 15 Sep 2011 10:12:05 +0200 Subject: [PATCH] Some GUI improvments: * Better layout for the editor used to compose messages, * Attachments form cleanup see #54 & #38 --- extensions/webmail/lib.py | 4 ++- extensions/webmail/static/css/attachments.css | 4 +++ extensions/webmail/static/css/webmail.css | 32 ++++++++++--------- extensions/webmail/static/js/webmail.js | 9 +++--- .../webmail/templates/webmail/compose.html | 2 ++ static/css/box.css | 28 +++++++++++++++- 6 files changed, 58 insertions(+), 21 deletions(-) diff --git a/extensions/webmail/lib.py b/extensions/webmail/lib.py index 9ffd8e63b..726ac723d 100644 --- a/extensions/webmail/lib.py +++ b/extensions/webmail/lib.py @@ -556,9 +556,11 @@ class EmailSignature(object): :param user: User object """ def __init__(self, user): + self._sig = "" dformat = parameters.get_user(user, "EDITOR") content = parameters.get_user(user, "SIGNATURE") - getattr(self, "_format_sig_%s" % dformat)(content) + if len(content): + getattr(self, "_format_sig_%s" % dformat)(content) def _format_sig_plain(self, content): self._sig = """ diff --git a/extensions/webmail/static/css/attachments.css b/extensions/webmail/static/css/attachments.css index 7d65dcb76..f08061b64 100644 --- a/extensions/webmail/static/css/attachments.css +++ b/extensions/webmail/static/css/attachments.css @@ -33,4 +33,8 @@ img { div.row label { width: 150px; +} + +#id_attachment { + width: 290px; } \ No newline at end of file diff --git a/extensions/webmail/static/css/webmail.css b/extensions/webmail/static/css/webmail.css index b27847859..450941351 100644 --- a/extensions/webmail/static/css/webmail.css +++ b/extensions/webmail/static/css/webmail.css @@ -89,8 +89,6 @@ ul.visible { /* Compose mail page */ #compose-container { - /*margin: 0 auto;*/ - /*width: 100%;*/ position: absolute; left: 0px; right: 10px; @@ -102,9 +100,10 @@ ul.visible { position: relative; border: 1px solid #cccccc; background-color: #eee; - margin-bottom: 5px; + margin: 10px 0 5px 0; padding: 5px 0; cursor: pointer; + width: 100%; } #attachments img { @@ -125,7 +124,6 @@ ul.visible { div.row { width: 100%; - height: 40px; margin: 5px 0; } @@ -136,9 +134,8 @@ div.row label { } div.input_container { - position: absolute; - left: 130px; - right: 0; + position: static; + margin-left: 130px; } textarea { @@ -147,26 +144,31 @@ textarea { width: 100%; height: 40px; word-wrap: break-word; + resize: none; + padding: 2px 0; } textarea:hover { background-color: #ffffcc; } +#body_container { + position: absolute; + top: 205px; + left: 0; + right: 0px; + bottom: 15px; +} + #id_body { background: white; - /*width: 98%;*/ - position: absolute; - left: 0; - right: 10px; + width: 100%; + height: 100%; } #mailheader input { width: 100%; - padding: 0; - height: 20px; - clear: both; - + padding: 2px 0; } #mailheader { diff --git a/extensions/webmail/static/js/webmail.js b/extensions/webmail/static/js/webmail.js index 8f2c11e03..c75ee04e0 100644 --- a/extensions/webmail/static/js/webmail.js +++ b/extensions/webmail/static/js/webmail.js @@ -83,7 +83,7 @@ function compose_loader(event) { } function resize_window_callback(event) { - setDivHeight("id_body", $("mailheader").getSize().y, 0); + CKEDITOR.instances["id_body"].resize("100%", $("body_container").getSize().y); } /* @@ -125,7 +125,6 @@ function compose_callback(resp) { wm_updatelisting(resp); window.addEvent("resize", resize_window_callback); - window.fireEvent("resize"); var editormode = resp.editor; var editorid = "id_body"; @@ -136,8 +135,10 @@ function compose_callback(resp) { CKEDITOR.remove(instance); } CKEDITOR.replace(editorid, { - customConfig: static_url("js/editor_config.js"), - height: $(editorid).getSize().y + customConfig: static_url("js/editor_config.js") + }); + CKEDITOR.on("instanceReady", function(evt) { + resize_window_callback(); }); } if (resp.id) { diff --git a/extensions/webmail/templates/webmail/compose.html b/extensions/webmail/templates/webmail/compose.html index 8b4310d29..43bfd0753 100644 --- a/extensions/webmail/templates/webmail/compose.html +++ b/extensions/webmail/templates/webmail/compose.html @@ -15,6 +15,7 @@
+
{% if body %} {% endif %} +
diff --git a/static/css/box.css b/static/css/box.css index 2cd66ece8..6cc8a0042 100644 --- a/static/css/box.css +++ b/static/css/box.css @@ -136,4 +136,30 @@ td.even { .spacer { clear: both; -} \ No newline at end of file +} + +/* + * clearfix related + */ +.clearfix:after { + content: "."; + display: block; + clear: both; + visibility: hidden; + overflow: hidden; + line-height: 0; + height: 0; +} + +.clearfix { + display: inline-block; +} + +html[xmlns] .clearfix { + display: block; +} + +* html .clearfix { + height: 1%; + overflow: visible; +}