Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
db783fc
Issue#dcc2983 - Fix for preventing adding a Contributor via Contributor
Nov 23, 2021
2c00cde
Issue#3069 - (DCC Issue 675) - Org Admin and Super Admin searches and
Dec 23, 2021
1173d60
Bug DCC Issues 592, 645 - Fix for Org Admins seeing deleted Plans for…
Jan 11, 2022
b2cded7
Issue DCC-674: Fix for broken CSV Download noticed because a nil
Jan 10, 2022
d5144d9
DCC Issue 679 - Fix for issue that Super Admins unable to create new
Jan 13, 2022
7eb7398
Merge branch 'development' into bug_DCC2983-possible_to_add_contribut…
briri Jan 31, 2022
412868d
Merge branch 'development' into bug_dcc_592_and_645_deleted-private_p…
briri Jan 31, 2022
aa56797
Merge branch 'development' into bug-dcc-679-super-admins-unable-to-ad…
briri Jan 31, 2022
b419b18
DCC Issue 679 - Fix for issue that Super Admins unable to create new
Jan 13, 2022
fc6fcaa
Merge branch 'bug-dcc-679-super-admins-unable-to-add-new-organisation…
raycarrick-ed Feb 1, 2022
7e0f2e2
debugging
raycarrick-ed Feb 1, 2022
ce35995
undo debug - now working
raycarrick-ed Feb 1, 2022
60a88be
debugging failure
raycarrick-ed Feb 1, 2022
1be3a60
once more to debug
raycarrick-ed Feb 1, 2022
e2c4914
Remove prg has to have abbrev test
raycarrick-ed Feb 1, 2022
a053f9f
Merge pull request #3091 from DMPRoadmap/bug-dcc-679-super-admins-una…
raycarrick-ed Feb 1, 2022
1edafec
Bug DCC Issues 592, 645 - Fix for Org Admins seeing deleted Plans for…
Jan 11, 2022
a499b25
Merge branch 'bug_dcc_592_and_645_deleted-private_plans_visible_to_or…
raycarrick-ed Feb 1, 2022
7d9bd57
needs active role for org_admin_plans to work
raycarrick-ed Feb 1, 2022
001e52a
Merge pull request #3087 from DMPRoadmap/bug_dcc_592_and_645_deleted-…
raycarrick-ed Feb 1, 2022
230aa8d
fix merge conflict
raycarrick-ed Feb 1, 2022
b076ae6
Merge branch 'bug_dcc_674_csv_download_plans_fails_for_admins' of git…
raycarrick-ed Feb 1, 2022
6bcc6a2
rubocop fixes
raycarrick-ed Feb 1, 2022
08e862c
Merge pull request #3085 from DMPRoadmap/bug_dcc_674_csv_download_pla…
raycarrick-ed Feb 1, 2022
61e6d19
Issue#3069 - (DCC Issue 675) - Org Admin and Super Admin searches and
Dec 23, 2021
30d55ec
merge clashes
raycarrick-ed Feb 2, 2022
1c3b679
bad indenting and missing end
raycarrick-ed Feb 2, 2022
fb19b91
rubocop clean up
raycarrick-ed Feb 2, 2022
bcfec24
Merge pull request #3082 from DMPRoadmap/bug_3069_and_dcc_675_paged_r…
raycarrick-ed Feb 2, 2022
35fa595
Issue#dcc2983 - Fix for preventing adding a Contributor via Contributor
Nov 23, 2021
f236ce3
Merge branch 'bug_DCC2983-possible_to_add_contributor_without_a_name'…
raycarrick-ed Feb 2, 2022
d0f301b
clean up name_or_email_presence
raycarrick-ed Feb 2, 2022
b382292
Typo
raycarrick-ed Feb 2, 2022
f4920cf
rubocop
raycarrick-ed Feb 2, 2022
477b981
more rubcocop stuff
raycarrick-ed Feb 2, 2022
3df80e6
fix errors
raycarrick-ed Feb 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions app/controllers/paginable/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,17 @@ def org_admin
end
# rubocop:enable Metrics/AbcSize

