Skip to content

Commit

Permalink
Added "Copy" button to popups workshop.
Browse files Browse the repository at this point in the history
  • Loading branch information
azaslonov committed Apr 6, 2024
1 parent 59b9a8d commit 0497e2a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/workshops/popups/ko/popupDetails.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<i aria-hidden="true" class="paperbits-icon paperbits-simple-remove"></i>
Delete popup
</button>
<button class="btn btn-default" data-bind="click: copyPopup">
<i aria-hidden="true" class="paperbits-icon paperbits-single-copy-04"></i>
Copy page
</button>
</div>
<!-- /ko -->
</div>
11 changes: 11 additions & 0 deletions src/workshops/popups/ko/popupDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export class PopupDetailsWorkshop {
@Event()
private readonly onDeleteCallback: () => void;

@Event()
private readonly onCopyCallback: (popupItem: PopupItem) => void;

@OnMounted()
public async onMounted(): Promise<void> {
this.popupItem.title
Expand Down Expand Up @@ -95,4 +98,12 @@ export class PopupDetailsWorkshop {

this.router.navigateTo("/");
}

public async copyPopup(): Promise<void> {
const copiedPopup = await this.popupService.copyPopup(this.popupItem.key);

if (this.onCopyCallback) {
this.onCopyCallback(new PopupItem(copiedPopup));
}
}
}

0 comments on commit 0497e2a

Please sign in to comment.