Repository navigation
Conversation
| module ProjectSettings | ||
| # NOTE: Wrapping this in a component to get around the issue that the helpers | ||
| # aren't re-evaluated with every request when called from a form. | ||
| class DefaultColumnsComponent < ApplicationComponent |
There was a problem hiding this comment.
This indeed reads strange, but I asume that this is the workaround you mentioned, you want to get rid of?
| }, | ||
| input_width: :medium | ||
| ) | ||
| sf.group( |
There was a problem hiding this comment.
Primer offers so called nested_forms which I think make sense here, as the checkboxes are dependend and should be intended as such. You can have a look here how this is used.
There was a problem hiding this comment.
It's unfortunately only available on checkboxes or radio buttons (see search in repo for instance), not for a select like we have here.
Primer already implicitly wraps the check_box_group into a group behind the scenes. By doing it explicitly in the markup myself, I get control over which attributes are set on the group wrapper. I need that in order to set the hidden attribute for determining the initial state of the component when rendering the HTML on the server.
If I set the hidden attribute on the check_box_group, the same markup is rendered, with the difference, that the hidden attribute is nested too deep: Primer will initially set a d-none class on the outer wrapping container and won't remove it again when the hidden attribute is toggled 🙈
| def initialize(pane:) | ||
| module Admin | ||
| module Settings | ||
| class ColumnSelectionComponent < ApplicationComponent |
There was a problem hiding this comment.
Nice 👍
It would be good to add a small preview in lookbook for this component.
| within "opce-draggable-autocompleter" do | ||
| items = page.all(".op-draggable-autocomplete--item") | ||
| expect(items.map(&:text)).to eq ["Name", "Status", "Identifier"] | ||
| end |
There was a problem hiding this comment.
I guess it makes sense to navigate to the project list and check wether the correct columns are shown
|
|
||
| require "spec_helper" | ||
|
|
||
| RSpec.describe "Work packages general admin settings", :js do |
There was a problem hiding this comment.
Same as in the other test: The check whether the setting actually worked is missing (next to checking whether the page itself shows the correct values). So either you navigate to the WP table and check wehter the settings is applied correctly, or you check the stored setting value
There was a problem hiding this comment.
Here I went with a combination: for the columns, I'm looking at the actual page, for the other settings only in the database to not extend the test too long.
Unfortunately due to the way helper delegation is set up for `ApplicationForm`, I also had to extract separate components for the usage within the project and work package forms…
Instead of delegating the helpers call to ApplicationController, we want to take the view context. Otherwise, any helper call that gets memorized will return the same result for all requests and only change when a new version of the app is deployed. That has effects on e.g. translations.
It's not necessary to have separate components for them any more.
Update specs to also check the effect of the settings changes. For some, the check is done in the database, for some others in the UI.
b347df1 to
6564e90
Compare
| 1. **Allow cross-project work package relations**, i.e. that work packages created in one project can have relations to work packages in another project, for example parent-children work packages. | ||
|
|
||
| 2. **Display subprojects work packages in main projects** by default. This way the work packages of subprojects will always be visible in the main project if a user has the corresponding role in the subproject to see work packages. | ||
| 2. **Display subprojects work packages on main projects** by default. This way the work packages of subprojects will always be visible in the main project if a user has the corresponding role in the subproject to see work packages. |
There was a problem hiding this comment.
I am not 100% sure whether this is correct. I think in might actually be better.
There was a problem hiding this comment.
Yes, I think so too. I'll update the translation 🚜
| module OpenProject | ||
| module Admin | ||
| module Settings | ||
| class ColumnSelectionComponentPreview < ViewComponent::Preview |
There was a problem hiding this comment.
Oh, good catch, thanks 🙇
I just always looked at it through the filtered view 🙈
|
@klappradla there is also a test that seems to fail only here, so it is probably caused by some of the changes although it looks not related to the settings. Maybe it's the helper change |
The mocked call failed because the helper calls now go through the actual view context. So updating the stub to allow calling anything and just add a specific mock for the part the test cares about.
HDinger
left a comment
There was a problem hiding this comment.
Changes look good 👍 Thanks for the effort on this 🙇
Good to merge once the tests are green
There was a problem hiding this comment.
I'm not entirely sure about the size of the image here, but let's merge it. I want to see it on the actual page. If an update is needed, I can take care of it.

Ticket
DREAM-900
What are you trying to accomplish?
This migrates the project and work package settings pages for admins to Primer.
Screenshots
What approach did you choose and why?
I extracted form objects for both forms and a shared component that wraps the AngularJS component for editing columns.
AI involvement
None/Assisted – No AI assistance used OR only autocomplete/pasted snippets. I effectively wrote and understand all the code.
Merge checklist