# GET /paginable/plans/org_admin/:page
def org_admin_other_user
# GET /paginable/users/:id/plans
def index
@user = User.find(params[:id])
authorize @user
raise Pundit::NotAuthorizedError unless current_user.present? && current_user.can_org_admin? && @user.present?

paginable_renderise(
partial: 'org_admin_other_user',
partial: 'index',
scope: Plan.active(@user),
query_params: { sort_field: 'plans.updated_at', sort_direction: :desc }
query_params: { sort_field: 'plans.updated_at', sort_direction: :desc },
format: :json
)
end
end
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/super_admin/orgs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def org_params
params.require(:org).permit(:name, :abbreviation, :logo, :managed,
:contact_email, :contact_name,
:remove_logo, :feedback_enabled, :feedback_msg,
:org_id, :org_name, :org_crosswalk)
:org_id, :org_name, :org_crosswalk,
:funder, :institution, :organisation)
end

def merge_params
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/exportable_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def show_section_for_csv(csv, phase, section, headings, unanswered, hash)
answer_text = ''
if answer.present?
answer_text += answer.question_options.pluck(:text).join(', ') if answer.question_options.any?
answer_text += answer.text if answer.answered?
answer_text += answer.text if answer.answered? && answer.text.present?
elsif unanswered
answer_text += _('Not Answered')
end
Expand Down
16 changes: 13 additions & 3 deletions app/models/contributor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,20 @@ def merge(other)

private

# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
def name_or_email_presence
return true unless name.blank? && email.blank?
errors.add(:name, _("can't be blank.")) if name.blank? && Rails.configuration.x.application.require_contributor_name
if email.blank? && Rails.configuration.x.application.require_contributor_email
errors.add(:email,
_("can't be blank."))
end

if name.blank? && email.blank? && errors.size.zero?
errors.add(:name, _("can't be blank if no email is provided."))
errors.add(:email, _("can't be blank if no name is provided."))
end

errors.add(:name, _("can't be blank if no email is provided"))
errors.add(:email, _("can't be blank if no name is provided"))
errors.size.zero?
end
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
end
4 changes: 2 additions & 2 deletions app/models/org.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ class Org < ApplicationRecord
validates :name, presence: { message: PRESENCE_MESSAGE },
uniqueness: { message: UNIQUENESS_MESSAGE }

validates :abbreviation, presence: { message: PRESENCE_MESSAGE }

validates :is_other, inclusion: { in: BOOLEAN_VALUES,
message: PRESENCE_MESSAGE }

Expand Down Expand Up @@ -290,10 +288,12 @@ def org_admin_plans

