added tags

This commit is contained in:
Sukhamjot Singh 2022-03-22 00:43:23 +05:30
parent 98f873aa84
commit 3dcf310a54
9 changed files with 175 additions and 3 deletions

View File

@ -0,0 +1,27 @@
const m = require('mithril');
const util = require('mail/mail_util');
const Layout = () => {
return {
view: (v) => [
m('.widget', [
m('h3', 'Important'),
m('hr'),
m(
util.Table,
m(
'tbody',
v.attrs.list.map((msg) =>
m(util.MessageSummary, {
details: msg,
category: 'important',
})
)
)
),
]),
],
};
};
module.exports = Layout;

View File

@ -0,0 +1,27 @@
const m = require('mithril');
const util = require('mail/mail_util');
const Layout = () => {
return {
view: (v) => [
m('.widget', [
m('h3', 'Later'),
m('hr'),
m(
util.Table,
m(
'tbody',
v.attrs.list.map((msg) =>
m(util.MessageSummary, {
details: msg,
category: 'later',
})
)
)
),
]),
],
};
};
module.exports = Layout;

View File

@ -0,0 +1,27 @@
const m = require('mithril');
const util = require('mail/mail_util');
const Layout = () => {
return {
view: (v) => [
m('.widget', [
m('h3', 'Personal'),
m('hr'),
m(
util.Table,
m(
'tbody',
v.attrs.list.map((msg) =>
m(util.MessageSummary, {
details: msg,
category: 'personal',
})
)
)
),
]),
],
};
};
module.exports = Layout;

View File

@ -14,6 +14,11 @@ const Messages = {
starred: [],
system: [],
spam: [],
important: [],
work: [],
personal: [],
todo: [],
later: [],
load() {
rs.rsJsonApiRequest('/rsMsgs/getMessageSummaries', {}, (data) => {
Messages.all = data.msgList;
@ -41,6 +46,21 @@ const Messages = {
Messages.spam = Messages.all.filter(
(msg) => (msg.msgflags & util.RS_MSG_SPAM)
);
Messages.important = Messages.all.filter(
(msg) => (msg.msgflags & util.RS_MSGTAGTYPE_IMPORTANT)
);
Messages.work = Messages.all.filter(
(msg) => (msg.msgflags & util.RS_MSGTAGTYPE_WORK)
);
Messages.personal = Messages.all.filter(
(msg) => (msg.msgflags & util.RS_MSGTAGTYPE_PERSONAL)
);
Messages.todo = Messages.all.filter(
(msg) => (msg.msgflags & util.RS_MSGTAGTYPE_TODO)
);
Messages.later = Messages.all.filter(
(msg) => (msg.msgflags & util.RS_MSGTAGTYPE_LATER)
);
});
},
};
@ -56,6 +76,12 @@ const sectionsquickview = {
starred: require('mail/mail_starred'),
system: require('mail/mail_system'),
spam: require('mail/mail_spam'),
important: require('mail/mail_important'),
work: require('mail/mail_work'),
todo: require('mail/mail_todo'),
later: require('mail/mail_later'),
personal: require('mail/mail_personal'),
};
const tagselect = {
showval: 'Tags',
@ -82,7 +108,6 @@ const Layout = {
tabs: Object.keys(sections),
baseRoute: '/mail/',
}),
m('h3', 'quick view'),
m(widget.SidebarQuickView, {
tabs: Object.keys(sectionsquickview),
baseRoute: '/mail/',

View File

@ -0,0 +1,27 @@
const m = require('mithril');
const util = require('mail/mail_util');
const Layout = () => {
return {
view: (v) => [
m('.widget', [
m('h3', 'Todo'),
m('hr'),
m(
util.Table,
m(
'tbody',
v.attrs.list.map((msg) =>
m(util.MessageSummary, {
details: msg,
category: 'todo',
})
)
)
),
]),
],
};
};
module.exports = Layout;

View File

@ -12,6 +12,12 @@ const RS_MSG_NEW = 0x10;
const RS_MSG_UNREAD_BY_USER = 0x40;
const RS_MSG_STAR = 0x200;
const RS_MSG_SPAM = 0x040000;
const RS_MSGTAGTYPE_IMPORTANT = 1;
const RS_MSGTAGTYPE_WORK = 2;
const RS_MSGTAGTYPE_PERSONAL = 3;
const RS_MSGTAGTYPE_TODO = 4;
const RS_MSGTAGTYPE_LATER = 5;
const RS_MSG_USER_REQUEST = 0x000400;
const RS_MSG_FRIEND_RECOMMENDATION = 0x000800;
const RS_MSG_PUBLISH_KEY = 0x020000;
@ -222,5 +228,10 @@ module.exports = {
RS_MSG_STAR,
RS_MSG_TRASH,
RS_MSG_SYSTEM,
RS_MSG_SPAM
RS_MSG_SPAM,
RS_MSGTAGTYPE_IMPORTANT,
RS_MSGTAGTYPE_LATER,
RS_MSGTAGTYPE_PERSONAL,
RS_MSGTAGTYPE_TODO,
RS_MSGTAGTYPE_WORK
};

View File

@ -0,0 +1,27 @@
const m = require('mithril');
const util = require('mail/mail_util');
const Layout = () => {
return {
view: (v) => [
m('.widget', [
m('h3', 'Work'),
m('hr'),
m(
util.Table,
m(
'tbody',
v.attrs.list.map((msg) =>
m(util.MessageSummary, {
details: msg,
category: 'work',
})
)
)
),
]),
],
};
};
module.exports = Layout;

View File

@ -444,7 +444,7 @@ a.tab-menu-item {
/* Content adjacent to sidebar */
.node-panel {
position: relative;
bottom: 140px;
bottom: 400px;
margin-left: 200px;
animation: fadein 0.5s;
}

View File

@ -25,6 +25,7 @@ const SidebarQuickView = () => {
view: (v) =>
m(
'.sidebarquickview',
m('h4', 'Quick View'),
v.attrs.tabs.map((panelName, index) =>
m(
m.route.Link,