Merge pull request #2880 from aitbw/style/rubocop-offenses
Fix Rubocop warnings for Admin controllers
This commit is contained in:
@@ -84,8 +84,8 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
||||
def budget_investment_params
|
||||
params.require(:budget_investment)
|
||||
.permit(:title, :description, :external_url, :heading_id, :administrator_id, :tag_list,
|
||||
:valuation_tag_list, :incompatible, :visible_to_valuators, :selected, valuator_ids: [],
|
||||
valuator_group_ids: [])
|
||||
:valuation_tag_list, :incompatible, :visible_to_valuators, :selected,
|
||||
valuator_ids: [], valuator_group_ids: [])
|
||||
end
|
||||
|
||||
def load_budget
|
||||
|
||||
@@ -5,8 +5,10 @@ class Admin::ProposalNotificationsController < Admin::BaseController
|
||||
before_action :load_proposal, only: [:confirm_hide, :restore]
|
||||
|
||||
def index
|
||||
@proposal_notifications = ProposalNotification.only_hidden.send(@current_filter).order(hidden_at: :desc)
|
||||
.page(params[:page])
|
||||
@proposal_notifications = ProposalNotification.only_hidden
|
||||
.send(@current_filter)
|
||||
.order(hidden_at: :desc)
|
||||
.page(params[:page])
|
||||
end
|
||||
|
||||
def confirm_hide
|
||||
|
||||
@@ -3,23 +3,28 @@ class Admin::StatsController < Admin::BaseController
|
||||
def show
|
||||
@event_types = Ahoy::Event.group(:name).count
|
||||
|
||||
@visits = Visit.count
|
||||
@debates = Debate.with_hidden.count
|
||||
@visits = Visit.count
|
||||
@debates = Debate.with_hidden.count
|
||||
@proposals = Proposal.with_hidden.count
|
||||
@comments = Comment.not_valuations.with_hidden.count
|
||||
@comments = Comment.not_valuations.with_hidden.count
|
||||
|
||||
@debate_votes = Vote.where(votable_type: 'Debate').count
|
||||
@debate_votes = Vote.where(votable_type: 'Debate').count
|
||||
@proposal_votes = Vote.where(votable_type: 'Proposal').count
|
||||
@comment_votes = Vote.where(votable_type: 'Comment').count
|
||||
@comment_votes = Vote.where(votable_type: 'Comment').count
|
||||
@votes = Vote.count
|
||||
|
||||
@user_level_two = User.active.level_two_verified.count
|
||||
@user_level_two = User.active.level_two_verified.count
|
||||
@user_level_three = User.active.level_three_verified.count
|
||||
@verified_users = User.active.level_two_or_three_verified.count
|
||||
@verified_users = User.active.level_two_or_three_verified.count
|
||||
@unverified_users = User.active.unverified.count
|
||||
@users = User.active.count
|
||||
@user_ids_who_voted_proposals = ActsAsVotable::Vote.where(votable_type: 'Proposal').distinct.count(:voter_id)
|
||||
|
||||
@user_ids_who_voted_proposals = ActsAsVotable::Vote.where(votable_type: 'Proposal')
|
||||
.distinct
|
||||
.count(:voter_id)
|
||||
|
||||
@user_ids_who_didnt_vote_proposals = @verified_users - @user_ids_who_voted_proposals
|
||||
|
||||
@spending_proposals = SpendingProposal.count
|
||||
budgets_ids = Budget.where.not(phase: 'finished').pluck(:id)
|
||||
@budgets = budgets_ids.size
|
||||
|
||||
@@ -5,8 +5,10 @@ class Admin::VerificationsController < Admin::BaseController
|
||||
end
|
||||
|
||||
def search
|
||||
@users = User.incomplete_verification.search(params[:name_or_email]).page(params[:page]).for_render
|
||||
@users = User.incomplete_verification.search(params[:name_or_email])
|
||||
.page(params[:page])
|
||||
.for_render
|
||||
render :index
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,13 +39,17 @@ class Admin::Widget::CardsController < Admin::BaseController
|
||||
private
|
||||
|
||||
def card_params
|
||||
params.require(:widget_card).permit(:label, :title, :description, :link_text, :link_url,
|
||||
:button_text, :button_url, :alignment, :header,
|
||||
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
|
||||
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
|
||||
params.require(:widget_card).permit(
|
||||
:label, :title, :description, :link_text, :link_url,
|
||||
:button_text, :button_url, :alignment, :header,
|
||||
image_attributes: image_attributes
|
||||
)
|
||||
end
|
||||
|
||||
def header_card?
|
||||
params[:header_card].present?
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user