diff --git a/CHANGELOG.md b/CHANGELOG.md index b5637083df..0d97e39bfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +- Feature for Org admins can show/hide the ethical_issues field on plans [#3555](https://github.com/DMPRoadmap/roadmap/pull/3555). + ## v5.0.2 - Bump Ruby to v3.1.4 and use `.ruby-version` in CI - [#3566](https://github.com/DMPRoadmap/roadmap/pull/3566) diff --git a/app/controllers/orgs_controller.rb b/app/controllers/orgs_controller.rb index ed0e3f78df..256bf4c43b 100644 --- a/app/controllers/orgs_controller.rb +++ b/app/controllers/orgs_controller.rb @@ -222,6 +222,7 @@ def org_params .permit(:name, :abbreviation, :logo, :contact_email, :contact_name, :remove_logo, :managed, :feedback_enabled, :org_links, :funder, :institution, :organisation, + :add_ro_ethical_concerns, :feedback_msg, :org_id, :org_name, :org_crosswalk, :helpdesk_email, identifiers_attributes: %i[identifier_scheme_id value], diff --git a/app/models/org.rb b/app/models/org.rb index 6a6eac55d2..4b96bdf6af 100644 --- a/app/models/org.rb +++ b/app/models/org.rb @@ -25,6 +25,7 @@ # region_id :integer # managed :boolean default(false), not null # helpdesk_email :string +# add_ro_ethical_concerns :boolean default(true), not null # # Foreign Keys # diff --git a/app/views/orgs/_profile_form.html.erb b/app/views/orgs/_profile_form.html.erb index ade41ce1cf..abb6df5d7c 100644 --- a/app/views/orgs/_profile_form.html.erb +++ b/app/views/orgs/_profile_form.html.erb @@ -180,8 +180,35 @@ <% end %> -
+ <%# Organisation Permissions block where super admin can add: + "Project details" tab in a plan + %> + + <% org_perms_header_block = capture do %> +

+ <%= _('Organisation Permissions') %> +

+ <% end %> + + <% add_ro_ethical_concerns_block = capture do %> +
+ <%= f.label :add_ro_ethical_concerns do %> + <%= f.check_box :add_ro_ethical_concerns, { class: 'org_types', value: org.add_ro_ethical_concerns? }, "true", "false" %> + <%= _('Add "Research outputs may have ethical concerns" field to "Project details" tab in plans') %> + <% end %> +
+ <% end %> + + <% if current_user.can_org_admin? %> +
+
+ <%= org_perms_header_block %> + <%= add_ro_ethical_concerns_block %> +
+
+
+ <% end %> <% if !org.new_record? %> <%= render partial: "orgs/external_identifiers", diff --git a/app/views/plans/_project_details.html.erb b/app/views/plans/_project_details.html.erb index 48eada3e92..ef8299e9da 100644 --- a/app/views/plans/_project_details.html.erb +++ b/app/views/plans/_project_details.html.erb @@ -102,7 +102,7 @@ ethics_report_tooltip = _("Link to a protocol from a meeting with an ethics comm <% end %> -<% if Rails.configuration.x.madmp.enable_ethical_issues %> +<% ethical_issues_block = capture do %>
@@ -143,6 +143,16 @@ ethics_report_tooltip = _("Link to a protocol from a meeting with an ethics comm <% end %> +<% if Rails.configuration.x.madmp.enable_ethical_issues %> + <% if plan.ethical_issues == true %> + <%= ethical_issues_block %> + <% else %> + <% if current_user.org.add_ro_ethical_concerns? %> + <%= ethical_issues_block %> + <% end %> + <% end %> +<% end %> +
diff --git a/db/migrate/20251027100520_add_add_ro_ethical_concerns_to_orgs.rb b/db/migrate/20251027100520_add_add_ro_ethical_concerns_to_orgs.rb new file mode 100644 index 0000000000..424e1c021e --- /dev/null +++ b/db/migrate/20251027100520_add_add_ro_ethical_concerns_to_orgs.rb @@ -0,0 +1,6 @@ +class AddAddRoEthicalConcernsToOrgs < ActiveRecord::Migration[7.1] + def change + add_column :orgs, :add_ro_ethical_concerns, :boolean, default: true, null: false + Org.update_all(add_ro_ethical_concerns: true) + end +end diff --git a/db/schema.rb b/db/schema.rb index 3b6036f2bf..2aecbdbe93 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2025_01_15_102816) do +ActiveRecord::Schema[7.1].define(version: 2025_10_27_100520) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -276,6 +276,7 @@ t.string "api_create_plan_email_subject" t.text "api_create_plan_email_body" t.string "helpdesk_email" + t.boolean "add_ro_ethical_concerns", default: true, null: false t.index ["language_id"], name: "fk_rails_5640112cab" t.index ["region_id"], name: "fk_rails_5a6adf6bab" end