import './style.scss';

export default new Class({
	Extends: Hedera.Form,
	Template: require('./ui.xml'),

	activate() {
		this.$.newsModel.setInfo('n', 'news', 'hedera', ['id'], 'id');
	},
	
	onAddClick() {
		this.hash.setAll({
			form: 'news/new',
			new: null
		});
	},

	onEditClick(newId) {
		this.hash.setAll({
			form: 'news/new',
			new: newId
		});
	},

	async onDeleteClick(form) {
		if (confirm(_('ReallyDelete')))
			await form.deleteRow();
	}
});

