Events Calendar on Custom Lists

סיכום מבוסס בינה מלאכותית

putty introduces a theme component that adds calendar functionality to Discourse Custom Lists, requiring both the Events plugin and the Custom Topic Lists plugin. Unlike the standard upcoming events page, this component offers sidebar or full calendar layouts, integrates with topic lists, and allows targeting multiple categories or tags via custom list settings. Key features include the ability to toggle the calendar’s visibility and customize the “New” button’s label and icon.

Early testing revealed issues with Horizon theme compatibility, specifically regarding toggling non-event topics. nathank requested that the “New Topic” button dynamically change to “New Event” when filtered. putty implemented this change and fixed the Horizon filtering issue, leveraging new core event filter query language features.

Subsequent discussions focused on improving the user experience for creating events. nathank noted that the default composer often lacks the event input block, causing user confusion. putty and nathank refined the Horizon integration, deciding to place a distinct “New Event” button above the calendar while maintaining consistency with the theme’s sidebar design. putty implemented these changes, which nathank praised for their effectiveness on both desktop and mobile, though noting a limitation where calendar events in personal messages aren’t captured by the filter.

Further quality-of-life improvements included making the calendar collapsible with state memory, defaulting to a minimized view on mobile to save screen real estate, and aligning the mobile calendar view with site settings [(nathank, putty)]. nathank suggested hiding irrelevant navbar elements (like category/tag filters) on the events list to reduce clutter, particularly on mobile, and integrating the native calendar click-to-create functionality.

putty confirmed these updates, noting that the category/tag/latest/new/hot filters are now hidden, the calendar toggle button was repositioned, and clicking on calendar dates now opens a new event topic using the native handler.

:information_source: Summary Add Calendar functionality to Custom Lists
:eyeglasses: Preview See it in action here
:hammer_and_wrench: Repository Event List Calendar
:question: Install Guide How to install a theme or theme component
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

:warning: This utilizes (requires) both the events and the custom lists plugin.

Why use this over the upcoming events page?

  • Gives the option to have a sidebar outlet instead of the full calendar
  • Includes the topic list
  • Ability to target multiple categories or specific tags (via the custom lists plugin)

Note: to exclude categories where a tag is used, be sure to -category:SLUG in the custom list settings. I.e, tag:webinar,livestream -category:show-tell. I highly recommend leveraging the event filter parameters.

Big shoutouts to @nathank for ideas on how to improve this theme component!

Calendar view:

Includes a toggle to show/hide the calendar

Sidebar view:

Settings

Includes the ability to have different calendars per list/object

Setting Description
List slug Slug of the list in Custom Topic Lists, e.g. events for /lists/events. Required.
Layout Full calendar, or an upcoming events sidebar. Required.
Show new button Add a New button to the list’s navigation bar. The composer opens blank.
New button label Button text, e.g. New Event. The composer buttons follow it (Create Event). Empty means New Topic.
New button icon Pick an icon from a picker with previews, e.g. calendar-day. Empty means the pen icon. Phones show only the icon.
Hide Horizon sidebar button Horizon only. Hide the sidebar New Topic button on this page. Otherwise it matches the button above.
Start with an event New topics open with an event block starting at the next full hour, lasting an hour.
New button tags Optional. New topics default to these tags, including from the sidebar button and the c shortcut.
Hide topic list Hide the standard topic list on this page.

8 לייקים

This is really cool! I can see it becoming super useful, and bridging the missing overall site upcoming events list in the core functionality.

For some reason, the toggle to hide non-event containing topics isn’t working for me. This is with the Horizon theme (haven’t tested it further sorry). I wonder if what is needed is for the filter to handle Event filtering rather than hiding them via the TC. I’ll put in a feature request for that:

Also, we really need the New Topic button to become a New Event button instead on the Event filtered list. Is it possible to add that to the TC?

לייק 1

I’ll test Horizon to see what I can find. Thank you for submitting that feature request, though!

Sure, this shouldn’t be too hard!

This should work in Horizon now. I’ll revisit if/when your feature request goes through. :slight_smile:

New Topic/Event button added!

I toyed with pulling the filter from the List setting, but if there are multiple tags or categories, it gets messy.

לייק 1

Wow! Thank you for listening and putting that into action so promptly. I’m really looking forward to giving it a test run shortly.

It is!

Okay, I’ve had a play now - works nicely! And the non-event topics are nicely hidden on Horizon too.

However, it really needs one more tweak for it to really fly, and it would do well with a specific adaptation for Horizon.

The key remaining issue

Currently, it opens up a topic in the site default composer category. While this is great as a proof of concept, it really needs to open up a new topic in an Event context (as in a configured Events category) or our users will get hopelessly lost.

Of note, if you change the site default composer category to an Events category, this makes an events input box that the user can’t easily remove unless they change categories or dive into Markdown. Knowing my users, they will get stuck and give up!!!

How should we approach this?

I’m guessing that the core Events plugin functionality might be a little hard to work with here. But perhaps you can find a clever way. I’d suggest aiming for having the Events input box appear (and remain there) regardless of the category chosen.

A reasonable workaround might be to get the button to open with a configured category (i.e. one with Events configured). If the user inputs some data, it will remain active even if they change categories. However, if they choose the category first they will lose the input box. This might require some signposting.

The pesky Horizon Theme

