Migration to active admin 2

This commit is contained in:
echarp 2019-04-26 17:20:49 +02:00
parent c44eaf30f6
commit 460efbe667
5 changed files with 58 additions and 20 deletions

View File

@ -33,18 +33,18 @@ GEM
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.0, >= 1.0.3)
actionview-encoded_mail_to (1.0.9) actionview-encoded_mail_to (1.0.9)
rails rails
activeadmin (1.4.3) activeadmin (2.0.0)
arbre (>= 1.1.1) arbre (~> 1.2, >= 1.2.1)
coffee-rails
formtastic (~> 3.1) formtastic (~> 3.1)
formtastic_i18n formtastic_i18n (~> 0.4)
inherited_resources (>= 1.9.0) inherited_resources (~> 1.7)
jquery-rails (>= 4.2.0) jquery-rails (~> 4.2)
kaminari (>= 0.15) kaminari (~> 1.0, >= 1.0.1)
railties (>= 4.2, < 5.3) railties (>= 5.0, < 6.0)
ransack (>= 1.8.7) ransack (~> 2.1, >= 2.1.1)
sass (~> 3.1) sass (~> 3.4)
sprockets (< 4.1) sprockets (>= 3.0, < 4.1)
sprockets-es6 (~> 0.9, >= 0.9.2)
activejob (5.2.3) activejob (5.2.3)
activesupport (= 5.2.3) activesupport (= 5.2.3)
globalid (>= 0.3.6) globalid (>= 0.3.6)
@ -71,6 +71,10 @@ GEM
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
arel (9.0.0) arel (9.0.0)
ast (2.4.0) ast (2.4.0)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
bcrypt (3.1.12) bcrypt (3.1.12)
bindex (0.7.0) bindex (0.7.0)
brakeman (4.5.0) brakeman (4.5.0)
@ -384,6 +388,10 @@ GEM
sprockets (3.7.2) sprockets (3.7.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-es6 (0.9.2)
babel-source (>= 5.8.11)
babel-transpiler
sprockets (>= 3.0.0)
sprockets-rails (3.2.1) sprockets-rails (3.2.1)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)

View File

@ -1,13 +1,13 @@
ActiveAdmin.register Orga do ActiveAdmin.register Orga do
permit_params :kind_id, :name, :description, :url, :city, :department, permit_params :active, :kind_id, :name, :description, :url, :city, :region_id
:region_id, :active
scope :active scope :all, default: true
scope :moderated scope :moderated
scope :unmoderated scope :unmoderated
config.sort_order = 'updated_at_desc' config.sort_order = 'updated_at_desc'
filter :active, as: :radio
filter :kind, as: :check_boxes filter :kind, as: :check_boxes
filter :name filter :name
filter :region filter :region
@ -16,23 +16,36 @@ ActiveAdmin.register Orga do
column :kind column :kind
column :name column :name
column :city column :city
column :department
column :region column :region
column :url column :url
column :feed column :feed
column :contact column :contact
column :submitter
column :updated_at column :updated_at
column :active
actions actions
end end
csv do
column(:kind) { |o| o.kind.name }
column :name
column :contact
column :submitter
column :updated_at
column :active
end
show do |l| show do |l|
attributes_table do attributes_table do
row :kind row :kind
row :name row :name
row :description row :address
row :city row :city
row :department
row :region row :region
h3 Orga.human_attribute_name :description
section do
simple_format l.description
end
row :url do row :url do
link_to l.url, l.url link_to l.url, l.url
end end
@ -48,16 +61,20 @@ ActiveAdmin.register Orga do
end end
form do |f| form do |f|
f.semantic_errors
f.inputs do f.inputs do
f.input :kind f.input :kind
f.input :name f.input :name
f.input :address, as: :string
f.input :city f.input :city
f.input :department
f.input :region f.input :region
f.input :latitude
f.input :longitude
f.input :description f.input :description
f.input :url f.input :url
f.input :feed f.input :feed
f.input :contact f.input :contact
f.input :submitter
f.input :active f.input :active
end end
f.actions f.actions

View File

@ -1,6 +1,19 @@
ActiveAdmin.register I18n::Backend::ActiveRecord::Translation do ActiveAdmin.register I18n::Backend::ActiveRecord::Translation do
permit_params :locale, :key, :value permit_params :locale, :key, :value
index do
column :locale
column :key
actions
end
show do |t|
h3 t.locale + ' - ' + t.key
section do
simple_format t.value
end
end
form do |f| form do |f|
f.inputs do f.inputs do
f.input :locale f.input :locale

View File

@ -151,7 +151,7 @@ it more readable or agreable."
tags: tags:
index: index:
title: Tags title: Tags
threshold: used more than %{threshold} times threshold: Tags used more than %{threshold} times
show: show:
title: Tag title: Tag
links: See also links: See also

View File

@ -164,7 +164,7 @@ lévénement pour la rendre plus complète, plus lisible ou plus attrayante."
tags: tags:
index: index:
title: Mots-clés title: Mots-clés
threshold: utilisés plus de %{threshold} fois threshold: Mots-clés utilisés plus de %{threshold} fois
show: show:
title: Mot-clé title: Mot-clé
links: Voir aussi links: Voir aussi