* The `confirm` modal didn't show the `title`
* Refactor the new modal code to not automatically show a close button in the footer.
This commit is contained in:
JC Brand 2022-09-30 09:29:49 +02:00
parent 782de0165f
commit f791169f47
3 changed files with 19 additions and 14 deletions

View File

@ -25,7 +25,7 @@ export default class Confirm extends BaseModal {
}
getModalTitle () {
this.model.get('title');
return this.model.get('title');
}
onConfimation (ev) {
@ -50,6 +50,10 @@ export default class Confirm extends BaseModal {
this.confirmation.resolve(fields);
this.modal.hide();
}
renderModalFooter () { // eslint-disable-line class-methods-use-this
return '';
}
}
api.elements.define('converse-confirm-modal', Confirm);

View File

@ -19,10 +19,7 @@ export default (el) => {
</span>
${ el.renderModal?.() ?? '' }
</div>
<div class="modal-footer">
${ modal_close_button }
${ el.renderModalFooter?.() ?? '' }
</div>
${ el.renderModalFooter?.() ?? html`<div class="modal-footer">${ modal_close_button }</div>` }
</div>
</div>
`;

View File

@ -1,7 +1,8 @@
import avatar from 'shared/avatar/templates/avatar.js';
import { __ } from 'i18n';
import { html } from 'lit';
import { api } from "@converse/headless/core";
import { html } from 'lit';
import { modal_close_button } from "plugins/modal/templates/buttons.js";
const remove_button = (el) => {
const i18n_remove_contact = __('Remove as contact');
@ -22,14 +23,17 @@ export const tpl_footer = (el) => {
const i18n_refresh = __('Refresh');
const allow_contact_removal = api.settings.get('allow_contact_removal');
return html`
<button type="button" class="btn btn-info refresh-contact" @click=${ev => el.refreshContact(ev)}>
<converse-icon
class="fa fa-refresh"
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${i18n_refresh}</button>
${ (allow_contact_removal && is_roster_contact) ? remove_button(el) : '' }
<div class="modal-footer">
${ modal_close_button }
<button type="button" class="btn btn-info refresh-contact" @click=${ev => el.refreshContact(ev)}>
<converse-icon
class="fa fa-refresh"
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${i18n_refresh}</button>
${ (allow_contact_removal && is_roster_contact) ? remove_button(el) : '' }
</div>
`;
}