Lastly, the Horizon Theme does some lovely / weird stuff with the New Topic button (is placed high on the left sidebar on desktop), and this will need to be specifically mitigated.

לייק 1

I was able to incorporate the new filter queries :+1:

My plan for the composer is to add these settings:

Quick question about Horizon: do you want the new event functionality rolled into the top-left New Topic? Or should we keep the New Event button in your screenshot and have it include the new event object context?

לייק 1

Looks good - hopefully it will work nicely. I look forward to testing it out!

I’m actually not a fan of Horizon’s design choice of having the New Topic button on the sidebar. And I do like having a nice / different New Event button directly above the Calendar, as I know that is where people naturally look. It would be nice to have calendar-plus as the icon, and for it to be the same styling as the regular Horizon button.

Having said that, there is a lot of sense in staying as consistent with the rest of the Horizon theme as possible (even if I don’t like it!). This is how it looks on a category configured for Events in Horizon:

And this is the same page on mobile:

In my mind, the ideal for Horizon would be:

  1. On desktop, keep the New Event button above the calendar, but style it the same as the sidebar button
  2. Keep the sidebar button, but make this identical to the new button
    • admins can hide this quite easily if need be with CSS, but this of course could be governed by a setting
  3. On mobile, replicate the calendar-plus icon-only button as per the Horizon theme

Sorry I haven’t given you a clear answer - but that is the reality of this stuff, eh?

לייק 1

I think I was able to capture all of that. Update it and let me know what you think :slight_smile:

:rocket: AMAZING!!! :rocket:

Hallelujah - this is just brilliant!!! Works great on Horizon too.

One final snag

The Calendar shows events which are in Messages, but the /filter route that we are using doesn’t seem to be able to pick these up.

This isn’t a limitation of your awesome TC - rather of the filter functionality.

I’ve put in another feature request to look at this:

לייק 1

After using it this week, I’ve got a couple more quality of life suggestions for this:

Ability to minimise / maximise the calendar.

It would be great to be able to minimise the calendar on the Event list, and to have this state remembered.

The calendar, while often useful, takes up tonnes of real-estate - especially on mobile. On mobile it would be helpful for it to default to minimised.

Calendar on mobile defaults to Week view with the Events list

For us this is most unhelpful (we only have one event a fortnight or so). It would be great if it also followed the site default (which the desktop view appears to).

Hide topic list is now redundant

This TC setting could easily be removed, but I guess it is easier than trying to explain how to configure the filter!

Hey! Those make sense! I’ve updated the component with 2/3:

1. Minimize/maximize the calendar: There’s now a Hide calendar / Show calendar button above the calendar. Your choice is remembered in the browser, separately for each list page. On phones, the calendar starts minimized until you open it, so it no longer takes over the screen.

Truth be told, I personally find the sidebar outlet of a calendar a more valuable use of screen real estate, since many (of my) calendars have empty space, but YMMV :slight_smile:

2. Mobile view: The calendar now opens in the events plugin’s Upcoming events default view setting, on desktop and mobile. If you set that to Month, phones get Month instead of Week.

3. “Hide topic list”: Can you elaborate on why it’s redundant? I lean toward keeping it for maximum flexibility.

Take these for a spin and let me know what you think!

2 לייקים

That is pretty sweet! Works beautifully. Love how subtle the show/hide calendar is - and the mobile experience is very good now.

I like the sidebar too, but I don’t think it works that well with the topic list next to it as they are both showing the same thing. And it doesn’t do anything on mobile, which is about 1/2 of our users’ interaction with our site.

It is redundant as we can now do this by the filter instead due to the recent addition of Event filters (at my suggestion :flexed_biceps:) to core.

But that is a very recent core change, so it is probably better to leave that setting in now I think about it.

And yet there is more…

Wouldn’t you know it? A couple more potential tweaks (I think these will be the last):

Hide (part of) the navbar?

I find that on the Events list, most of the navbar isn’t very helpful:

The category / tag filters don’t work as filters here, and Latest/New/Hot/etc take you to the full site list - which is also unhelpful. On desktop they don’t waste much space so I didn’t really notice this, but it is quite noticable on Mobile:

The New Event button and Custom Lists dropdown are definitely helpful though, and should definitely be retained.

If the unhelpful bits are hidden, care will need to be taken (on mobile especially) that the New Event button and the Show/Hide calendar aren’t too close together. Maybe the Show/Hide calendar would be better on the left?

Click on calendar could open a New Event composer

This one is very much icing on the cake.

I only just learned that the ability to open a new topic with an event in it already exists in the Events plugin - you just have to click on a blank on the day / week / month calendar in either /upcoming-events or an Events category. The destination can also be configured:

This was invisible to me as I used the Year view previously, and I only just stumbled across it when looking for that setting you hooked into.

Do you think that could be incorporated?

Also the setting which governs the destination of the event topic could be removed (and the Events plugin setting used instead).

Also great ideas :slight_smile:

  • The category, tags, and latest/new/hot filters have been hidden.
    • Shifted the show/hide calendar so it’s in line with the New Event and Custom List dropdown, since the space was available. I thought it looked better next to the New Topic button, but I’m 50/50 on it. I could be convinced to align it left.
  • This now uses the native calendar handler, so clicking into the calendar opens a new event topic for that day :+1:
לייק 1