Project templates are duplicated across backend and frontend

Background

Follow up from the discussion in !88058 (comment 954132433)

Miguel:

@ekigbo thanks for this change! Code-wise LGTM! Do you know if we have any feature specs to prevent this regression in the future?

Ezekiel:

Thanks @mrincon for the quick review, that's a good question, i didnt come across any related tests and i'm not too sure how we'd test this scenario apart from perhaps a feature test that goes through and selects every template on the page 🤔

Interestingly this data is kind of duplicated, its on both the ~backend and frontend and i'm not entirely sure why, so i think a better solution would be to only rely on the backend data and add the frontend key to the data there.

Implementation guide

  • Remove https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/projects/default_project_templates.js
  • Use a data-* attribute to bootstrap the template data from the backend
  • Note: there are some EE only templates too
  • We should udpate the documentation for updating templates to reflect any changes made
Edited Aug 05, 2022 by Ezekiel Kigbo
Assignee Loading
Time tracking Loading