peertube-plugin-livechat/conversejs/custom/plugins/tasks/templates/muc-task-list.js

61 lines
2.0 KiB
JavaScript
Raw Normal View History

2024-04-30 15:11:10 +00:00
import { html } from 'lit'
2024-04-30 16:30:44 +00:00
import { repeat } from 'lit/directives/repeat.js'
2024-05-05 22:13:20 +00:00
import { __ } from 'i18n'
2024-04-30 15:11:10 +00:00
2024-05-05 22:13:20 +00:00
export default function tplMucTaskList (el, tasklist) {
2024-04-30 16:30:44 +00:00
const tasks = tasklist.getTasks()
2024-05-05 22:13:20 +00:00
// eslint-disable-next-line no-undef
const i18nDelete = __(LOC_task_list_delete)
2024-04-30 16:30:44 +00:00
return html`
<div class="task-list-description">
${el.collapsed
? html`
<button @click=${el.toggleTasks}>
<converse-icon
color="var(--muc-toolbar-btn-color)"
class="fa fa-angle-double-up"
size="1em"></converse-icon>
</button>`
: html`
<button @click=${el.toggleTasks}>
<converse-icon
color="var(--muc-toolbar-btn-color)"
class="fa fa-angle-double-down"
size="1em"></converse-icon>
</button>`
}
${!el.edit
? html`
<div class="task-list-name">
${tasklist.get('name')}
</div>
<a title="${__('Edit')}"
@click=${el.toggleEdit}
>
<converse-icon class="fa fa-edit" size="1em"></converse-icon>
</a>
<a title="${i18nDelete}"
@click=${el.deleteTaskList}
>
<converse-icon class="fa fa-trash-alt" size="1em"></converse-icon>
</a>`
: html`
<div class="task-list-name">
<form @submit=${el.saveTaskList}>
<input type="text" name="name" autofocus value=${tasklist.get('name')} />
<input type="submit" class="btn btn-primary" value="${__('Ok')}" />
<input type="reset" class="btn btn-secondary" value="${__('Cancel')}" @click=${el.toggleEdit} />
</form>
</div>`
}
2024-04-30 16:30:44 +00:00
</div>
<div class="task-list-tasks">
${el.collapsed
? ''
: repeat(tasks, (task) => task.get('id'), (task) => {
2024-04-30 16:30:44 +00:00
return html`<livechat-converse-muc-task .model=${task}></livechat-converse-muc-task>`
})
}
2024-04-30 15:11:10 +00:00
</div>`
}