wip: UI refactoring

* Cleanup

see #204
This commit is contained in:
Antoine Nguyen
2012-04-22 10:58:44 +02:00
parent 89d946c8cf
commit 5f4b4dee5d
61 changed files with 30 additions and 25 deletions
+9 -5
View File
@@ -429,11 +429,12 @@ class IMAPconnector(object):
if len(topmailbox):
md_mailboxes = []
else:
md_mailboxes = [{"name" : "INBOX", "class" : "icon-home"},
md_mailboxes = [{"name" : "INBOX", "class" : "icon-inbox"},
{"name" : parameters.get_user(user, "DRAFTS_FOLDER"),
"class" : "icon-file"},
{"name" : 'Junk'},
{"name" : parameters.get_user(user, "SENT_FOLDER")},
{"name" : 'Junk', "class" : "icon-fire"},
{"name" : parameters.get_user(user, "SENT_FOLDER"),
"class" : "icon-envelope"},
{"name" : parameters.get_user(user, "TRASH_FOLDER"),
"class" : "icon-trash"}]
if until_mailbox:
@@ -600,9 +601,12 @@ class IMAPconnector(object):
if not r'\Seen' in data[int(uid)]['FLAGS']:
msg['style'] = 'unseen'
if r'\Answered' in data[int(uid)]['FLAGS']:
msg['img_flags'] = static_url('pics/answered.png')
msg['img_flags'] = [static_url('pics/answered.png')]
if r'$Forwarded' in data[int(uid)]['FLAGS']:
msg['img_flags'] = static_url('pics/forwarded.png')
if msg.has_key('img_flags'):
msg['img_flags'] += [static_url('pics/forwarded.png')]
else:
msg['img_flags'] = [static_url('pics/forwarded.png')]
bs = BodyStructure(data[int(uid)]['BODYSTRUCTURE'])
if bs.has_attachments():
msg['img_withatts'] = static_url('pics/attachment.png')
+1 -2
View File
@@ -28,7 +28,7 @@ class WMtable(tables.Table):
defvalue="%spics/grippy.png" % settings.MEDIA_URL,
header="<input type='checkbox' name='toggleselect' id='toggleselect' />"
)
flags = tables.ImgColumn("flags", width="2%")
flags = tables.ImgColumn("flags", width="4%")
withatts = tables.ImgColumn("withatts", width="2%")
subject = tables.Column("subject", label=__("Subject"), width="50%", limit=60)
from_ = tables.Column("from", width="20%", label=__("From"), limit=30)
@@ -427,7 +427,6 @@ def decode_payload(encoding, payload):
:param payload: the value to decode
:return: a string
"""
print payload
encoding = encoding.lower()
if encoding == "base64":
import base64
+8 -16
View File
@@ -1,3 +1,4 @@
# coding: utf-8
from django import template
from django.template.loader import render_to_string
from django.utils.translation import ugettext as _
@@ -20,33 +21,27 @@ def viewmail_menu(selection, folder, user, mail_id=None):
"label" : _("Back")},
{"name" : "reply",
"url" : "action=reply&mbox=%s&mailid=%s" % (folder, mail_id),
"img" : static_url("pics/reply.png"),
"img" : "icon-share",
"label" : _("Reply")},
{"name" : "replyall",
"url" : "action=reply&mbox=%s&mailid=%s&all=1" % (folder, mail_id),
"img" : static_url("pics/reply-all.png"),
"img" : "",
"label" : _("Reply all")},
{"name" : "forward",
"url" : "action=forward&mbox=%s&mailid=%s" % (folder, mail_id),
"img" : static_url("pics/alias.png"),
"img" : "icon-arrow-right",
"label" : _("Forward")},
{"name" : "delete",
"img" : static_url("pics/remove.png"),
"img" : "icon-trash",
"url" : reverse(webmail.views.delete) + "?mbox=%s&mailid=%s" % (folder, mail_id),
"label" : _("Delete")},
{"name" : "display_options",
"label" : _("Display options"),
"img" : static_url("pics/settings.png"),
"class" : "menubardropdown",
"menu" : [
{"name" : "activate_links",
"label" : _("Activate links"),
"url" : ""},
#reverse(webmail.views.viewmail, args=[folder, mail_id]) + "?links=1"},
"label" : _("Activate links")},
{"name" : "disable_links",
"label" : _("Disable links"),
"url" : ""}
#reverse(webmail.views.viewmail, args=[folder, mail_id]) + "?links=0"},
"label" : _("Disable links")}
]
}
]
@@ -80,7 +75,6 @@ def listmailbox_menu(selection, folder, user):
"label" : _("New message"),
"class" : "btn"},
{"name" : "mark",
"label" : _("Mark messages"),
"class" : "btn",
"menu" : [
@@ -93,14 +87,12 @@ def listmailbox_menu(selection, folder, user):
]
},
{"name" : "actions",
"img" : static_url("pics/settings.png"),
"label" : _("Actions"),
"class" : "btn",
"menu" : [
{"name" : "fdaction",
"label" : _("Compress folder"),
"img" : static_url("pics/compress.png"),
"url" : "compact/%s/" % folder},
"url" : "compact/%s/" % folder}
]
}
]
+2
View File
@@ -61,6 +61,8 @@ class ImgColumn(Column):
return ""
def render(self, value):
if type(value) in [list, tuple]:
return "".join(map(lambda i: "<img src='%s' />" % i, value))
return "<img src='%s' />" % value
class DivColumn(Column):
+9 -1
View File
@@ -9,7 +9,15 @@ var media_url = "";
* 'media_url' (corresponding to django's MEDIA_URL variable).
*/
function set_media_url(url) {
media_url = url;
media_url = url;
}
/*
* Shortcut function that construct an url from the media_url and the
* given value.
*/
function static_url(value) {
return media_url + value;
}
function modalbox(e, css, defhref, defcb, defclosecb) {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 B

+1 -1
View File
@@ -1,7 +1,7 @@
{% load libextras %}
<div class="btn-toolbar {{ extraclasses }}">{% for entry in entries %}
<div class="btn-group">{% if entry.menu %}
<a class="btn dropdown-toggle" data-toggle="dropdown">{{ entry.label }}<span class="caret"></span></a>
<a class="btn dropdown-toggle" data-toggle="dropdown">{% if entry.img %}<i class="{{ entry.img}}"></i>{% endif %}{{ entry.label }}<span class="caret"></span></a>
<ul class="dropdown-menu">{% for sentry in entry.menu %}
<li>{% render_link sentry %}</li>
{% endfor %}</ul>