Code style: make rubocop happy with the app/admin directory

This commit is contained in:
Saverio Trioni
2015-01-08 00:08:48 +01:00
parent a2097bb786
commit 92fcf5a3de
6 changed files with 20 additions and 22 deletions

View File

@ -1,5 +1,4 @@
ActiveAdmin.register Category do
index do
selectable_column
id_column
@ -24,7 +23,7 @@ ActiveAdmin.register Category do
I18n.available_locales.map do |loc|
next unless cat.send("name_#{loc}")
content_tag(:strong, "#{loc}: ") +
content_tag(:span, cat.send("name_#{loc}"))
content_tag(:span, cat.send("name_#{loc}"))
end.compact.sum
end
end
@ -33,5 +32,4 @@ ActiveAdmin.register Category do
end
permit_params :name
end

View File

@ -1,9 +1,7 @@
ActiveAdmin.register_page "Dashboard" do
menu priority: 1, label: proc { I18n.t("active_admin.dashboard") }
menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }
content :title => proc{ I18n.t("active_admin.dashboard") } do
content title: proc { I18n.t("active_admin.dashboard") } do
columns do
column do
panel "Recent Organizations" do
@ -31,6 +29,5 @@ ActiveAdmin.register_page "Dashboard" do
end
end
end
end
end

View File

@ -1,7 +1,7 @@
ActiveAdmin.register Document do
permit_params *Document.attribute_names
index do |t|
index do
selectable_column
id_column
column :documentable

View File

@ -2,7 +2,9 @@ ActiveAdmin.register Organization do
index do
id_column
column :name
column :created_at do |organization| l organization.created_at.to_date, format: :short end
column :created_at do |organization|
l organization.created_at.to_date, format: :short
end
column :city
column :neighborhood
column :email
@ -26,9 +28,8 @@ ActiveAdmin.register Organization do
end
filter :name
filter :city, as: :select, collection: -> { Organization.pluck('city').uniq }
filter :city, as: :select, collection: -> { Organization.pluck(:city).uniq }
filter :neighborhood
permit_params *Organization.attribute_names
end

View File

@ -1,11 +1,12 @@
ActiveAdmin.register Post do
index do
selectable_column
id_column
column :class
column :title
column :created_at do |post| l post.created_at.to_date, format: :short end
column :created_at do |post|
l post.created_at.to_date, format: :short
end
column :user
column :category
column :tag_list
@ -33,5 +34,4 @@ ActiveAdmin.register Post do
filter :organization
filter :category
filter :created_at
end

View File

@ -1,18 +1,19 @@
# coding: utf-8
ActiveAdmin.register User do
action_item :only => :index do
link_to I18n.t("active_admin.users.upload_from_csv"), :action => 'upload_csv'
action_item only: :index do
link_to I18n.t("active_admin.users.upload_from_csv"), action: "upload_csv"
end
collection_action :upload_csv do
render "admin/csv/upload_csv"
end
collection_action :import_csv, :method => :post do
errors = CsvDb.convert_save(params[:dump][:organization_id], params[:dump][:file])
collection_action :import_csv, method: :post do
errors = CsvDb.convert_save(params[:dump][:organization_id],
params[:dump][:file])
flash[:error] = errors.join("<br/>").html_safe if errors.present?
redirect_to :action => :index
redirect_to action: :index
end
index do
@ -37,7 +38,7 @@ ActiveAdmin.register User do
f.inputs "Admin Details" do
f.input :username
f.input :email
f.input :gender, :as => :select, :collection => User::GENDERS
f.input :gender, as: :select, collection: User::GENDERS
f.input :identity_document
end
f.inputs "Members" do
@ -72,5 +73,6 @@ ActiveAdmin.register User do
end
end
permit_params *User.attribute_names, members_attributes: Member.attribute_names
permit_params *User.attribute_names,
members_attributes: Member.attribute_names
end