if Rails.configuration.x.plans.org_admins_read_all
Plan.includes(:template, :phases, :roles, :users).where(id: combined_plan_ids)
.where(roles: { active: true })
else
Plan.includes(:template, :phases, :roles, :users).where(id: combined_plan_ids)
.where.not(visibility: Plan.visibilities[:privately_visible])
.where.not(visibility: Plan.visibilities[:is_test])
.where(roles: { active: true })
end
end
# rubocop:enable Metrics/AbcSize
Expand Down
4 changes: 2 additions & 2 deletions app/views/org_admin/users/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
<div class="row">
<div class="col-md-12">
<%= paginable_renderise(
partial: '/paginable/plans/org_admin_other_user',
partial: '/paginable/plans/index',
controller: 'paginable/plans',
action: 'org_admin_other_user',
action: 'index',
scope: @plans,
query_params: { sort_field: 'plans.updated_at', sort_direction: 'desc' }) %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/org_admin/users/plans.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<div class="row">
<div class="col-md-12">
<%= paginable_renderise(
partial: '/paginable/plans/org_admin_other_user',
partial: '/paginable/plans/index',
controller: 'paginable/plans',
action: 'org_admin_other_user',
action: 'index',
remote: true,
scope: @plans,
query_params: { sort_field: 'plans.updated_at', sort_direction: 'desc' }) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/orgs/_profile_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<div class="row">
<div class="form-group col-xs-8">
<%= f.label :abbreviation, _('Organisation abbreviated name'), class: "control-label" %>
<%= f.text_field :abbreviation, id: "org_abbreviation", class: "form-control", "aria-required": true %>
<%= f.text_field :abbreviation, id: "org_abbreviation", class: "form-control" %>
</div>
</div>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<% end %>
</td>
<td><%= plan.template.title %></td>
<td><%= plan.owner&.org&.name %></td>
<td><%= plan.owner&.name(false) %></td>
<td><%= plan.owner.org.name if plan.owner.present? %></td>
<td><%= plan.owner.name(false) if plan.owner.present? %></td>
<td><%= l(plan.updated_at.to_date, formats: :short) %></td>
<td class="plan-visibility">
<%= plan.visibility === 'is_test' ? _('Test') : sanitize(display_visibility(plan.visibility)) %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/org_selectors/_external_only.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ presenter = OrgSelectionPresenter.new(orgs: [default_org],
placeholder = _("Begin typing to see a list of suggestions.")
%>

<%= form.label :org_name, label %>
<%= form.text_field :org_name, class: "form-control autocomplete",
<%= form.label :name, label %>
<%= form.text_field :name, class: "form-control autocomplete",
placeholder: placeholder,
value: presenter.name,
spellcheck: true,
Expand Down
4 changes: 2 additions & 2 deletions app/views/super_admin/users/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
<div class="row">
<div class="col-md-12">
<%= paginable_renderise(
partial: '/paginable/plans/org_admin_other_user',
partial: '/paginable/plans/index',
controller: 'paginable/plans',
action: 'org_admin_other_user',
action: 'index',
scope: @plans,
query_params: { sort_field: 'plans.updated_at', sort_direction: 'desc' }) %>
</div>
Expand Down
4 changes: 4 additions & 0 deletions config/initializers/_dmproadmap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ class Application < Rails::Application
# Setting to display phone number in contributor form
config.x.application.display_contributor_phone_number = false

# Setting require contributor requirement of contributor name and email
config.x.application.require_contributor_name = false
config.x.application.require_contributor_email = false

# ------------------- #
# SHIBBOLETH SETTINGS #
# ------------------- #
Expand Down
10 changes: 5 additions & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,17 @@

get 'org_admin/:page', action: :org_admin, on: :collection, as: :org_admin

get 'org_admin_other_user/:page', action: :org_admin_other_user,
on: :collection, as: :org_admin_other_user

# Paginable actions for contributors
resources :contributors, only: %i[index] do
get 'index/:page', action: :index, on: :collection, as: :index
end
end

# Paginable actions for users
resources :users, only: [] do
get 'index/:page', action: :index, on: :collection, as: :index
resources :users, only: %i[index] do
member do
resources :plans, only: %(index)
end
end
# Paginable actions for themes
resources :themes, only: [] do
Expand Down
4 changes: 2 additions & 2 deletions spec/models/org_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
.with_message('must be unique')
}

it { is_expected.to validate_presence_of(:abbreviation) }

it { is_expected.to allow_values(true, false).for(:is_other) }

it { is_expected.not_to allow_value(nil).for(:is_other) }
Expand Down Expand Up @@ -401,6 +399,7 @@
@perm = build(:perm)
@perm.name = 'grant_permissions'
user.perms << @perm
plan.add_user!(user.id, :reviewer)
plan.privately_visible!
end

Expand All @@ -413,6 +412,7 @@
@perm = build(:perm)
@perm.name = 'grant_permissions'
user.perms << @perm
plan.add_user!(user.id, :reviewer)
plan.publicly_visible!
end

Expand Down