Add event templates (#4259) - #4453
Open
amaierhofer wants to merge 1 commit into
Open
amaierhofer wants to merge 1 commit into
amaierhofer wants to merge 1 commit into
Conversation
12 tasks
amaierhofer
force-pushed
the
feature/4259-event-templates
branch
2 times, most recently
from
September 1, 2026 15:22
06d259a to
26a64b3
Compare
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
force-pushed
the
feature/4259-event-templates
branch
from
September 11, 2026 08:52
26a64b3 to
3e1a81e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layer-scoped, event-type-specific event templates: a template is a normal
Eventflagged withtemplate: true(and
inherit: trueto make it usable from layers below), excluded from all default event queries via adefault_scope, mirroring the existingEvent::QuestionTemplatepattern. Users create a new event either fromscratch 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
:adminpermissionvia
Event::TemplatesControllerand 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#newwas appending default question templates on top of a duplicated source's own questions.Event#duplicatedid not resettemplate/inherit, so instantiating an event from a template (or saving oneas a template) could silently carry the wrong flag.
list_entriesinEvent::TemplatesControlleroverrodeListController's default implementation and silentlybypassed
Sortable's automatic sort wrapping, so sorting the templates list did nothing.Event,nil)typecolumn value.Fixes hitobito/hitobito_jubla#292