DEV: Upgrade the so-called share-and-invite modal (#23574)
This commit is contained in:
parent
91e456ba30
commit
5df1b1c523
|
@ -93,11 +93,7 @@
|
|||
|
||||
<div class="footer">
|
||||
{{#if this.inviteModel.finished}}
|
||||
<DButton
|
||||
@action={{this.sendCloseModal}}
|
||||
@label="close"
|
||||
class="btn-primary"
|
||||
/>
|
||||
<DButton @action={{@closeModal}} @label="close" class="btn-primary" />
|
||||
{{else}}
|
||||
<DButton
|
||||
@icon={{this.inviteIcon}}
|
||||
|
|
|
@ -14,7 +14,6 @@ export default Component.extend({
|
|||
groupIds: null,
|
||||
allGroups: null,
|
||||
|
||||
inviteModel: alias("panel.model.inviteModel"),
|
||||
isStaff: readOnly("currentUser.staff"),
|
||||
isAdmin: readOnly("currentUser.admin"),
|
||||
|
||||
|
@ -315,11 +314,6 @@ export default Component.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@action
|
||||
sendCloseModal() {
|
||||
this.attrs.close();
|
||||
},
|
||||
|
||||
@action
|
||||
createInvite() {
|
||||
if (this.disabled) {
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{{component
|
||||
this.panelComponent
|
||||
panel=this.panel
|
||||
close=(route-action "closeModal")
|
||||
}}
|
|
@ -1,12 +0,0 @@
|
|||
import Component from "@ember/component";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
|
||||
export default Component.extend({
|
||||
panel: null,
|
||||
|
||||
panelComponent: fmt("panel.id", "%@-panel"),
|
||||
|
||||
classNameBindings: ["panel.id"],
|
||||
|
||||
classNames: ["modal-panel"],
|
||||
});
|
|
@ -0,0 +1,13 @@
|
|||
<DModal
|
||||
@title={{i18n @model.title}}
|
||||
@closeModal={{@closeModal}}
|
||||
@bodyClass="invite modal-panel"
|
||||
class="add-pm-participants"
|
||||
>
|
||||
<:body>
|
||||
<InvitePanel
|
||||
@inviteModel={{@model.inviteModel}}
|
||||
@closeModal={{@closeModal}}
|
||||
/>
|
||||
</:body>
|
||||
</DModal>
|
|
@ -1,4 +0,0 @@
|
|||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
||||
export default Controller.extend(ModalFunctionality);
|
|
@ -20,6 +20,7 @@ import FlagModal from "discourse/components/modal/flag";
|
|||
import GrantBadgeModal from "discourse/components/modal/grant-badge";
|
||||
import MoveToTopicModal from "discourse/components/modal/move-to-topic";
|
||||
import RawEmailModal from "discourse/components/modal/raw-email";
|
||||
import AddPmParticipants from "discourse/components/modal/add-pm-participants";
|
||||
|
||||
const SCROLL_DELAY = 500;
|
||||
|
||||
|
@ -81,27 +82,21 @@ const TopicRoute = DiscourseRoute.extend({
|
|||
|
||||
@action
|
||||
showInvite() {
|
||||
let invitePanelTitle;
|
||||
let modalTitle;
|
||||
|
||||
if (this.isPM) {
|
||||
invitePanelTitle = "topic.invite_private.title";
|
||||
modalTitle = "topic.invite_private.title";
|
||||
} else if (this.invitingToTopic) {
|
||||
invitePanelTitle = "topic.invite_reply.title";
|
||||
modalTitle = "topic.invite_reply.title";
|
||||
} else {
|
||||
invitePanelTitle = "user.invited.create";
|
||||
modalTitle = "user.invited.create";
|
||||
}
|
||||
|
||||
showModal("share-and-invite", {
|
||||
modalClass: "share-and-invite",
|
||||
panels: [
|
||||
{
|
||||
id: "invite",
|
||||
title: invitePanelTitle,
|
||||
model: {
|
||||
inviteModel: this.modelFor("topic"),
|
||||
},
|
||||
},
|
||||
],
|
||||
this.modal.show(AddPmParticipants, {
|
||||
model: {
|
||||
title: modalTitle,
|
||||
inviteModel: this.modelFor("topic"),
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ const KNOWN_LEGACY_MODALS = [
|
|||
"reject-reason-reviewable",
|
||||
"reorder-categories",
|
||||
"request-group-membership-form",
|
||||
"share-and-invite",
|
||||
"tag-upload",
|
||||
];
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<DModalBody>
|
||||
<ModalPanel @panel={{this.modal.selectedPanel}} />
|
||||
</DModalBody>
|
|
@ -82,7 +82,7 @@ acceptance("Personal Message - invite", function (needs) {
|
|||
await click(".private-message-map .controls .add-participant-btn");
|
||||
|
||||
assert
|
||||
.dom(".d-modal.share-and-invite .invite-user-control")
|
||||
.dom(".d-modal.add-pm-participants .invite-user-control")
|
||||
.exists("invite modal is displayed");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -20,12 +20,9 @@ module("Integration | Component | invite-panel", function (hooks) {
|
|||
);
|
||||
|
||||
this.currentUser.set("details", { can_invite_via_email: true });
|
||||
this.set("panel", {
|
||||
id: "invite",
|
||||
model: { inviteModel: User.create(this.currentUser) },
|
||||
});
|
||||
this.set("inviteModel", User.create(this.currentUser));
|
||||
|
||||
await render(hbs`<InvitePanel @panel={{this.panel}} />`);
|
||||
await render(hbs`<InvitePanel @inviteModel={{this.inviteModel}} />`);
|
||||
|
||||
const input = selectKit(".invite-user-input");
|
||||
await input.expand();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
@import "offline-indicator";
|
||||
@import "pick-files-button";
|
||||
@import "relative-time-picker";
|
||||
@import "share-and-invite-modal";
|
||||
@import "add-pm-participants";
|
||||
@import "download-calendar";
|
||||
@import "sidebar/edit-navigation-menu/categories-modal";
|
||||
@import "sidebar/edit-navigation-menu/modal";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.share-and-invite.modal {
|
||||
.add-pm-participants.modal {
|
||||
.modal-body {
|
||||
max-width: 475px;
|
||||
min-width: 320px;
|
||||
|
@ -11,7 +11,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.share-and-invite.modal .share.modal-panel {
|
||||
.add-pm-participants.modal .share.modal-panel {
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
@ -57,7 +57,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.share-and-invite.modal .invite.modal-panel,
|
||||
.add-pm-participants.modal .invite.modal-panel,
|
||||
.invite-link.modal-panel {
|
||||
.error-message,
|
||||
.success-message {
|
Loading…
Reference in New Issue