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

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

diff --git a/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js.es6 b/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js.es6
index 14a9cab..2811719 100644
--- a/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js.es6
+++ b/plugins/discourse-local-dates/assets/javascripts/initializers/discourse-local-dates.js.es6
@@ -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
         });
       }
     }

GitHub sha: 5e68c5f8

1 Like