roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Redesigned plan-creation page to enforce template access rules and simplify UI

Open johnpinto1 opened this issue 2 months ago • 8 comments

Redesigned plan-creation page to enforce template access rules and simplify UI #3534 Co-authored-by: don-stuckey [email protected]

This feature was contributed to DMPonline by @don-stuckey.

Changes:

  • Complete re-write of 'Create a new plan' view app/views/plans/new.html.erb.
  • The Plans controller app/controllers/plans_controller.rb has be greatly simplified to get three types og templates for selection in view: The global templates, the user's org templates and the funder templates available.
  • The seeds.rb file has been updated to include templates for the three groups.
  • The tests has been updated.

New Create a new plan page Selection_142

Screenshot when running RSpec test in spec/features/plans_spec.rb screenshot1

johnpinto1 avatar Oct 27 '25 15:10 johnpinto1

I just wanted to point out the fun coincidence that I'm also working on a similar redesign for the templates dropdown in DMP Assistant. This is the PR if you're curious, and here's what it looks like right now.

Screencast from 2025-10-28 11-16-28.webm

For more details about our approach, we initially edited template_options_controller.rb to organize the templates appropriately in this PR. Then, in the PR I tagged above, we're editing the styling of the dropdown (with the new order) to include headers and a "Show more templates" button due to how many funder templates we have publicly available. We're only editing code in template_options_controller.rb and app/javascript/src/plans/new.js, so it is a bit of a simpler implementation.

If you want, I'm interested on collaborating on this if you want to match our approach.

momo3404 avatar Oct 28 '25 19:10 momo3404

@aaronskiba @momo3404 Just saw your 2 comments. Our version is live and working as per our requirements and @don-stuckey did a lot of work on this. Maybe we can work out a way that we can chose which feature to use in config? Worth discussing and finding a solution we can go forward with for other features.

johnpinto1 avatar Oct 29 '25 10:10 johnpinto1

@aaronskiba @momo3404 Just saw your 2 comments. Our version is live and working as per our requirements and @don-stuckey did a lot of work on this. Maybe we can work out a way that we can chose which feature to use in config? Worth discussing and finding a solution we can go forward with for other features.

Sounds good. This PR enforces the org selection to user.org, which is something we'll need at some point (maybe we should add a PR for the feature flags in the near future too?). @momo3404's PR maintains the current template options logic via template_options_controller.rb, which I think this PR would benefit from.

aaronskiba avatar Oct 29 '25 15:10 aaronskiba

@aaronskiba @momo3404 Just saw your 2 comments. Our version is live and working as per our requirements and @don-stuckey did a lot of work on this. Maybe we can work out a way that we can chose which feature to use in config? Worth discussing and finding a solution we can go forward with for other features.

Sounds good. This PR enforces the org selection to user.org, which is something we'll need at some point (maybe we should add a PR for the feature flags in the near future too?). @momo3404's PR maintains the current template options logic via template_options_controller.rb, which I think this PR would benefit from.

I will fix this on Monday or after meeting.

johnpinto1 avatar Oct 30 '25 18:10 johnpinto1

@aaronskiba @momo3404 Updated the code with @martaribeiro and @gjacob24 fixes mentioned in last roadmap meeting. BTW I will be missing the next Roadmap meeting as we are on strike on Nov 17-19.

johnpinto1 avatar Nov 07 '25 14:11 johnpinto1

@aaronskiba I think your suggestion on chat for server side validation is a good idea. Will sort that soon.

johnpinto1 avatar Nov 14 '25 11:11 johnpinto1

There’s substantial work here. Regarding the update/removal of the org-selection logic in the “create plan” form, I recognize the need for these changes in DMP Online. This creates a divergence between DMP Online and DMP Assistant that we’ll need to accommodate.

My main hesitation is around the template-selection changes. The new implementation replaces the existing TemplateOptionsController, which introduces a larger split in how the two applications handle this area. Since the underlying template-selection requirements still seem quite similar, keeping the shared logic aligned would be preferable. I’m concerned that merging this approach could make that more difficult going forward.

If you'd like, I could point a new PR at this one that attempts to refactor these changes so that the TemplateOptionsController logic is still utilised.

aaronskiba avatar Nov 25 '25 20:11 aaronskiba

There’s substantial work here. Regarding the update/removal of the org-selection logic in the “create plan” form, I recognize the need for these changes in DMP Online. This creates a divergence between DMP Online and DMP Assistant that we’ll need to accommodate.

My main hesitation is around the template-selection changes. The new implementation replaces the existing TemplateOptionsController, which introduces a larger split in how the two applications handle this area. Since the underlying template-selection requirements still seem quite similar, keeping the shared logic aligned would be preferable. I’m concerned that merging this approach could make that more difficult going forward.

if you'd like, I could point a new PR at this one that attempts to refactor these changes so that the TemplateOptionsController logic is still utilised.

Agree, I think we should resolve this problem as you suggest with a new PR.

johnpinto1 avatar Nov 26 '25 09:11 johnpinto1