Skip to content

Commit

Permalink
Handle deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
angusmcleod committed Feb 5, 2025
1 parent 870dc0f commit 682edd2
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import DButton from "discourse/components/d-button";
import { eventLabel } from "../lib/date-utilities";
import AddEvent from "./modal/add-event";
Expand Down Expand Up @@ -66,10 +67,10 @@ export default class AddToCalendar extends Component {
<DButton
@action={{this.showAddEvent}}
class={{this.valueClasses}}
@translatedLabel={{this.valueLabel}}
@translatedLabel={{htmlSafe this.valueLabel}}
/>
{{#unless @noText}}
<DButton @icon="times" @action={{this.removeEvent}} class="remove" />
<DButton @icon="xmark" @action={{this.removeEvent}} class="remove" />
{{/unless}}
{{else}}
{{#if @iconOnly}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<td>
<DButton
@action={{action "removeFilter"}}
@icon="times"
@icon="xmark"
@title="admin.events.filter.remove.title"
/>
</td>
2 changes: 1 addition & 1 deletion assets/javascripts/discourse/components/events-message.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

{{#if this.showDocumentation}}
<div class="message-block">
{{d-icon "question-circle"}}
{{d-icon "circle-question"}}

<a href={{this.documentationUrl}} target="_blank" rel="noopener noreferrer">
{{this.documentation}}
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/components/events-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const icons = {
error: "times-circle",
success: "check-circle",
warn: "exclamation-circle",
info: "info-circle",
info: "circle-info",
};

const urls = {
Expand All @@ -26,7 +26,7 @@ export default Component.extend({

@discourseComputed("message.type")
icon(type) {
return icons[type] || "info-circle";
return icons[type] || "circle-info";
},

@discourseComputed("message.key", "viewName", "message.opts")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
{{#if this.canSave}}
<DButton
@action={{action "saveProvider"}}
@icon="save"
@icon="floppy-disk"
class={{this.saveClass}}
@title="admin.events.provider.save.title"
@label="admin.events.provider.save.label"
Expand Down
6 changes: 3 additions & 3 deletions assets/javascripts/discourse/components/events-source-row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@
/>
<DButton
@action={{action "syncTopics"}}
@icon="sync"
@icon="arrows-rotate"
@label="admin.events.source.topic_sync_all.label"
@title="admin.events.source.topic_sync_all.title"
class="sync-topics"
@disabled={{this.syncTopicsDisabled}}
/>
<DButton
@action={{action "saveSource"}}
@icon="save"
@icon="floppy-disk"
class={{this.saveClass}}
@title="admin.events.source.save.title"
@label="admin.events.source.save.label"
Expand All @@ -213,7 +213,7 @@
@action={{this.removeSource}}
@actionParam={{this.source}}
@disabled={{this.removeDisabled}}
@icon="trash-alt"
@icon="trash-can"
@title="admin.events.source.remove.title"
@label="admin.events.source.remove.label"
class="remove-source btn-danger"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import I18n from "I18n";
export default class EventsSubscriptionBadge extends Component {
@service("events-subscription") subscription;
@tracked updating = false;
@tracked updateIcon = "sync";
@tracked updateIcon = "arrows-rotate";

get i18nKey() {
return `admin.events.subscription.type.${
Expand Down Expand Up @@ -44,7 +44,7 @@ export default class EventsSubscriptionBadge extends Component {
this.updating = true;
this.updateIcon = null;
this.subscription.getSubscriptionStatus(true).finally(() => {
this.updateIcon = "sync";
this.updateIcon = "arrows-rotate";
this.updating = false;
});
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{#if @outletArgs.topic.event}}
<div class="topic-list-item-event">
<div class="topic-list-item-event-time">
<a
href={{@outletArgs.topic.lastUnreadUrl}}
class={{@outletArgs.topic.topicListItemClasses}}
>
{{event-label @outletArgs.topic.event list="true"}}
</a>
</div>
{{#if this.siteSettings.events_rsvp}}
{{#if @outletArgs.topic.event.rsvp}}
<div class="topic-list-item-event-rsvp">
<a
href={{@outletArgs.topic.lastUnreadUrl}}
class={{@outletArgs.topic.topicListItemClasses}}
>
<span>{{@outletArgs.topic.event_going_total}}</span>
<span>{{i18n "event_rsvp.going.label"}}</span>
</a>
</div>
{{/if}}
{{/if}}
</div>
{{/if}}
66 changes: 1 addition & 65 deletions assets/javascripts/discourse/initializers/discourse-events.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import EmberObject from "@ember/object";
import { bind, scheduleOnce } from "@ember/runloop";
import { scheduleOnce } from "@ember/runloop";
import $ from "jquery";
import { withPluginApi } from "discourse/lib/plugin-api";
import DiscourseURL from "discourse/lib/url";
import { CREATE_TOPIC } from "discourse/models/composer";
import {
default as discourseComputed,
observes,
on,
} from "discourse-common/utils/decorators";
import I18n from "I18n";
import Provider from "../models/provider";
Expand Down Expand Up @@ -176,68 +174,6 @@ export default {
},
});

api.modifyClass("component:topic-list-item", {
pluginId: "discourse-events",

setupEventLinkClick() {
$(".event-link", this.element).on(
"click",
bind(this, this.handleEventLabelClick)
);
},

teardownEventLinkClick() {
$(".event-link", this.element).off(
"click",
bind(this, this.handleEventLabelClick)
);
},

@on("didInsertElement")
setupEventLink() {
scheduleOnce("afterRender", this, this.setupEventLinkClick);
},

@on("willDestroyElement")
teardownEventLink() {
this.teardownEventLinkClick();
},

handleEventLabelClick(e) {
e.preventDefault();
const topic = this.get("topic");
const href = $(e.target).attr("href");
this.appEvents.trigger("header:update-topic", topic);
DiscourseURL.routeTo(href);
},

handleMoveElements() {
const topic = this.get("topic");

const $linkTopLine = $(".link-top-line", this.element);
let rowBelowTitle = false;

if (topic.event && topic.event.rsvp) {
$(".topic-list-event-rsvp", this.element).insertAfter($linkTopLine);
rowBelowTitle = true;
}

if (this.siteSettings.events_event_label_short_after_title) {
$(".date-time-container", this.element).insertAfter($linkTopLine);
rowBelowTitle = true;
}

if (rowBelowTitle) {
$(".main-link", this.element).addClass("row-below-title");
}
},

@on("didRender")
moveElements() {
scheduleOnce("afterRender", this, this.handleMoveElements);
},
});

api.modifyClass("component:edit-category-settings", {
pluginId: "discourse-events",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@action={{action "updateTopic"}}
@label="admin.events.event.update.title"
@title="admin.events.event.update.title"
@icon="sync"
@icon="arrows-rotate"
@disabled={{this.updateTopicDisabled}}
/>
{{/if}}
Expand All @@ -57,7 +57,7 @@
@title="admin.events.event.delete.title"
@disabled={{this.deleteDisabled}}
class="btn-danger"
@icon="trash-alt"
@icon="trash-can"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class="btn-default"
@action={{route-action "showSettings"}}
@actionParam={{this.plugin}}
@icon="cog"
@icon="gear"
@label="admin.plugins.change_settings_short"
/>
</li>
Expand Down
8 changes: 4 additions & 4 deletions assets/stylesheets/common/events.scss
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,9 @@ ul.events-calendar-events {
.topic-list-item-event {
margin-top: 0.25em;
font-size: var(--font-down-2);
display: flex;
flex-flow: wrap;
gap: 0.5em;
}

.topic-list-item-event-time {
Expand Down Expand Up @@ -631,6 +634,7 @@ ul.events-calendar-events {
.composer-controls-event {
position: relative;
margin-left: 8px;
margin-bottom: 8px;

.popup-tip {
left: 0;
Expand Down Expand Up @@ -670,10 +674,6 @@ ul.events-webcal-notices {
}
}

.topic-controls-event {
margin-bottom: 1em;
}

.topic-event-label {
display: flex;
gap: 0.5em;
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ de:
events_event_label_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> Format für Datum/Uhrzeit."
events_event_label_short_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> Kurzformat für Datum/Uhrzeit in Themenlisten."
events_event_label_short_only_start: "Zeige nur den Beginn im Kurzformat (in Themenlisten)."
events_event_label_short_after_title: "Füge die Bezeichnung der Veranstaltung nach dem Titel des Themas in die Themenliste ein."
events_event_time_calendar_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> Zeit-Format im Kalender."
events_remove_past_from_map: "Vergangene Veranstaltungen in der Karte im <a href='https://github.com/angusmcleod/discourse-locations'>locations plugin</a> ausblenden."
events_remove_past_from_agenda: "Vergangene Veranstaltungen in Agendas ausblenden."
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ en:
events_event_label_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> format for event label."
events_event_label_short_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> format for topic list event labels."
events_event_label_short_only_start: "Show only start date in topic list event labels."
events_event_label_short_after_title: "Insert the event label after the topic title in the topic list."
events_event_time_calendar_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> format of time in calendar entry."
events_remove_past_from_map: "Remove past events from the map topic list in the <a href='https://github.com/angusmcleod/discourse-locations'>locations plugin</a>."
events_remove_past_from_agenda: "Remove past events from agendas."
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.fi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ fi:
events_event_label_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a>-muotoilu tapahtuman ajankohdalle (ketjun otsikon alla)."
events_event_label_short_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a>-muotoilu tapahtuman ajankohdalle ketjulistauksessa."
events_event_label_short_only_start: "Näytä vain tapahtuman alkamispäivä ketjulistauksessa."
events_event_label_short_after_title: "Näytä tapahtuman ajankohta otsikon alla ketjulistauksessa."
events_event_time_calendar_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a>-muotoilu tapahtuman kellonajalle kalenterinäkymässä."
events_remove_past_from_map: "Piilota menneet tapahtumat karttanäkymästä <a href='https://github.com/angusmcleod/discourse-locations'>Locations</a>-lisäosassa."
events_remove_past_from_agenda: "Piilota menneet tapahtumat tapahtumalistauksessa."
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ fr:
events_event_label_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> format pour l'étiquette de l'événement."
events_event_label_short_format: "Format <a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> pour les étiquettes d'événements de liste de sujets."
events_event_label_short_only_start: "N'afficher que la date de début dans les étiquettes d'événements de liste de sujets."
events_event_label_short_after_title: "Insérez l'étiquette de l'événement après le titre de la rubrique dans la liste des rubriques."
events_event_time_calendar_format: "<a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> format de l'heure dans l'entrée du calendrier."
events_remove_past_from_map: "Supprimez les événements passés de la liste des sujets de carte dans le <a href='https://github.com/angusmcleod/discourse-locations'>plug-in locations</a>."
events_remove_past_from_agenda: "Supprimer les événements passés de l'ordre du jour."
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.he.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ he:
events_event_label_format: "תבנית <a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> לתווית אירוע."
events_event_label_short_format: "תבנית <a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> לתוויות אירועי רשימת נושאים."
events_event_label_short_only_start: "להציג רק תאריך התחלה בתוויות אירועי רשימת הנושאים."
events_event_label_short_after_title: "הוספת תווית האירועי אחרי כותרת הנושא ברשימת הנושאים."
events_event_time_calendar_format: "תבנית <a href='http://momentjs.com/docs/#/displaying/format/'>Moment.js</a> של השעה ברשומת לוח שנה."
events_remove_past_from_map: "הסרת אירועי עבר מרשימת נושאי המפה ב<a href='https://github.com/angusmcleod/discourse-locations'>תוסף המקומות</a>."
events_remove_past_from_agenda: "הסרת אירועי עבר מהלו״ז."
Expand Down
1 change: 0 additions & 1 deletion config/locales/server.pt_BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pt_BR:
events_event_label_format: "<a href='http://momentjs.com/docs/#/displaying/format/'></a> formato para rótulos de eventos."
events_event_label_short_format: "<a href='http://momentjs.com/docs/#/displaying/format/'></a> formato de rótulo para listas de eventos."
events_event_label_short_only_start: "Mostrar apenas data de início no rótulo dos eventos na lista de tópicos. "
events_event_label_short_after_title: "Inserir rótulo dos eventos depois do título."
events_event_time_calendar_format: "<a href='http://momentjs.com/docs/#/displaying/format/'></a> formato da data no calendário."
events_remove_past_from_map: "Remover eventos passados do mapa no <a href='https://github.com/angusmcleod/discourse-locations'></a>."
events_remove_past_from_agenda: "Remover eventos passados da agenda."
Expand Down
3 changes: 0 additions & 3 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ plugins:
events_event_label_short_only_start:
client: true
default: false
events_event_label_short_after_title:
client: true
default: false
events_event_time_calendar_format:
client: true
default: 'HH:mm'
Expand Down
4 changes: 2 additions & 2 deletions plugin.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# name: discourse-events
# about: Allows you to manage events in Discourse
# version: 0.9.3
# version: 0.9.4
# authors: Angus McLeod
# contact_emails: [email protected]
# url: https://github.com/angusmcleod/discourse-events
Expand Down Expand Up @@ -42,7 +42,7 @@

register_svg_icon "rss"
register_svg_icon "fingerprint"
register_svg_icon "save"
register_svg_icon "floppy-disk"
register_svg_icon "hourglass-half"
register_svg_icon "hourglass-end"
register_svg_icon "video"
Expand Down

0 comments on commit 682edd2

Please sign in to comment.