Skip to content
Snippets Groups Projects
Commit b4f76225 authored by Hermann's avatar Hermann
Browse files

add forward-to emails

parent 66589f70
No related branches found
No related tags found
No related merge requests found
...@@ -129,9 +129,9 @@ class EmailTable { ...@@ -129,9 +129,9 @@ class EmailTable {
]); ]);
} }
view({ attrs: { list, onSubmit = () => {} } }) { view({ attrs: { list, title, style = {}, onSubmit = () => {} } }) {
return m(Card, { return m(Card, {
style: { height: '200px' }, style: { height: '200px', ...style },
content: m('div', [ content: m('div', [
this.addmode ? m(Toolbar, { this.addmode ? m(Toolbar, {
compact: true, compact: true,
...@@ -163,7 +163,7 @@ class EmailTable { ...@@ -163,7 +163,7 @@ class EmailTable {
}), }),
]) : '', ]) : '',
m(Toolbar, { compact: true }, [ m(Toolbar, { compact: true }, [
m(ToolbarTitle, { text: 'Receiving Email Adresses' }), m(ToolbarTitle, { text: title }),
m(Button, { m(Button, {
className: 'blue-button', className: 'blue-button',
borders: true, borders: true,
...@@ -214,6 +214,7 @@ export default class viewGroup extends ItemView { ...@@ -214,6 +214,7 @@ export default class viewGroup extends ItemView {
m('div.viewcontainercolumn', [ m('div.viewcontainercolumn', [
m(EmailTable, { m(EmailTable, {
list: this.data.receive_from || [], list: this.data.receive_from || [],
title: 'Receiving Email Adresses',
onSubmit: (newItem) => { onSubmit: (newItem) => {
const oldList = this.data.receive_from || []; const oldList = this.data.receive_from || [];
this.controller.patch({ this.controller.patch({
...@@ -236,6 +237,32 @@ export default class viewGroup extends ItemView { ...@@ -236,6 +237,32 @@ export default class viewGroup extends ItemView {
} }
}, },
}), }),
m(EmailTable, {
list: this.data.forward_to || [],
title: 'Forwards to Email Adresses',
style: { 'margin-top': '10px' },
onSubmit: (newItem) => {
const oldList = this.data.forward_to || [];
this.controller.patch({
_id: this.data._id,
_etag: this.data._etag,
forward_to: [...oldList, newItem],
});
},
onRemove: (item) => {
const oldList = this.data.forward_to;
// remove the first occurence of the given item-string
const index = oldList.indexOf(item);
if (index !== -1) {
oldList.splice(index, 1);
this.controller.patch({
_id: this.data._id,
_etag: this.data._etag,
forward_to: oldList,
});
}
},
}),
]), ]),
]), ]),
]); ]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment