From 13cc15cd81db03a57575cadc057141086de42f44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Geonizeli?= Date: Wed, 10 Aug 2022 17:27:10 +0000 Subject: [PATCH] fix question filers and i18n --- app/admin/dashboard.rb | 1 - app/admin/questions.rb | 28 ++++++++++++++++++++---- app/admin/subjects.rb | 2 ++ config/locales/activeadmin/pt-BR.yml | 3 +-- config/locales/defaults/pt-BR.yml | 3 ++- config/locales/models/axis/pt-BR.yml | 2 ++ config/locales/models/category/pt-BR.yml | 1 + 7 files changed, 32 insertions(+), 8 deletions(-) diff --git a/app/admin/dashboard.rb b/app/admin/dashboard.rb index 3824c62..4be3109 100644 --- a/app/admin/dashboard.rb +++ b/app/admin/dashboard.rb @@ -6,7 +6,6 @@ ActiveAdmin.register_page "Dashboard" do div class: "blank_slate_container", id: "dashboard_default_message" do span class: "blank_slate" do span I18n.t("active_admin.dashboard_welcome.welcome") - small I18n.t("active_admin.dashboard_welcome.call_to_action") end end diff --git a/app/admin/questions.rb b/app/admin/questions.rb index ea6a451..03cdea0 100644 --- a/app/admin/questions.rb +++ b/app/admin/questions.rb @@ -4,6 +4,18 @@ ActiveAdmin.register Question do scope :all, default: true scope :trashed + filter :user + filter :subject + filter :authorship + filter :authorship_year + filter :created_at + filter :updated_at + filter :deleted_at + filter :status, as: :check_boxes, collection: proc { Question.status.options } + filter :difficulty, as: :check_boxes, collection: proc { Question.difficulty.options } + filter :bloom_taxonomy, as: :check_boxes, collection: proc { Question.bloom_taxonomy.options } + filter :check_type, as: :check_boxes, collection: proc { Question.check_type.options } + controller do def show @question = Question.unscoped.find_by!(permitted_params[:question]) @@ -30,10 +42,18 @@ ActiveAdmin.register Question do id_column column :user column :subject - column :bloom_taxonomy - column :check_type - column :difficulty - column :status + column :bloom_taxonomy do |question| + question.bloom_taxonomy_text + end + column :check_type do |question| + question.check_type_text + end + column :difficulty do |question| + question.difficulty_text + end + column :status do |question| + question.status_text + end column :created_at column :updated_at actions diff --git a/app/admin/subjects.rb b/app/admin/subjects.rb index b97ea3a..2a08d10 100644 --- a/app/admin/subjects.rb +++ b/app/admin/subjects.rb @@ -1,3 +1,5 @@ ActiveAdmin.register Subject do permit_params :name, :category_id, :axis_id + + remove_filter :questions end diff --git a/config/locales/activeadmin/pt-BR.yml b/config/locales/activeadmin/pt-BR.yml index 3ab4e2f..50393fe 100644 --- a/config/locales/activeadmin/pt-BR.yml +++ b/config/locales/activeadmin/pt-BR.yml @@ -2,8 +2,7 @@ pt-BR: active_admin: dashboard: "Painel Administrativo" dashboard_welcome: - welcome: "Bem vindo ao Active Admin. Esta é a página de painéis padrão." - call_to_action: "Para adicionar seções ao painel, verifique 'app/admin/dashboard.rb'" + welcome: "Bem vindo ao Painel Administrativo." view: "Visualizar" edit: "Editar" delete: "Remover" diff --git a/config/locales/defaults/pt-BR.yml b/config/locales/defaults/pt-BR.yml index f7a71d0..8ca3ed3 100644 --- a/config/locales/defaults/pt-BR.yml +++ b/config/locales/defaults/pt-BR.yml @@ -1,4 +1,5 @@ pt-BR: attributes: created_at: Criado em - updated_at: Atualizado em \ No newline at end of file + updated_at: Atualizado em + deleted_at: Deletado em \ No newline at end of file diff --git a/config/locales/models/axis/pt-BR.yml b/config/locales/models/axis/pt-BR.yml index 60b158c..1090a0a 100644 --- a/config/locales/models/axis/pt-BR.yml +++ b/config/locales/models/axis/pt-BR.yml @@ -7,3 +7,5 @@ pt-BR: attributes: axis: name: Nome + subjects: Assuntos + diff --git a/config/locales/models/category/pt-BR.yml b/config/locales/models/category/pt-BR.yml index 7f6d232..01c7553 100644 --- a/config/locales/models/category/pt-BR.yml +++ b/config/locales/models/category/pt-BR.yml @@ -7,3 +7,4 @@ pt-BR: attributes: category: name: Nome + subjects: Assuntos