Moderator notes WIP (#144)
This commit is contained in:
@ -0,0 +1,37 @@
|
||||
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { html } from 'lit'
|
||||
import { api } from '@converse/headless'
|
||||
import { getAuthorStyle } from '../../../../src/utils/color.js'
|
||||
import { __ } from 'i18n'
|
||||
|
||||
export function tplMucNoteOccupant (el, occupant) {
|
||||
const authorStyle = getAuthorStyle(occupant)
|
||||
const jid = occupant.get('jid')
|
||||
const occupantId = occupant.get('occupant_id')
|
||||
|
||||
return html`
|
||||
<a @click=${(ev) => {
|
||||
api.modal.show('converse-muc-occupant-modal', { model: occupant }, ev)
|
||||
}}>
|
||||
<converse-avatar
|
||||
.model=${occupant}
|
||||
class="avatar chat-msg__avatar"
|
||||
name="${occupant.getDisplayName()}"
|
||||
nonce=${occupant.vcard?.get('vcard_updated')}
|
||||
height="30" width="30"></converse-avatar>
|
||||
|
||||
<span style=${authorStyle}>${occupant.getDisplayName()}</span>
|
||||
</a>
|
||||
${
|
||||
el.full_display
|
||||
? html`<ul>
|
||||
${jid ? html`<li title=${__('XMPP Address')}>${jid}</li>` : ''}
|
||||
${occupantId ? html`<li title=${__('Occupant Id')}>${occupantId}</li>` : ''}
|
||||
</ul>`
|
||||
: ''
|
||||
}
|
||||
`
|
||||
}
|
@ -50,12 +50,32 @@ function _tplNoteForm (note) {
|
||||
</fieldset>`
|
||||
}
|
||||
|
||||
export function tplMucCreateNoteForm (notesEl) {
|
||||
function _tplNoteOccupantFormFields (occupant) {
|
||||
if (!occupant) { return '' }
|
||||
return html`
|
||||
<input type="hidden" name="occupant_nick" value=${occupant.get('nick')} />
|
||||
<input type="hidden" name="occupant_jid" value=${occupant.get('jid')} />
|
||||
<input type="hidden" name="occupant_id" value=${occupant.get('occupant_id')} />
|
||||
`
|
||||
}
|
||||
|
||||
export function tplMucCreateNoteForm (notesEl, occupant) {
|
||||
const i18nOk = __('Ok')
|
||||
const i18nCancel = __('Cancel')
|
||||
|
||||
return html`
|
||||
<form class="notes-create-note converse-form" @submit=${notesEl.submitCreateNote}>
|
||||
${
|
||||
occupant
|
||||
? html`
|
||||
${_tplNoteOccupantFormFields(occupant)}
|
||||
<livechat-converse-muc-note-occupant
|
||||
full_display=${true}
|
||||
.model=${occupant}
|
||||
></livechat-converse-muc-note-occupant>
|
||||
`
|
||||
: ''
|
||||
}
|
||||
${_tplNoteForm(undefined)}
|
||||
<fieldset class="form-group">
|
||||
<input type="submit" class="btn btn-primary" value="${i18nOk}" />
|
||||
|
@ -14,7 +14,7 @@ export default function tplMucNotes (el, notes) {
|
||||
|
||||
return html`
|
||||
${
|
||||
el.create_note_opened ? tplMucCreateNoteForm(el) : tplCreateButton(el)
|
||||
el.create_note_opened ? tplMucCreateNoteForm(el, el.create_note_for_occupant) : tplCreateButton(el)
|
||||
}
|
||||
${
|
||||
repeat(notes, (note) => note.get('id'), (note) => {
|
||||
|
Reference in New Issue
Block a user