CDLUC3 / dmptool

DMPTool version of the DMPRoadmap codebase
https://dmptool.org
MIT License
57 stars 13 forks source link

Add a new 'Preferences' tab to the Template admin page #441

Closed briri closed 1 year ago

briri commented 1 year ago

Add a new 'Preferences' tab to the page that organizational admins use when editing their own templates or when customizing a funder's template.

The change will need to be made to the template navigation partial.

terrywbrady commented 1 year ago

I have created new text fields for the Research Outputs Guidance. Note that I currently have tinymce enabled.

image

Where should this guidance appear?

If the guidance is to appear as a tooltip, I think the guidance needs to be plain text (no links, lists, tables).

image

Note that I have created the following fields in my PR:

mariapraetzellis commented 1 year ago

@terrywbrady This should function as a tooltip and appear just to the right of the field.

terrywbrady commented 1 year ago

Thanks @mariapraetzellis . For the Output Type, should the tooltip go on each field or just on the select box?

image image image
terrywbrady commented 1 year ago

Other Tooltip Placement Questions

To start the conversation, I have inserted the tooltip on the page. I am not confident that it is in the correct place.

image image image
terrywbrady commented 1 year ago

Terry and Maria discussed tooltip placement. New issues/tickets have been created.

mariapraetzellis commented 1 year ago

@terrywbrady The Preferences tab should also be available for administrators who customize funder templates they did not create. For example, in this case, I am logged into the tool as a UCOP administrator and want to add customizations to this template: Department of Energy (DOE): Office of Science.

Screen Shot 2023-04-11 at 2 25 54 PM
mariapraetzellis commented 1 year ago

I tested and confirmed that the following features are working as expected:

Small change: can you fix the success message that appears when adding a Research Output? It currently reads: "Successfully added the researchoutput" and just needs to be split into two words "research output".

terrywbrady commented 1 year ago

@briri , what permission check would I need to make to enable the tab as Maria requested?

I am currently checking template_modifiable

  <% if template_modifiable?(template) %>
    <li role="presentation" <%= active_page?(new_org_admin_template_phase_path(template.id)) ? ' class=active' : '' %>>
      <%= link_to(_('Add new phase'), new_org_admin_template_phase_path(template.id), { 'aria-controls': 'add_phase', role: 'tab' }) %>
    </li>
    <li role="presentation" <%= active_page?(preferences_org_admin_template_path(template.id)) ? ' class=active' : '' %>>
      <%= link_to(_('Preferences'), preferences_org_admin_template_path(template.id), { 'aria-controls': 'preferences', role: 'tab' }) %>
    </li>
  <% end %>
terrywbrady commented 1 year ago

Adding:

  def obj_name_for_display(obj)
    display_name = {
      ...
      ResearchOutput: _('Research Output'),
    }
briri commented 1 year ago

@terrywbrady, that template_modifiable? is preventing the preferences tab from appearing when the admin is trying to customize a template. You should probably use template.latest? && template.id.present? && template.org_id = current_user.org.id instead. This will just prevent it from appearing for historical versions and if the user is somehow viewing a template/customization that they do not own.

@mariapraetzellis I'm not sure if we've thought through this or not but, should an admin who is customizing a template be able to modify the preferences set by a funder admin? For example, if you set preferences for the FDP template, should an admin from Berkeley be able to add their own repositories, licenses, etc. or remove preferences you have defined?

terrywbrady commented 1 year ago

@briri , I added this change https://github.com/CDLUC3/dmptool/commit/0807decf324203dabf4a4768ffc2ddb565eed830

Question, if you look at my policy rules, and I checking all of the right permissions or do these rules need to be stricter?

https://github.com/CDLUC3/dmptool/blob/tbstart5/app/policies/template_policy.rb#L12-L26

briri commented 1 year ago

Yes, those are the correct permissions @terrywbrady