UX: moves local-dates from popupMenu to toolbar (#7335)

This commit is contained in:
Joffrey JAFFEUX 2019-04-08 15:52:09 +02:00 committed by GitHub
parent 9d2e2867cc
commit 5e68c5f851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 9 deletions

View File

@ -6,19 +6,22 @@ function initializeDiscourseLocalDates(api) {
$(".discourse-local-date", $elem).applyLocalDates();
});
api.addToolbarPopupMenuOptionsCallback(() => {
return {
action: "insertDiscourseLocalDate",
icon: "globe",
label: "discourse_local_dates.title"
};
api.onToolbarCreate(toolbar => {
toolbar.addButton({
title: "discourse_local_dates.title",
id: "local-dates",
group: "extras",
icon: "calendar-alt",
sendAction: event =>
toolbar.context.send("insertDiscourseLocalDate", event)
});
});
api.modifyClass("controller:composer", {
api.modifyClass("component:d-editor", {
actions: {
insertDiscourseLocalDate() {
insertDiscourseLocalDate(toolbarEvent) {
showModal("discourse-local-dates-create-modal").setProperties({
toolbarEvent: this.get("toolbarEvent")
toolbarEvent
});
}
}