FEATURE: decorates header-title with event date when possible (#39)

FEATURE: decorates header-title with event date when possible (#39)

diff --git a/assets/javascripts/initializers/decorate-topic-title.js.es6 b/assets/javascripts/initializers/decorate-topic-title.js.es6
index c79929d..1e7ddf5 100644
--- a/assets/javascripts/initializers/decorate-topic-title.js.es6
+++ b/assets/javascripts/initializers/decorate-topic-title.js.es6
@@ -4,13 +4,15 @@ import guessDateFormat from "discourse/plugins/discourse-calendar/lib/guess-best
 function initializeDecorateTopicTitle(api) {
   api.decorateTopicTitle((topic, node, topicTitleType) => {
     const startsAt = topic.event_starts_at;
+
     if (startsAt) {
+      const date = moment.utc(startsAt);
+
       if (topicTitleType === "topic-list-item-title") {
         if (node.querySelector(".event-date")) {
           return;
         }
 
-        const date = moment.utc(startsAt);
         const dateContainer = document.createElement("span");
         dateContainer.classList.add("event-date");
         dateContainer.innerText = date
@@ -19,6 +21,19 @@ function initializeDecorateTopicTitle(api) {
 
         node.appendChild(dateContainer);
       }
+
+      if (topicTitleType === "header-title") {
+        if (node.querySelector(".event-date")) {
+          return;
+        }
+
+        const child = document.createElement("span");
+        child.classList.add("event-date");
+        child.innerText = date
+          .tz(moment.tz.guess())
+          .format(guessDateFormat(date));
+        node.appendChild(child);
+      }
     }
   });
 }
diff --git a/assets/stylesheets/common/discourse-post-event-core-ext.scss b/assets/stylesheets/common/discourse-post-event-core-ext.scss
index 1d7d9bf..1e437fd 100644
--- a/assets/stylesheets/common/discourse-post-event-core-ext.scss
+++ b/assets/stylesheets/common/discourse-post-event-core-ext.scss
@@ -8,3 +8,14 @@
     margin-left: 0.25em;
   }
 }
+
+.header-title {
+  .event-date {
+    font-size: $font-down-3;
+    background: $primary-low;
+    padding: 0.25em;
+    border-radius: 3px;
+    vertical-align: middle;
+    margin-left: 0.25em;
+  }
+}

GitHub sha: f601d724

This commit appears in #39 which was merged by jjaffeux.