-
Couldn't load subscription status.
- Fork 118
Redesigned plan-creation page to enforce template access rules and simplify UI #3580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
908c3e8 to
000c04a
Compare
…mplify UI [#3534](#3534) Co-authored-by: don-stuckey dstuckey@ed.ac.uk 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.
000c04a to
b48244f
Compare
| # get funder templates | ||
| funder_templates = Template.published | ||
| .joins(:org) | ||
| .merge(Org.funder) | ||
| .distinct | ||
|
|
||
| # get global templates | ||
| global_templates = Template.published | ||
| .where(is_default: true) | ||
| .distinct | ||
|
|
||
| # get templates of user's org | ||
| user_org_templates = Template.published | ||
| .where(org: current_user.org) | ||
| .distinct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm comparing this simplified logic with what we were previously using (https://github.com/DMPRoadmap/roadmap/blob/main/app/controllers/template_options_controller.rb).
One thing I am concerned about with this new logic is the same template being listed in two, or all three sections. For example, what if Org.funder has a default template (which is the case with DMP Assistant). Then that same template is listed in both funder_templates and global_templates. And if user.org == Org.funder (again the case with DMP Assistant), then funder_templates and user_org_templates will have identical lists.
TemplateOptionsController also performed special handling for template customisations. Specifically, if an org had a customisation of the most recent version of a funder_template, then only that customisation would appear as an template option. With this logic, it looks like the most recent customisation will appear in user_org_templates, but the non-customised version of it will also be listed as an option in funder_templates.
| </legend> | ||
| <div class="row form-row"> | ||
| <div class="col-12"> | ||
| <% @templates_grouped.each do |group_label, group_templates| %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the label grouping. Maybe we should also be ordering the templates by title?
Redesigned plan-creation page to enforce template access rules and simplify UI #3534
Co-authored-by: don-stuckey dstuckey@ed.ac.uk
This feature was contributed to DMPonline by @don-stuckey.
Changes:
New Create a new plan page

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