Skip to content

Add event templates (#4259) - #4453

Open
amaierhofer wants to merge 1 commit into
masterfrom
feature/4259-event-templates
Open

amaierhofer wants to merge 1 commit into
masterfrom
feature/4259-event-templates

Conversation

@amaierhofer

@amaierhofer amaierhofer commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Layer-scoped, event-type-specific event templates: a template is a normal Event flagged with template: true
(and inherit: true to make it usable from layers below), excluded from all default event queries via a
default_scope, mirroring the existing Event::QuestionTemplate pattern. Users create a new event either from
scratch or by picking an applicable template from the new-event dropdown, and can save an existing event as a
template from its show page. Template management (create/edit/destroy) is restricted to the :admin permission
via Event::TemplatesController and a shared controller-level guard (EventsController#assert_template_admin),
chosen over an ability-DSL patch since wagons define their own custom Event ability constraints that wouldn't have
picked it up.

Also fixes several related bugs surfaced while building this:

  • Event#new was appending default question templates on top of a duplicated source's own questions.
  • Event#duplicate did not reset template/inherit, so instantiating an event from a template (or saving one
    as a template) could silently carry the wrong flag.
  • list_entries in Event::TemplatesController overrode ListController's default implementation and silently
    bypassed Sortable's automatic sort wrapping, so sorting the templates list did nothing.
  • The "Typ" column now sorts by the translated model name instead of the raw (and for the base Event, nil)
    type column value.

Fixes hitobito/hitobito_jubla#292

@amaierhofer amaierhofer linked an issue Sep 1, 2026 that may be closed by this pull request
12 tasks
@amaierhofer
amaierhofer force-pushed the feature/4259-event-templates branch 2 times, most recently from 06d259a to 26a64b3 Compare September 1, 2026 15:22
Layer-scoped, event-type-specific event templates: a template is a
normal Event flagged with template: true (and inherit: true to make
it usable from layers below), excluded from all default event
queries via a default_scope, mirroring the existing
Event::QuestionTemplate pattern. Users create a new event either from
scratch or by picking an applicable template from the new-event
dropdown, and can save an existing event as a template from its show
page. Template management (create/edit/destroy) is restricted to the
:admin permission via Event::TemplatesController and a shared
controller-level guard (EventsController#assert_template_admin),
chosen over an ability-DSL patch since wagons define their own custom
Event ability constraints that wouldn't have picked it up.

Also fixes several related bugs surfaced while building this:
Event#new was appending default question templates on top of a
duplicated source's own questions; Event#duplicate did not reset
template/inherit, so instantiating an event from a template (or
saving one as a template) could silently carry the wrong flag;
list_entries in Event::TemplatesController overrode ListController's
default implementation and silently bypassed Sortable's automatic
sort wrapping, so sorting the templates list did nothing; and the
"Typ" column now sorts by the translated model name instead of the
raw (and for the base Event, nil) type column value.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@amaierhofer
amaierhofer force-pushed the feature/4259-event-templates branch from 26a64b3 to 3e1a81e Compare September 11, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EVENT: Eventvorlagen KURSE: Doppelte Anmeldeangaben beim Duplizieren

1 participant