keeweb/app/scripts/views/list-wrap-view.js

27 lines
577 B
JavaScript
Raw Normal View History

2019-09-15 23:08:36 +02:00
import { View } from 'view-engine/view';
2015-11-21 15:55:42 +01:00
2019-09-15 23:08:36 +02:00
class ListWrapView extends View {
parent = '.app__list-wrap';
2015-11-21 15:55:42 +01:00
2019-09-16 17:58:44 +02:00
template = () => '';
2019-09-15 23:08:36 +02:00
events = {};
2019-09-16 17:58:44 +02:00
constructor(model, options) {
super(model, options);
2015-11-21 15:55:42 +01:00
this.listenTo(this.model.settings, 'change:tableView', this.setListLayout);
2019-09-15 23:08:36 +02:00
}
2015-11-21 15:55:42 +01:00
2019-08-18 10:17:09 +02:00
render() {
2019-09-16 17:58:44 +02:00
super.render();
2015-11-21 15:55:42 +01:00
this.setListLayout();
2019-09-15 23:08:36 +02:00
}
2015-11-21 15:55:42 +01:00
2019-08-18 10:17:09 +02:00
setListLayout() {
2019-09-15 23:08:36 +02:00
const tableView = !!this.model.settings.get('tableView');
this.el.classList.toggle('app__list-wrap--table', tableView);
2015-11-21 15:55:42 +01:00
}
2019-09-15 23:08:36 +02:00
}
2015-11-21 15:55:42 +01:00
2019-09-15 14:16:32 +02:00
export { ListWrapView };