Skip to content

Make file templates easy to use and discover

This MR makes file template selectors be displayed for all new files created, and when editing a file for which templates exist. It also adds a "Template type selector" and the ability to Undo applying a template.

Creating a new file:

2017-03-30_12.32.30

Editing a file:

2017-03-30_12.33.55

A note to FE reviewers:

Previously, the TemplateSelector class was extended for each template type and responsible for managing state for the entire page. This MR moved much of that coordination logic to the FileTemplateMediator and reduced the responsibility of individual template selectors (FileTemplateSelector) to 1) initializing dropdowns and 2) exposing methods for the mediator to manage their UI state.

Using Jquery and plain JS classes to manage the UI state here will become increasingly difficult. IMO the UI is already complex enough to justify refactoring the entire file editor to use Vue components. I think it will be especially necessary for additional features to be added. I opted not to do that now so we could fit this into the coming release, and because most of the logic required for this feature already existed in the code. I opened https://gitlab.com/gitlab-org/gitlab-ce/issues/30192 to address this. cc: @alfredo1

Closes #25332 (closed)

Merge request reports