Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment3 #834

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions ui/actions/nuxeo-favorites-toggle-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,27 +151,33 @@ import '../nuxeo-button-styles.js';
*/
_toggle() {
if (!this.favorite) {
this.$.opAdd.execute().then(() => {
this.dispatchEvent(
new CustomEvent('added-to-favorites', {
composed: true,
bubbles: true,
detail: { doc: this.document },
}),
);
this._setFavorite(true);
});
const addToFavorite = window.confirm("Do you want to add it to favorites?");
if (addToFavorite) {
this.$.opAdd.execute().then(() => {
this.dispatchEvent(
new CustomEvent('added-to-favorites', {
composed: true,
bubbles: true,
detail: { doc: this.document },
}),
);
this._setFavorite(true);
});
}
} else {
this.$.opRemove.execute().then(() => {
this.dispatchEvent(
new CustomEvent('removed-from-favorites', {
composed: true,
bubbles: true,
detail: { doc: this.document },
}),
);
this._setFavorite(false);
});
const removeFromFavorite = window.confirm("Do you want to remove it from favorites?");
if (removeFromFavorite) {
this.$.opRemove.execute().then(() => {
this.dispatchEvent(
new CustomEvent('removed-from-favorites', {
composed: true,
bubbles: true,
detail: { doc: this.document },
}),
);
this._setFavorite(false);
});
}
}
}

Expand Down