Skip to content

Commit

Permalink
Make Rubocop happy
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronskiba committed Jun 6, 2024
1 parent 70f08fa commit 7f636b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
6 changes: 5 additions & 1 deletion app/controllers/org_admin/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def index

@super_admin = current_user.can_super_admin?
@clicked_through = params[:click_through].present?
@plans = @super_admin ? Plan.all.page(1).includes(:template, roles: { user: :org }) : current_user.org.org_admin_plans.page(1).includes(roles: { user: :org })
@plans = if @super_admin
Plan.all.page(1).includes(:template, roles: { user: :org })
else
current_user.org.org_admin_plans.page(1).includes(roles: { user: :org })
end
end
# rubocop:enable Metrics/AbcSize

Expand Down
16 changes: 4 additions & 12 deletions app/controllers/org_admin/templates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

module OrgAdmin
# Controller that handles templates
# rubocop:disable Metrics/ClassLength
class TemplatesController < ApplicationController
include Paginable
include Versionable
Expand Down Expand Up @@ -37,7 +36,7 @@ def index
# A version of index that displays only templates that belong to the user's org
# GET /org_admin/templates/organisational
# -----------------------------------------------------
# rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
# rubocop:disable Metrics/AbcSize
def organisational
authorize Template
templates = Template.latest_version_per_org(current_user.org.id).includes(:org)
Expand All @@ -55,20 +54,15 @@ def organisational
@query_params = { sort_field: 'templates.title', sort_direction: 'asc' }
@all_count = templates.size
@published_count = published.present? ? published : 0
@unpublished_count = if published.present?
@all_count - published
else
@all_count
end
@unpublished_count = @all_count - @published_count
render :index
end
# rubocop:enable Metrics/AbcSize, Metrics/PerceivedComplexity
# rubocop:enable Metrics/AbcSize

# A version of index that displays only templates that are customizable
# GET /org_admin/templates/customisable
# -----------------------------------------------------
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def customisable
authorize Template
funder_templates = Template.latest_customizable.includes(:org)
Expand Down Expand Up @@ -99,9 +93,8 @@ def customisable

render :index
end
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity

# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
# GET /org_admin/templates/[:id]
def show
template = Template.find(params[:id])
Expand Down Expand Up @@ -417,5 +410,4 @@ def get_referrer(template, referrer)
end
end
end
# rubocop:enable Metrics/ClassLength
end

0 comments on commit 7f636b9

Please sign in to comment.