Added mailcompose, tags, search

This commit is contained in:
Sukhamjot Singh 2022-02-04 21:51:07 +05:30
parent 68b3a8802d
commit 321cc7d660
4 changed files with 67 additions and 2 deletions

View File

@ -57,3 +57,21 @@ iframe.msg {
width: 100%;
height: 450px;
}
#composebtn{
text-align: center;
width: 200px;
height: 50px;
/* float: left; */
}
#searchmail{
float: right;
position: relative;
margin-right: 20px;
}
#tags{
width: 200px;
text-align: center;
font-size: medium;
margin-left: 20px;
height: 40px;
}

View File

@ -0,0 +1,11 @@
const m = require('mithril');
const Layout = () => {
return{
view: () => [
m('h2', 'Compose a mail')
]
};
};
module.exports = Layout();

View File

@ -2,6 +2,7 @@ const m = require('mithril');
const rs = require('rswebui');
const util = require('mail/mail_util');
const widget = require('widgets');
const compose = require('mail/mail_compose')
const Messages = {
all: [],
@ -34,11 +35,27 @@ const sections = {
drafts: require('mail/mail_draftbox'),
sent: require('mail/mail_sentbox'),
};
const tagselect = {
showval: 'Tags',
opts: ['Tags','Important', 'Work', 'Personal']
}
const Layout = {
oninit: Messages.load,
view: (vnode) =>
m('.tab-page', [
m("button[id=composebtn]", { onclick: () => { widget.popupMessage(m(compose)); } }, "Compose"),
m('select[id=tags]', {
value: tagselect.showval,
onchange: e => {
tagselect.showval = tagselect.opts[e.target.selectedIndex]
}
}, [
tagselect.opts.map(o => m('option', { value: o }, o.toLocaleString()))
]),
m(util.SearchBar, {
list: Object.assign({}, {}, {}),
}),
m(widget.Sidebar, {
tabs: Object.keys(sections),
baseRoute: '/mail/',

View File

@ -155,11 +155,30 @@ const Table = () => {
]),
};
};
const SearchBar = () => {
let searchString = '';
return {
view: (v) =>
m('input[type=text][id=searchmail][placeholder=Search Subject].searchbar', {
value: searchString,
oninput: (e) => {
searchString = e.target.value.toLowerCase();
for (const hash in v.attrs.list) {
if (v.attrs.list[hash].fname.toLowerCase().indexOf(searchString) > -1) {
v.attrs.list[hash].isSearched = true;
} else {
v.attrs.list[hash].isSearched = false;
}
}
},
}),
};
};
module.exports = {
MessageSummary,
MessageView,
Table,
SearchBar,
RS_MSG_BOXMASK,
RS_MSG_INBOX,
RS_MSG_SENTBOX,