Skip to content

Commit

Permalink
DEV: adds a post event status decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaffeux committed Oct 22, 2024
1 parent b4c4e4e commit 388753f
Showing 1 changed file with 32 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import Component from "@glimmer/component";
import { hash } from "@ember/helper";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import { modifier } from "ember-modifier";
import PluginOutlet from "discourse/components/plugin-outlet";
import concatClass from "discourse/helpers/concat-class";
import routeAction from "discourse/helpers/route-action";
import { emojiUnescape } from "discourse/lib/text";
Expand All @@ -16,6 +18,8 @@ import MoreMenu from "./more-menu";
import Status from "./status";
import Url from "./url";

const Separator = <template><span class="separator">·</span></template>;

export default class DiscoursePostEvent extends Component {
@service currentUser;
@service discoursePostEventApi;
Expand Down Expand Up @@ -124,27 +128,34 @@ export default class DiscoursePostEvent extends Component {
{{this.eventName}}
</span>
<div class="status-and-creators">
{{#if @event.isExpired}}
<span class="status expired">
{{i18n
"discourse_calendar.discourse_post_event.models.event.expired"
}}
</span>
{{else if @event.isClosed}}
<span class="status closed">
{{i18n
"discourse_calendar.discourse_post_event.models.event.closed"
}}
</span>
{{else}}
<span
class={{this.statusClass}}
title={{this.eventStatusDescription}}
>
{{this.eventStatusLabel}}
</span>
{{/if}}
<span class="separator">·</span>
<PluginOutlet
@name="discourse-post-event-status"
@outletArgs={{hash event=@event Separator=Separator}}
>
{{#if @event.isExpired}}
<span class="status expired">
{{i18n
"discourse_calendar.discourse_post_event.models.event.expired"
}}
</span>
{{else if @event.isClosed}}
<span class="status closed">
{{i18n
"discourse_calendar.discourse_post_event.models.event.closed"
}}
</span>
{{else}}
<span
class={{this.statusClass}}
title={{this.eventStatusDescription}}
>
{{this.eventStatusLabel}}
</span>
{{/if}}
</PluginOutlet>

<Separator />

<span class="creators">
<span class="created-by">{{i18n
"discourse_calendar.discourse_post_event.event_ui.created_by"
Expand Down

0 comments on commit 388753f

Please sign in to comment.