Skip to content

Commit 929b661

Browse files
author
John Pinto
committed
Issue #3555 - Added feature for Org admins can show/hide the
Ethical_Issues fragment in plans project details page. Co-authored-by: don-stuckey <[email protected]> This feature was contributed to DMPonline by @don-stuckey. Changes: - These changes only kick in if enable_ethical_issues is enable in the application config. - Added to Org model attribute in a migration add_ro_ethical_concerns :boolean default(true), not null - Added a checkbox 'Add "Research outputs may have ethical concerns" field to "Project details" tab in plans' to app/views/orgs/_profile_form.html.erb. - Added code to the Plan Project Details view to show or hide the Ethical Issues fragment. - Added :add_ro_ethical_concerns to the strong params org_params for the Org controller.
1 parent f7bcd33 commit 929b661

File tree

7 files changed

+53
-2
lines changed

7 files changed

+53
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
- Feature for Org admins can show/hide the ethical_issues field on plans [#3555](https://github.com/DMPRoadmap/roadmap/pull/3555).
4+
35
## v5.0.2
46
- Bump Ruby to v3.1.4 and use `.ruby-version` in CI
57
- [#3566](https://github.com/DMPRoadmap/roadmap/pull/3566)

app/controllers/orgs_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def org_params
222222
.permit(:name, :abbreviation, :logo, :contact_email, :contact_name,
223223
:remove_logo, :managed, :feedback_enabled, :org_links,
224224
:funder, :institution, :organisation,
225+
:add_ro_ethical_concerns,
225226
:feedback_msg, :org_id, :org_name, :org_crosswalk,
226227
:helpdesk_email,
227228
identifiers_attributes: %i[identifier_scheme_id value],

app/models/org.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# region_id :integer
2626
# managed :boolean default(false), not null
2727
# helpdesk_email :string
28+
# add_ro_ethical_concerns :boolean default(true), not null
2829
#
2930
# Foreign Keys
3031
#

app/views/orgs/_profile_form.html.erb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,37 @@
180180
</div>
181181
<% end %>
182182
</div>
183+
<hr>
184+
<%# Organisation Permissions block where super admin can add:
185+
"Project details" tab in a plan
186+
%>
187+
188+
<% org_perms_header_block = capture do %>
189+
<h3>
190+
<%= _('Organisation Permissions') %>
191+
</h3>
192+
<% end %>
193+
194+
<% add_ro_ethical_concerns_block = capture do %>
195+
<div class="checkbox">
196+
<%= f.label :add_ro_ethical_concerns do %>
197+
<%= f.check_box :add_ro_ethical_concerns, { class: 'org_types', value: org.add_ro_ethical_concerns? }, "true", "false" %>
198+
<%= _('Add "Research outputs may have ethical concerns" field to "Project details" tab in plans') %>
199+
<% end %>
200+
</div>
201+
<% end %>
183202

203+
<div class="row">
204+
<% if current_user.can_super_admin? %>
205+
<fieldset class="col-sm-8">
206+
<%= org_perms_header_block %>
207+
<%= add_ro_ethical_concerns_block %>
208+
</fieldset>
209+
<% elsif current_user.can_org_admin? %>
210+
<%= org_perms_header_block %>
211+
<%= add_ro_ethical_concerns_block %>
212+
<% end %>
213+
</div>
184214
<hr>
185215

186216
<% if !org.new_record? %>

app/views/plans/_project_details.html.erb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ ethics_report_tooltip = _("Link to a protocol from a meeting with an ethics comm
102102
</div>
103103
<% end %>
104104

105-
<% if Rails.configuration.x.madmp.enable_ethical_issues %>
105+
<% ethical_issues_block = capture do %>
106106
<conditional>
107107
<div class="form-control mb-3">
108108
<div class="col-lg-8">
@@ -143,6 +143,16 @@ ethics_report_tooltip = _("Link to a protocol from a meeting with an ethics comm
143143
</conditional>
144144
<% end %>
145145

146+
<% if Rails.configuration.x.madmp.enable_ethical_issues %>
147+
<% if plan.ethical_issues == true %>
148+
<%= ethical_issues_block %>
149+
<% else %>
150+
<% if current_user.org.add_ro_ethical_concerns? %>
151+
<%= ethical_issues_block %>
152+
<% end %>
153+
<% end %>
154+
<% end %>
155+
146156
<conditional>
147157
<div id="funder-org-controls" class="form-control mb-3">
148158
<div class="col-lg-8">
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class AddAddRoEthicalConcernsToOrgs < ActiveRecord::Migration[6.1]
2+
def change
3+
add_column :orgs, :add_ro_ethical_concerns, :boolean, default: true, null: false
4+
Org.update_all(add_ro_ethical_concerns: true)
5+
end
6+
end

db/schema.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.1].define(version: 2025_01_15_102816) do
13+
ActiveRecord::Schema[7.1].define(version: 2025_10_16_134521) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "plpgsql"
1616

@@ -276,6 +276,7 @@
276276
t.string "api_create_plan_email_subject"
277277
t.text "api_create_plan_email_body"
278278
t.string "helpdesk_email"
279+
t.boolean "add_ro_ethical_concerns", default: true, null: false
279280
t.index ["language_id"], name: "fk_rails_5640112cab"
280281
t.index ["region_id"], name: "fk_rails_5a6adf6bab"
281282
end

0 commit comments

Comments
 (0)