Task lists WIP:
* initializing a modal
This commit is contained in:
parent
d19d8d7391
commit
ad090eaca4
@ -2,6 +2,8 @@ import { _converse, converse } from '../../../src/headless/core.js'
|
|||||||
import { ChatRoomTaskLists } from './task-lists.js'
|
import { ChatRoomTaskLists } from './task-lists.js'
|
||||||
import { ChatRoomTaskList } from './task-list.js'
|
import { ChatRoomTaskList } from './task-list.js'
|
||||||
import { getHeadingButtons } from './utils.js'
|
import { getHeadingButtons } from './utils.js'
|
||||||
|
import './muc-task-lists-view.js' // FIXME: here or in another file?
|
||||||
|
import './modals/muc-task-lists.js' // FIXME: here or in another file?
|
||||||
|
|
||||||
converse.plugins.add('livechat-converse-tasks', {
|
converse.plugins.add('livechat-converse-tasks', {
|
||||||
dependencies: ['converse-muc', 'converse-disco'], // TODO: add converse-pubsub
|
dependencies: ['converse-muc', 'converse-disco'], // TODO: add converse-pubsub
|
||||||
@ -10,6 +12,7 @@ converse.plugins.add('livechat-converse-tasks', {
|
|||||||
_converse.ChatRoomTaskLists = ChatRoomTaskLists
|
_converse.ChatRoomTaskLists = ChatRoomTaskLists
|
||||||
_converse.ChatRoomTaskList = ChatRoomTaskList
|
_converse.ChatRoomTaskList = ChatRoomTaskList
|
||||||
|
|
||||||
|
// adding the "Tasks" button in the MUC heading buttons:
|
||||||
_converse.api.listen.on('getHeadingButtons', getHeadingButtons)
|
_converse.api.listen.on('getHeadingButtons', getHeadingButtons)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
17
conversejs/custom/plugins/tasks/modals/muc-task-lists.js
Normal file
17
conversejs/custom/plugins/tasks/modals/muc-task-lists.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import BaseModal from '../../../../src/plugins/modal/modal.js'
|
||||||
|
import { api } from '../../../../src/headless/core.js'
|
||||||
|
import { html } from 'lit'
|
||||||
|
import { __ } from 'i18n'
|
||||||
|
|
||||||
|
export default class mucTaskListsModal extends BaseModal {
|
||||||
|
renderModal () {
|
||||||
|
const muc = this.model
|
||||||
|
return html`<livechat-converse-muc-task-lists jid="${muc.get('jid')}"></livechat-converse-muc-task-lists>`
|
||||||
|
}
|
||||||
|
|
||||||
|
getModalTitle () {
|
||||||
|
return __('Tasks')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
api.elements.define('livechat-converse-muc-task-lists-modal', mucTaskListsModal)
|
20
conversejs/custom/plugins/tasks/muc-task-lists-view.js
Normal file
20
conversejs/custom/plugins/tasks/muc-task-lists-view.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { CustomElement } from 'shared/components/element.js'
|
||||||
|
import { _converse, api } from '@converse/headless/core'
|
||||||
|
|
||||||
|
export default class MUCTaskListsView extends CustomElement {
|
||||||
|
static get properties () {
|
||||||
|
return {
|
||||||
|
jid: { type: String, attribute: true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async initialize () {
|
||||||
|
this.model = _converse.chatboxes.get(this.getAttribute('jid'))
|
||||||
|
}
|
||||||
|
|
||||||
|
render () {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
api.elements.define('livechat-converse-muc-task-lists', MUCTaskListsView)
|
@ -1,4 +1,4 @@
|
|||||||
import { _converse } from '../../../src/headless/core.js'
|
import { _converse, api } from '../../../src/headless/core.js'
|
||||||
import { __ } from 'i18n'
|
import { __ } from 'i18n'
|
||||||
|
|
||||||
export function getHeadingButtons (view, buttons) {
|
export function getHeadingButtons (view, buttons) {
|
||||||
@ -20,8 +20,8 @@ export function getHeadingButtons (view, buttons) {
|
|||||||
handler: async (ev) => {
|
handler: async (ev) => {
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
ev.stopPropagation()
|
ev.stopPropagation()
|
||||||
|
// opening the muc task lists view:
|
||||||
// TODO.
|
api.modal.show('livechat-converse-muc-task-lists-modal', { model: muc })
|
||||||
},
|
},
|
||||||
a_class: '',
|
a_class: '',
|
||||||
icon_class: 'fa-list', // FIXME
|
icon_class: 'fa-list', // FIXME
|
||||||
|
Loading…
x
Reference in New Issue
Block a user