Skip to content

[#69073] Rework template selector on Project create form#20986

Merged
dombesz merged 20 commits into
devfrom
feature/68856-new-project-template-selector
Nov 18, 2025
Merged

[#69073] Rework template selector on Project create form#20986
dombesz merged 20 commits into
devfrom
feature/68856-new-project-template-selector

Conversation

@myabc
Copy link
Copy Markdown
Contributor

@myabc myabc commented Nov 10, 2025

Ticket

https://community.openproject.org/wp/69073

What are you trying to accomplish?

This PR reworks the Template Select Component to replace the project autocompleter with an "advanced radio button group", introducing new form components with icon support for better visual presentation.

In detail:

  • Introduces new AdvancedRadioButtonGroup and AdvancedCheckBoxGroup form components with icon and caption support.
  • Replaces autocompleter-based template selection with a visual radio button grid layout
  • Adds SVG assets for blank and agile project templates
  • Introduces line-clamp-n utility classes for vertically truncating text.

Related PRs (both WIP)

Screenshots

image

What approach did you choose and why?

Please also see the ticket for some of the choices (e.g. colours) made while working on this implementation.

Even though it's not yet needed, I implemented AdvancedCheckBoxGroup for symmetry. We also use use the Primer Forms (input methods) API rather than plain view components, since the radio button group will usually be used in a Forms context.

The implementation tries to do as much as possible in plain CSS - thanks to :hover and :checked pseudo-classes, has() and the like, there was no need for additional JavaScript.

I've added Inline SVG as a dependency. I wasn't sure how we want to handle icons - at a minimum we probably want to be able to display existing Octicons and custom SVGs.

What's currently missing from this PR

  • custom icon support (e.g. via upload, see [#69068] Add support for Project template icons #21035)
  • Validation specs: a number of the specs for AdvancedRadioButtonGroup and AdvancedCheckBoxGroup were copied from the PVC repo and and adapted for RSpec. However, I didn't port over the validation specs.
  • Special validation styling: while we do show the standard validation error captions for the form groups, there is no additional styling - for example, a red border around the currenlty checked option might make sense.
  • Lookbook previews
  • Component API docs

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

Comment thread app/components/projects/template_select_component.html.erb Fixed
@myabc myabc force-pushed the feature/68856-new-project-template-selector branch 3 times, most recently from 425db25 to b3d1ecf Compare November 11, 2025 19:14
Comment thread app/components/projects/template_select_component.html.erb Fixed
@myabc myabc force-pushed the feature/68856-new-project-template-selector branch 2 times, most recently from 27b9687 to 26ccd61 Compare November 14, 2025 14:01
@myabc myabc changed the title [#68856] Rework Template Select Component [WIP] [#69073] Rework Template Select Component Nov 14, 2025
@myabc myabc requested a review from Copilot November 14, 2025 14:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR reworks the Template Select Component to replace the project autocompleter with an advanced radio button group, introducing new form components with icon support for better visual presentation.

  • Introduces new AdvancedRadioButtonGroup and AdvancedCheckBoxGroup form components with icon and caption support
  • Replaces autocompleter-based template selection with a visual radio button grid layout
  • Adds SVG assets for blank and agile project templates

Reviewed Changes

Copilot reviewed 21 out of 24 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
lib/primer/open_project/forms/dsl/input_methods.rb Adds DSL methods for advanced radio button and checkbox groups
lib/primer/open_project/forms/dsl/advanced_radio_button_input.rb Implements input DSL class for individual advanced radio buttons with icon support
lib/primer/open_project/forms/dsl/advanced_radio_button_group_input.rb Implements input DSL class for grouping advanced radio buttons
lib/primer/open_project/forms/dsl/advanced_check_box_input.rb Implements input DSL class for individual advanced checkboxes with icon and scheme support
lib/primer/open_project/forms/dsl/advanced_check_box_group_input.rb Implements input DSL class for grouping advanced checkboxes
lib/primer/open_project/forms/advanced_radio_button.rb ViewComponent for rendering individual advanced radio buttons
lib/primer/open_project/forms/advanced_radio_button.html.erb Template for advanced radio button with icon and caption rendering
lib/primer/open_project/forms/advanced_radio_button_group.rb ViewComponent for rendering advanced radio button groups
lib/primer/open_project/forms/advanced_radio_button_group.html.erb Template for advanced radio button group fieldset
lib/primer/open_project/forms/advanced_check_box.rb ViewComponent for rendering individual advanced checkboxes
lib/primer/open_project/forms/advanced_check_box.html.erb Template for advanced checkbox with icon and caption rendering (contains bug)
lib/primer/open_project/forms/advanced_check_box_group.rb ViewComponent for rendering advanced checkbox groups
lib/primer/open_project/forms/advanced_check_box_group.html.erb Template for advanced checkbox group fieldset
frontend/src/global_styles/openproject/_forms.sass Adds styling for advanced form controls with grid layout and visual states
app/components/projects/template_select_component.rb Adds available_templates method to fetch templated projects
app/components/projects/template_select_component.html.erb Replaces autocompleter with advanced radio button group for template selection
app/assets/images/templates/blank_project.svg SVG icon for blank project template
app/assets/images/templates/agile_project.svg SVG icon for agile project template
spec/lib/primer/open_project/forms/dsl/input_methods_spec.rb Adds tests for new DSL methods
spec/lib/primer/open_project/forms/advanced_radio_button_group_spec.rb Basic test for advanced radio button group rendering
spec/lib/primer/open_project/forms/advanced_check_box_group_spec.rb Basic test for advanced checkbox group rendering
spec/components/projects/template_select_component_spec.rb Marks test as pending (xit) without explanation
Gemfile Adds inline_svg gem dependency for SVG rendering
Gemfile.lock Updates with inline_svg gem and checksums
Comments suppressed due to low confidence (1)

spec/components/projects/template_select_component_spec.rb:49

  • The test has been marked as pending with xit, but there's no explanation or TODO comment indicating why this test is skipped or when it should be re-enabled. Either remove this test if it's no longer relevant, or add a comment explaining why it's skipped and what needs to be done to fix it.
  xit "connects Stimulus controller actions" do
    expect(render_component).to have_element "opce-project-autocompleter", "data-input-name": "\"template_id\"" do |element|
      expect(element["data-action"]).to include "change->auto-submit#submit"
    end
  end

Comment thread app/components/projects/template_select_component.html.erb Outdated
Comment thread app/components/projects/template_select_component.rb Outdated
Comment thread lib/primer/open_project/forms/advanced_check_box.html.erb Outdated
Comment thread app/components/projects/template_select_component.html.erb Outdated
Comment thread app/components/projects/template_select_component.html.erb Outdated
@myabc myabc force-pushed the feature/68856-new-project-template-selector branch 2 times, most recently from 321ecf4 to c6c6c59 Compare November 15, 2025 15:35
@myabc myabc requested a review from Copilot November 15, 2025 15:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 27 out of 30 changed files in this pull request and generated no new comments.

@myabc myabc force-pushed the feature/68856-new-project-template-selector branch from c6c6c59 to b9e77d8 Compare November 15, 2025 23:05
@myabc myabc requested a review from Copilot November 15, 2025 23:09
Comment thread app/forms/projects/template_select_form.rb Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 29 out of 32 changed files in this pull request and generated 2 comments.

Comment thread app/components/projects/template_select_component.html.erb Outdated
Comment thread app/forms/projects/template_select_form.rb
Comment thread spec/forms/projects/template_select_form_spec.rb Outdated
Comment thread lib/primer/open_project/forms/advanced_radio_button.html.erb
@myabc myabc force-pushed the feature/68856-new-project-template-selector branch from b9e77d8 to 4050545 Compare November 16, 2025 00:54
@myabc myabc changed the title [#69073] Rework Template Select Component [#69073] Rework template selector on Project create form Nov 16, 2025
)

* Initial plan

* Remove redundant name parameter from radio_button calls in spec

Co-authored-by: myabc <755+myabc@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: myabc <755+myabc@users.noreply.github.com>
@myabc myabc marked this pull request as ready for review November 17, 2025 04:28
@dombesz dombesz requested review from a team and dombesz November 17, 2025 14:14
@myabc myabc added this to the 17.0.x milestone Nov 17, 2025
Copy link
Copy Markdown
Contributor

@HDinger HDinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will review the styling questions with the product team shortly.

Regarding the code, I think the biggest questions come from the icon. I don't like the technical implementation of it, and I am also not sure, whether this is really better than having no icon. I will clarify that as well.

Regarding the components, I am missing some docs in the lookbook, but that can be done separately.

Comment thread app/assets/images/templates/agile_project.svg Outdated
Comment thread app/forms/projects/template_select_form.rb Outdated
Comment thread frontend/src/global_styles/openproject/_forms.sass Outdated
Comment thread lib/primer/open_project/forms/advanced_radio_button.html.erb
Comment thread Gemfile
@HDinger
Copy link
Copy Markdown
Contributor

HDinger commented Nov 18, 2025

Regarding the code, I think the biggest questions come from the icon. I don't like the technical implementation of it, and I am also not sure, whether this is really better than having no icon. I will clarify that as well.

I removed the icons from the template selector but left the image support in the component itself as I assume it is the pre-work for supporting custom images later on. That we will not be abe to achieve with Octicons unfortunately.

Copy link
Copy Markdown
Contributor

@HDinger HDinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine from my side 👍

Copy link
Copy Markdown
Contributor

@dombesz dombesz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied a few tweaks, such as changing the template selector label and description for programs and portfolios, plus address the outstanding cr comments. LGTM!👍

@dombesz dombesz merged commit d090e68 into dev Nov 18, 2025
18 of 20 checks passed
@dombesz dombesz deleted the feature/68856-new-project-template-selector branch November 18, 2025 11:51
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

feature needs review ruby Pull requests that update Ruby code styling

Development

Successfully merging this pull request may close these issues.

8 participants