From e3c370a28f3ec8a2802a5098ed0cbb777292eba9 Mon Sep 17 00:00:00 2001 From: rafael lisboa Date: Fri, 20 Feb 2015 19:22:18 -0200 Subject: Add pencil icon to drafts --- web-ui/app/js/mail_list/ui/mail_item_factory.js | 21 +++------------- web-ui/app/js/views/templates.js | 1 + web-ui/app/templates/mails/draft.hbs | 32 +++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 web-ui/app/templates/mails/draft.hbs diff --git a/web-ui/app/js/mail_list/ui/mail_item_factory.js b/web-ui/app/js/mail_list/ui/mail_item_factory.js index 88638c9d..87a883b0 100644 --- a/web-ui/app/js/mail_list/ui/mail_item_factory.js +++ b/web-ui/app/js/mail_list/ui/mail_item_factory.js @@ -30,7 +30,7 @@ define( }; var TEMPLATE_TYPE = { - 'drafts': 'sent', + 'drafts': 'draft', 'sent': 'sent' }; @@ -38,32 +38,17 @@ define( var mailItemContainer = $('
  • ', { id: 'mail-' + mail.ident}); nodeToAttachTo.append(mailItemContainer); - var mailToCreate; - if(currentTag === 'all'){ - mailToCreate = detectMailType(mail); - } else { - mailToCreate = MAIL_ITEM_TYPE[currentTag] || GenericMailItem; - } + var mailToCreate = MAIL_ITEM_TYPE[mail.mailbox] || GenericMailItem; mailToCreate.attachTo(mailItemContainer, { mail: mail, selected: mail.ident === currentMailIdent, tag: currentTag, isChecked: isChecked, - templateType: TEMPLATE_TYPE[currentTag] || 'single' + templateType: TEMPLATE_TYPE[mail.mailbox] || 'single' }); }; - var detectMailType = function(mail) { - if (mail.isDraftMail()) { - return MAIL_ITEM_TYPE.drafts; - } else if (mail.isSentMail()) { - return MAIL_ITEM_TYPE.sent; - } else { - return GenericMailItem; - } - }; - return { createAndAttach: createAndAttach }; diff --git a/web-ui/app/js/views/templates.js b/web-ui/app/js/views/templates.js index 874e691d..470c6e51 100644 --- a/web-ui/app/js/views/templates.js +++ b/web-ui/app/js/views/templates.js @@ -40,6 +40,7 @@ define(['hbs/templates'], function (templates) { single: window.Pixelated['app/templates/mails/single.hbs'], fullView: window.Pixelated['app/templates/mails/full_view.hbs'], mailActions: window.Pixelated['app/templates/mails/mail_actions.hbs'], + draft: window.Pixelated['app/templates/mails/draft.hbs'], sent: window.Pixelated['app/templates/mails/sent.hbs'] }, mailActions: { diff --git a/web-ui/app/templates/mails/draft.hbs b/web-ui/app/templates/mails/draft.hbs new file mode 100644 index 00000000..87862f34 --- /dev/null +++ b/web-ui/app/templates/mails/draft.hbs @@ -0,0 +1,32 @@ + + + + + + {{ header.formattedDate }} + +
    + {{t 'to:'}} + {{#if header.to }} + {{ header.to }} + {{else}} + {{t 'no_recipient'}} + {{/if}} +
    +
    + + {{#if header.subject }} + {{header.subject}} + {{else}} + {{t 'no_subject'}} + {{/if}} +
    +
    +
      + {{#each tagsForListView }} +
    • {{ this }}
    • + {{/each }} +
    +
    +
    +
    -- cgit v1.2.3