diff --git a/Gemfile b/Gemfile index 2b41610..bd1f43b 100644 --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,7 @@ # ------------------------------------------------ # SUPER ADMIN SECTION -gem 'activeadmin', github: 'activeadmin' +gem "administrate", :github => 'thoughtbot/administrate', :branch =>'v0.4.0' # ------------------------------------------------ # USERS diff --git a/Gemfile.lock b/Gemfile.lock index f0dc2f1..ca4b10f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,21 +1,20 @@ GIT - remote: git://github.com/activeadmin/activeadmin.git - revision: f8926831429fe635d26ac8043ea5d676fb6ee637 + remote: git://github.com/thoughtbot/administrate.git + revision: 5ee0c2ffe4de99ebf639befd63831c1083dc535f + branch: v0.4.0 specs: - activeadmin (1.0.0.pre4) - arbre (~> 1.0, >= 1.0.2) - bourbon - coffee-rails - formtastic (~> 3.1) - formtastic_i18n - inherited_resources (~> 1.6) - jquery-rails - jquery-ui-rails - kaminari (~> 0.15) - railties (>= 3.2, < 5.1) - ransack (~> 1.3) - sass-rails - sprockets (< 4.1) + administrate (0.4.0) + autoprefixer-rails (~> 6.0) + bourbon (~> 4.2) + datetime_picker_rails (~> 0.0.7) + jquery-rails (~> 4.0) + kaminari (~> 0.16) + momentjs-rails (~> 2.8) + neat (~> 1.1) + normalize-rails (~> 3.0) + rails (>= 4.2, < 5.1) + sass-rails (~> 5.0) + selectize-rails (~> 0.6) GIT remote: https://github.com/vyruss/yaml_db.git @@ -65,9 +64,9 @@ tzinfo (~> 1.1) addressable (2.4.0) ansi (1.5.0) - arbre (1.1.1) - activesupport (>= 3.0.0) arel (6.0.3) + autoprefixer-rails (6.7.6) + execjs bcrypt (3.1.11) better_errors (2.1.1) coderay (>= 1.0.0) @@ -75,7 +74,7 @@ rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bourbon (4.2.7) + bourbon (4.3.3) sass (~> 3.4) thor (~> 0.19) builder (3.2.2) @@ -95,13 +94,6 @@ caracal (~> 1.0) rails (>= 3.2) coderay (1.1.1) - coffee-rails (4.2.1) - coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.2.x) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.10.0) commonjs (0.2.7) concurrent-ruby (1.0.2) contact_us (1.2.0) @@ -109,6 +101,8 @@ crack (0.4.3) safe_yaml (~> 1.0.0) daemons (1.2.4) + datetime_picker_rails (0.0.7) + momentjs-rails (>= 2.8.1) debug_inspector (0.0.2) devise (4.2.0) bcrypt (~> 3.0) @@ -138,18 +132,12 @@ loofah (~> 2.0) sax-machine (~> 1.0) flag_shih_tzu (0.3.15) - formtastic (3.1.4) - actionpack (>= 3.2.13) - formtastic_i18n (0.6.0) friendly_id (5.1.0) activerecord (>= 4.0.0) gettext_i18n_rails (1.8.0) fast_gettext (>= 0.9.0) globalid (0.3.7) activesupport (>= 4.1.0) - has_scope (0.6.0) - actionpack (>= 3.2, < 5) - activesupport (>= 3.2, < 5) hashdiff (0.3.0) hashie (3.4.6) htmltoword (0.5.1) @@ -159,11 +147,6 @@ i18n (0.7.0) i18n-js (3.0.0.rc14) i18n (~> 0.6, >= 0.6.6) - inherited_resources (1.6.0) - actionpack (>= 3.2, < 5) - has_scope (~> 0.6.0.rc) - railties (>= 3.2, < 5) - responders jbuilder (2.6.0) activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) @@ -171,8 +154,6 @@ rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - jquery-ui-rails (5.0.5) - railties (>= 3.2.16) json (1.8.3) jwt (1.5.6) kaminari (0.17.0) @@ -216,13 +197,19 @@ builder minitest (>= 5.0) ruby-progressbar + momentjs-rails (2.17.1) + railties (>= 3.1) multi_json (1.12.1) multi_xml (0.5.5) multipart-post (2.0.0) mysql2 (0.3.21) + neat (1.8.0) + sass (>= 3.3) + thor (~> 0.19) nokogiri (1.6.8) mini_portile2 (~> 2.1.0) pkg-config (~> 1.1.7) + normalize-rails (3.0.3) oauth2 (1.2.0) faraday (>= 0.8, < 0.10) jwt (~> 1.0) @@ -242,8 +229,6 @@ orm_adapter (0.5.0) pg (0.19.0) pkg-config (1.1.7) - polyamorous (1.3.1) - activerecord (>= 3.0) protected_attributes (1.1.3) activemodel (>= 4.0.1, < 5.0) pundit (1.1.0) @@ -278,12 +263,6 @@ rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (11.3.0) - ransack (1.8.2) - actionpack (>= 3.0) - activerecord (>= 3.0) - activesupport (>= 3.0) - i18n - polyamorous (~> 1.3) recaptcha (3.3.0) json redcarpet (3.3.4) @@ -302,6 +281,7 @@ sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) sax-machine (1.3.2) + selectize-rails (0.12.4) simplecov (0.12.0) docile (~> 1.1.0) json (>= 1.8, < 3) @@ -360,7 +340,7 @@ ruby DEPENDENCIES - activeadmin! + administrate! better_errors binding_of_caller byebug diff --git a/app/admin/dashboard.rb b/app/admin/dashboard.rb deleted file mode 100644 index 3aa2b89..0000000 --- a/app/admin/dashboard.rb +++ /dev/null @@ -1,39 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - - -ActiveAdmin.register_page "Dashboard" do - - menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") } - - content title: proc{ I18n.t("active_admin.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 - - # Here is an example of a simple dashboard with columns and panels. - # - # columns do - # column do - # panel "Recent Posts" do - # ul do - # Post.recent(5).map do |post| - # li link_to(post.title, admin_post_path(post)) - # end - # end - # end - # end - - # column do - # panel "Info" do - # para "Welcome to ActiveAdmin." - # end - # end - # end - end # content -end \ No newline at end of file diff --git a/app/admin/guidance.rb b/app/admin/guidance.rb deleted file mode 100644 index f4400e9..0000000 --- a/app/admin/guidance.rb +++ /dev/null @@ -1,81 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register Guidance do - permit_params :text, :guidance_group_id, :question_id - - menu :priority => 13, :label => proc{ I18n.t('admin.guidance')}, :parent => "Guidance list" - - index do - column (:text) { |guidance| raw(guidance.text) } - column I18n.t('admin.theme') do |t| - (t.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - - column I18n.t('admin.question'), :sortable => :question_id do |que| - if !que.nil? then - que.question - else - '-' - end - end - - column I18n.t('admin.guidance_group') do |guidance| - (guidance.guidance_groups.map{|t_q| link_to t_q.name, [:admin, t_q]}).join(', ').html_safe - end - actions - end - - #show details of a question - show do - attributes_table do - row (:text) { |guidance| raw(guidance.text) } - - row I18n.t('admin.theme') do - (guidance.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - row I18n.t('admin.question'), :question_id do |question| - question.question - end - row I18n.t('admin.guidance_group') do |guidance| - (guidance.guidance_groups.map{|t_q| link_to t_q.name, [:admin, t_q]}).join(', ').html_safe - end - - row :created_at - row :updated_at - end - end - - #form - form do |f| - f.inputs "Details" do - f.input :text - f.input :question_id, :as => :select, - :collection => Question.order('text').map{|que|[que.text, que.id]} - f.input :guidance_group_ids, :label => I18n.t('admin.guidance_group'), - :as => :select, - :collection => GuidanceGroup.order('name').map{|gui|[gui.name, gui.id]} - - end - f.inputs "Themes" do - f.input :theme_ids, :label => I18n.t('admin.selected_themes'), - :as => :select, - :include_blank => I18n.t('admin.all_themes'), - :multiple => true, - :collection => Theme.order('title').map{|the| [the.title, the.id]}, - :hint => I18n.t('admin.choose_themes') - end - - f.actions - end - - controller do - def permitted_params - params.permit! - end - end - -end diff --git a/app/admin/guidance_group.rb b/app/admin/guidance_group.rb deleted file mode 100644 index c193af9..0000000 --- a/app/admin/guidance_group.rb +++ /dev/null @@ -1,80 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register GuidanceGroup do - permit_params :organisation_id, :name, :published, :optional_subset - - menu :priority => 2, :label => proc{I18n.t('admin.guidance_group')}, :parent => "Guidance list" - - index do - column I18n.t('admin.name'), :sortable => :name do |ggn| - link_to ggn.name, [:admin, ggn] - end - column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - column I18n.t('admin.template') do |t| - (t.dmptemplates.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - - actions - end - - #show details of guidance group - show do - attributes_table do - row :name - row :organisation_id do |org_title| - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - row I18n.t('admin.template') do - (guidance_group.dmptemplates.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - row :created_at - row :updated_at - end - end - - #guidance list - sidebar I18n.t('admin.guidance'), :only => :show, :if => proc { guidance_group.guidances.count >= 1} do - table_for guidance_group.guidances.order("text asc") do |guis| - column :text do |gtext| - link_to gtext.text.html_safe, [:admin, gtext] - end - column I18n.t('admin.theme') do |themelist| - (themelist.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - end - end - - #form - form do |f| - f.inputs "Details" do - f.input :name - f.input :organisation_id, :label => I18n.t('admin.org_title'), - :as => :select, - :collection => Org.order('name').map{|orgp|[orgp.name, orgp.id]} - f.input :published - f.input :optional_subset - end - - f.inputs "Templates" do - f.input :dmptemplate_ids, :label => I18n.t('admin.selected_templates'), - :as => :select, - :include_blank => I18n.t('admin.all_templates'), - :multiple => true, - :collection => Dmptemplate.order('title').map{|the| [the.title, the.id]}, - :hint => I18n.t('admin.choose_templates') - end - f.actions - end - - controller do - def permitted_params - params.permit! - end - end -end diff --git a/app/admin/language.rb b/app/admin/language.rb deleted file mode 100644 index 777478c..0000000 --- a/app/admin/language.rb +++ /dev/null @@ -1,45 +0,0 @@ -# [+Project:+] DMPonline -# [+Description:+] -# -# [+Created:+] 12/08/2016 -# [+Copyright:+] Digital Curation Centre - -ActiveAdmin.register Language do - permit_params :language_id, :name, :abbreviation, :default_language - - menu :priority => 10, :label => proc { I18n.t('admin.language') } - - index do - column I18n.t('admin.language_name'), :sortable => :name do |lang| - link_to lang.name, [:admin, lang] - end - column I18n.t('admin.language_abbreviation'), :sortable => :abbreviation do |lang| - link_to lang.abbreviation, [:admin, lang] - end - column I18n.t('admin.language_is_default'), :sortable => :default_language do |lang| - if lang[:default_language] - 'Yes' - else - 'No' - end - end - - actions - end - - show do - attributes_table do - row :name - row :abbreviation - row :default_language - row :description - end - end - - controller do - def permitted_params - params.permit! - end - end - -end \ No newline at end of file diff --git a/app/admin/option.rb b/app/admin/option.rb deleted file mode 100644 index cd68f1a..0000000 --- a/app/admin/option.rb +++ /dev/null @@ -1,79 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register QuestionOption do - permit_params :question_id, :text, :number, :is_default - menu :priority => 6, :label => proc{I18n.t('admin.multi_options')}, :parent => "Templates management" - - index do - column :text - column I18n.t('admin.questions'), :sortable => :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.text, [:admin, ques.question] - end - end - column I18n.t('admin.sections'), :sortable => :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.section.title, [:admin, ques.question.section] - end - end - column I18n.t('admin.template'), :sortable => :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.section.version.phase.dmptemplate.title, [:admin, ques.question.section.version.phase.dmptemplate] - end - end - - actions - end - - #show details of a section - show do - attributes_table do - row :text - row :number - row I18n.t('admin.questions'), :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.text, [:admin, ques.question] - end - end - row I18n.t('admin.sections'), :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.section.title, [:admin, ques.question.section] - end - end - row I18n.t('admin.template'), :question_id do |ques| - if !ques.question_id.nil? then - link_to ques.question.section.version.phase.dmptemplate.title, [:admin, ques.question.section.version.phase.dmptemplate] - end - end - row :is_default - row :created_at - row :updated_at - end - end - - - #form - form do |f| - f.inputs "Details" do - f.input :text - f.input :number - f.input :question, - :as => :select, - :collection => Question.order('text').map{ |sec| ["#{truncate(sec.section.version.phase.dmptemplate.title, :lengh => 20)} - #{truncate(sec.section.title, :lengh => 50)} - #{truncate(sec.text, :lengh => 20)}", sec.id] } - f.input :is_default - end - - f.actions - end - - - controller do - def permitted_params - params.permit! - end - end -end diff --git a/app/admin/org.rb b/app/admin/org.rb deleted file mode 100644 index 7d9391b..0000000 --- a/app/admin/org.rb +++ /dev/null @@ -1,110 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register Org do - permit_params :abbreviation, :banner_file_id, :description, :logo_file_id, :name, :target_url, :organisation_type_id, :wayfless_entity, :parent_id - - menu :priority => 14, :label => proc{I18n.t('admin.org')}, :parent => "Organisations management" - - index do - column I18n.t('admin.org_title'), :sortable => :name do |ggn| - link_to ggn.name, [:admin, ggn] - end - column I18n.t('admin.abbrev'), :sortable => :abbreviation do |ggn| - if !ggn.abbreviation.nil? - link_to ggn.abbreviation, [:admin, ggn] - else - '-' - end - end - column I18n.t('admin.org_type'), :sortable => :organisation_type_id do |org_type| - if !org_type.organisation_type_id.nil? then - link_to org_type.organisation_type.name, [:admin, org_type] - end - end - - actions - end - - - #show details of an organisation - show do - resource.check_api_credentials - attributes_table do - row I18n.t('admin.org_title'), :sortable => :name do |gn| - if !gn.name.nil? then - link_to gn.name, [:admin, gn] - end - end - row I18n.t('admin.abbrev'), :abbreviation do |ggn| - if !ggn.abbreviation.nil? - link_to ggn.abbreviation, [:admin, ggn] - else - '-' - end - end - row :sort_name - row I18n.t('admin.org_type'), :organisation_type_id do |org_type| - if !org_type.organisation_type_id.nil? then - link_to org_type.organisation_type.name, [:admin, org_type] - end - end - row :banner_text do |banner| - if !banner.banner_text.nil? then - banner.banner_text.html_safe - end - end - # row :target_url - row :logo_file_name - row :wayfless_entity - row I18n.t('admin.token_permission_type') do - (organisation.token_permission_types.map{|tpt| link_to tpt.token_type, [:admin, tpt]}).join(', ').html_safe - end - row :created_at - row :updated_at - end - end - - #templates sidebar - sidebar I18n.t('admin.templates'), :only => :show, :if => proc { organisation.dmptemplates.count >= 1} do - table_for organisation.dmptemplates.order("title asc") do |temp| - column :title do |dmptemp| - link_to dmptemp.title, [:admin, dmptemp] - end - column :published - end - end - - #form - form do |f| - f.inputs "Details" do - f.input :name - f.input :abbreviation - f.input :sort_name - f.input :organisation_type_id, :label => I18n.t('admin.org_type'), :as => :select, :collection => OrganisationType.order('name').map{|orgt|[orgt.name, orgt.id]} - # f.input :target_url - f.input :banner_text - f.input :logo_file_name - f.input :wayfless_entity - f.input :token_permission_types, label: I18n.t('admin.token_permission_type'), - as: :select, multiple: true, include_blank: I18n.t('helpers.none'), - collection: TokenPermissionType.order(:token_type).map{|token| [token.token_type, token.id]}, - hint: I18n.t('admin.choose_api_permissions') - # f.input :parent_id, :label => I18n.t('admin.org_parent'), :as => :select, :collection => Org.find(:all, :order => 'name ASC').map{|orgp|[orgp.name, orgp.id]} - # f.input :stylesheet_file_id - end - f.actions - end - - - controller do - def permitted_params - params.permit! - end - end - - -end diff --git a/app/admin/perm.rb b/app/admin/perm.rb deleted file mode 100644 index 4401e31..0000000 --- a/app/admin/perm.rb +++ /dev/null @@ -1,60 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register Perm do - permit_params :name - - menu :priority => 5, :label => proc{I18n.t('admin.role')}, :parent => "User management" - - index do - column I18n.t('admin.title'), :sortable => :name do |role_name| - link_to role_name.name, [:admin, role_name] - end - - actions - end - - - show do - attributes_table do - row :name - row :created_at - row :updated_at - end - - table_for( (Perm.find(params[:id]).users)) do - column (:email){|user| link_to user.email, [:admin, user]} - column (:firstname){|user| user.firstname} - column (:surname){|user| user.surname} - column (:last_sign_in_at){|user| user.last_sign_in_at} - column (I18n.t('admin.org_title')){|user| - if !user.organisation.nil? then - if user.other_organisation.nil? || user.other_organisation == "" then - link_to user.organisation.name, [:admin, user.organisation] - else - I18n.t('helpers.org_type.org_name') + ' - ' + user.other_organisation - - end - end - } - end - - end - - form do |f| - f.inputs "Details" do - f.input :name - end - - f.actions - end - - controller do - def permitted_params - params.permit! - end - end -end diff --git a/app/admin/phase.rb b/app/admin/phase.rb deleted file mode 100644 index d7d061e..0000000 --- a/app/admin/phase.rb +++ /dev/null @@ -1,83 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register Phase do - permit_params :description, :number, :title, :dmptemplate_id - - menu :priority => 10, :label => proc{I18n.t('admin.phase')}, :parent => "Templates management" - - index do - column :title, :sortable => :title do |ph| - if !ph.title.nil? then - link_to ph.title, [:admin, ph] - end - end - column :number - column I18n.t('admin.template'), :sortable => :dmptemplate_id do |temp_title| - if !temp_title.nil? then - if !temp_title.dmptemplate.nil? then - link_to temp_title.dmptemplate.title, [:admin, temp_title.dmptemplate] - else - "-" - end - end - end - - actions - end - - #show details of a phase - show do - attributes_table do - row :title - row :number - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row I18n.t('admin.template'), :sortable => :dmptemplate_id do |temp_title| - link_to temp_title.dmptemplate.title, [:admin, temp_title.dmptemplate] - end - row :created_at - row :updated_at - end - - end - - #versions sidebar - sidebar I18n.t('admin.version'), :only => :show, :if => proc { phase.versions.count >= 1} do - table_for phase.versions.order("number asc") do |temp_phases| - column :number - column :title do |row| - link_to row.title, [:admin, row] - end - column :published - end - end - - - #form - form do |f| - f.inputs "Details" do - f.input :title - f.input :number - f.input :description - f.input :dmptemplate_id, :label => I18n.t('admin.template'), - :as => :select, - :collection => Dmptemplate.order('title').map{|temp|[temp.title, temp.id]} - - end - f.actions - end - - - controller do - def permitted_params - params.permit! - end - end -end diff --git a/app/admin/plan.rb b/app/admin/plan.rb deleted file mode 100644 index 574a7c2..0000000 --- a/app/admin/plan.rb +++ /dev/null @@ -1,39 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register Plan do - permit_params :template_id, :title, :org_id, :unit_id, :guidance_group_ids, :role_ids, :funder_id, :institution_id, :grant_number,:identifier, :description, :principal_investigator, :principal_investigator_identifier, :data_contact - - menu :priority => 25, :label => proc{I18n.t('admin.plans')} - - - index do - column :title - column I18n.t('admin.org_title'), :sortable => :org_id do |org_title| - if !org_title.organisation.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - else - '-' - end - end - column I18n.t('admin.template_title'), :sortable => :template_id do |dmptemp| - if !dmptemp.template.nil? then - link_to dmptemp.template.title, [:admin, dmptemp.template] - else - '-' - end - end - - actions - end - - - controller do - def permitted_params - params.permit! - end - end -end diff --git a/app/admin/question.rb b/app/admin/question.rb deleted file mode 100644 index 45d8e18..0000000 --- a/app/admin/question.rb +++ /dev/null @@ -1,101 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register Question do - permit_params :default_value, :dependency_id, :dependency_text, :guidance, :number, :suggested_answer, :text, :question_type, :section_id - - menu :priority => 7, :label => proc{I18n.t('admin.question')}, :parent => "Templates management" - - index do - column I18n.t('admin.question'), :sortable => :text do |descr| - if !descr.text.nil? then - descr.text.html_safe - end - end - column I18n.t('admin.section_title'), :sortable => :section_id do |dmptemplate| - if !dmptemplate.section_id.nil? then - link_to dmptemplate.section.title, [:admin, dmptemplate.section] - end - end - column :number, :sortable => :number do |question_n| - if !question_n.number.nil? then - question_n.number - end - end - column I18n.t('admin.template_title'), :sortable => true do |dmptemplate| - if !dmptemplate.section_id.nil? then - if !dmptemplate.section.version.phase.dmptemplate.nil? then - link_to dmptemplate.section.version.phase.dmptemplate.title, [:admin, dmptemplate.section.version.phase.dmptemplate] - else - "-" - end - end - end - actions - end - - - #show details of a question - show do - attributes_table do - row :text do |descr| - if !descr.text.nil? then - descr.text.html_safe - end - end - row :section_id do |question| - link_to question.section.title, [:admin, question.section] - end - row :number - row :default_value - row I18n.t('admin.question_format') do |format| - link_to format.question_format.title, [:admin, format.question_format] - end - row I18n.t('admin.themes') do - (question.themes.map{|t_q| link_to t_q.title, [:admin, t_q]}).join(', ').html_safe - end - row :created_at - row :updated_at - - end - end - - - #form - form do |f| - f.inputs "Details" do - f.input :text - f.input :number - f.input :section, - :as => :select, - :collection => Section.order('title').map{ |sec| ["#{sec.version.phase.dmptemplate.title} - #{sec.title}", sec.id] } - f.input :default_value - - end - f.inputs "Question Format" do - f.input :question_format_id, :label => I18n.t('admin.select_question_format'), - :as => :select, - :collection => QuestionFormat.order('title').map{|format| [format.title, format.id]} - end - f.inputs "Themes" do - f.input :theme_ids, :label => I18n.t('admin.selected_themes'), - :as => :select, - :multiple => true, - :include_blank => I18n.t('helpers.none'), - :collection => Theme.order('title').map{|the| [the.title, the.id]} , - :hint => I18n.t('admin.choose_themes') - - end - f.actions - end - - controller do - def permitted_params - params.permit! - end - end - -end diff --git a/app/admin/question_format.rb b/app/admin/question_format.rb deleted file mode 100644 index a5b9523..0000000 --- a/app/admin/question_format.rb +++ /dev/null @@ -1,39 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register QuestionFormat do - permit_params :description, :title - - menu :priority => 5, :label => proc{I18n.t('admin.question_format')}, :parent => "Templates management" - - index do - column I18n.t('admin.question_format'), :sortable => :title do |n| - link_to n.title, [:admin, n] - end - - actions - end - - # show Template details - show do - attributes_table do - row :title - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row :created_at - row :updated_at - end - end - - controller do - def permitted_params - params.permit! - end - end -end diff --git a/app/admin/role.rb b/app/admin/role.rb deleted file mode 100644 index 4fcf03b..0000000 --- a/app/admin/role.rb +++ /dev/null @@ -1,9 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register Role do - menu false -end diff --git a/app/admin/section.rb b/app/admin/section.rb deleted file mode 100644 index 4cc6c37..0000000 --- a/app/admin/section.rb +++ /dev/null @@ -1,93 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register Section do - permit_params :organisation_id, :description, :number, :title, :version_id - - menu :priority => 8, :label => proc{I18n.t('admin.section')}, :parent => "Templates management" - - filter :title - filter :organisation - filter :version - filter :created_at - filter :updated_at - - - index do - column :title , :sortable => :title do |section| - if !section.title.nil? then - link_to section.title, [:admin, section] - end - end - column I18n.t('admin.version'), :sortable => :version_id do |version_title| - if !version_title.version_id.nil? then - link_to version_title.version.title, [:admin, version_title.version] - end - end - column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| - if !org_title.organisation_id.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - end - - actions - end - - #show details of a section - show do - attributes_table do - row :title - row :number - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row I18n.t('admin.version'), :sortable => :version_id do |version_title| - if !version_title.version_id.nil? then - link_to version_title.version.title, [:admin, version_title.version] - end - end - row I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| - if !org_title.organisation_id.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - end - row :created_at - row :updated_at - end - - end - - - #questions sidebar(:default_value, :dependency_id, :dependency_text, :guidance, :number, :parent_id, :suggested_answer, :text, :question_type, :section_id) - sidebar proc{I18n.t("admin.questions")}, :only => :show, :if => proc { (Question.where("section_id = ?", params[:id])).count >= 1} do - table_for( Question.where("section_id = ?", params[:id] ).order("number")) do - column (:number){|question| question.number} - column (I18n.t("admin.question")){|question| link_to question.text, [:admin, question]} - end - - end - - #form - form do |f| - f.inputs "Details" do - f.input :title - f.input :number - f.input :version, :collection => Version.all.map{ |ver| [ver.title, ver.id] } - f.input :organisation, :as => :select, :collection => Org.order('name').map{|orgp|[orgp.name, orgp.id]} - f.input :description - end - - f.actions - end - - controller do - def permitted_params - params.permit! - end - end -end diff --git a/app/admin/suggested_answer.rb b/app/admin/suggested_answer.rb deleted file mode 100644 index 9c46eab..0000000 --- a/app/admin/suggested_answer.rb +++ /dev/null @@ -1,33 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register SuggestedAnswer do - permit_params :question_id, :organisation_id - - menu :priority => 4, :label => proc{I18n.t('admin.sug_answer')}, :parent => "Templates management" - - - #form - form do |f| - f.inputs "Details" do - f.input :question_id, :label => I18n.t('admin.question'), - :as => :select, - :collection => Question.order('text').map{|ques|[ques.text, ques.id]} - f.input :organisation_id, :label => I18n.t('admin.org_title'), - :as => :select, - :collection => Org.order('name').map{|orgp|[orgp.name, orgp.id]} - f.input :text - f.input :is_example - end - f.actions - end - - controller do - def permitted_params - params.permit! - end - end -end diff --git a/app/admin/template.rb b/app/admin/template.rb deleted file mode 100644 index 2f2695b..0000000 --- a/app/admin/template.rb +++ /dev/null @@ -1,125 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register Template do - permit_params :title, :description, :organisation_id, :published, :is_default - - menu :priority => 11, :label => proc{ I18n.t('admin.template')}, :parent => "Templates management" - - # FIXME: The below member_actions only work on :export settings. - member_action :settings do - @template = resource - @settings = resource.settings(:export) - end - - member_action :update_settings, method: :put do - new_settings = params[:settings][:export] - - settings = resource.settings(:export).tap do |s| - s.formatting, s.max_pages = if params[:commit] != 'Reset' - [ - new_settings[:formatting].try(:deep_symbolize_keys), - new_settings[:max_pages].try(:to_i) - ] - else - [ nil, nil ] - end - end - - if settings.save - redirect_to(action: :show, flash: { notice: I18n.t('admin.settings_updated') }) - else - settings.formatting = nil - @template = resource - @settings = settings - render(action: :settings) - end - end - - action_item(:edit) do - link_to(I18n.t('helpers.settings.title'), settings_admin_template_path(resource.id)) - end - - index do - column :title do |dmptemp| - link_to dmptemp.title, [:admin, dmptemp] - end - column :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - column I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| - if !org_title.organisation.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - else - '-' - end - end - column :published - column :is_default - - actions defaults: true do |template| - link_to(I18n.t('helpers.settings.title'), settings_admin_template_path(template.id)) - end - end - - - # show Template details - show do - attributes_table do - row :title - row :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - row I18n.t('admin.org_title'), :sortable => :organisation_id do |org_title| - if !org_title.organisation.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - else - '-' - end - end - row :published - row :is_default - row :created_at - row :updated_at - end - end - - #phases sidebar - sidebar I18n.t('admin.phases'), :only => :show, :if => proc { template.phases.count >= 1} do - table_for template.phases.order("number asc") do |temp_phases| - column :number - column :title do |row| - link_to row.title, [:admin, row] - end - end - end - - #form - form do |f| - f.inputs "Details" do - f.input :title - f.input :description - f.input :organisation_id, :label => I18n.t('admin.org_title'), - :as => :select, - :collection => Org.order('name').map{|orgp|[orgp.name, orgp.id]} - f.input :published - f.input :is_default - end - f.actions - end - - controller do - def permitted_params - params.permit! - end - end - -end - diff --git a/app/admin/theme.rb b/app/admin/theme.rb deleted file mode 100644 index 913f32e..0000000 --- a/app/admin/theme.rb +++ /dev/null @@ -1,77 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register Theme do - permit_params :description, :title, :locale - - menu :priority => 12, :label => "Themes" - - index do - column :title , :sortable => :title do |theme| - link_to theme.title, [:admin, theme] - end - column :description do |descr| - if !descr.description.nil? then - descr.description.html_safe - end - end - - actions - end - - #show details of a theme - show do - attributes_table do - row :title - row :description - row :created_at - row :updated_at - end - - table_for( (Theme.find(params[:id]).questions).order('number')) do - column (:number){|question| question.number} - column (I18n.t("admin.question")){|question| link_to question.text, [:admin, question]} - column (I18n.t("admin.template")){|question| - if !question.section.nil? then - if !question.section.version.nil? then - if !question.section.version.phase.nil? then - if !question.section.version.phase.dmptemplate.nil? then - link_to question.section.version.phase.dmptemplate.title, [:admin, question.section.version.phase.dmptemplate] - else - I18n.t('admin.no_template') - end - else - I18n.t('admin.no_phase') - end - else - I18n.t('admin.no_version') - end - else - I18n.t('admin.no_section') - end - } - end - end - - - - #form - form do |f| - f.inputs "Details" do - f.input :title - f.input :description - end - f.actions - end - - - controller do - def permitted_params - params.permit! - end - end - -end diff --git a/app/admin/token_permission_type.rb b/app/admin/token_permission_type.rb deleted file mode 100644 index 5c804e8..0000000 --- a/app/admin/token_permission_type.rb +++ /dev/null @@ -1,33 +0,0 @@ -ActiveAdmin.register TokenPermissionType do - permit_params :token_type, :text_description - - menu priority: 40, label: proc{ I18n.t('admin.token_permission_type')}, parent: "Api" - - # TODO: Find better fix for the undefined method xxx_id_eq - remove_filter :org_token_permissions - - index do - column I18n.t('admin.token_permission_type'), sortable: :token_type do |n| - link_to n.token_type, [:admin, n] - end - column I18n.t('admin.permission_description') do |n| - link_to n.text_description, [:admin, n] - end - - actions - end - - show do - attributes_table do - row :token_type - row :text_description - end - end - - controller do - def permitted_params - params.permit! - end - end - -end diff --git a/app/admin/user.rb b/app/admin/user.rb deleted file mode 100644 index 1456f53..0000000 --- a/app/admin/user.rb +++ /dev/null @@ -1,99 +0,0 @@ -# [+Project:+] DMPRoadmap -# [+Description:+] -# -# [+Created:+] 03/09/2014 -# [+Copyright:+] Digital Curation Centre and University of California Curation Center - -ActiveAdmin.register User do - permit_params :api_token, :password_confirmation, :encrypted_password, :remember_me, :id, :email, :firstname, :orcid_id, :shibboleth_id, :user_status_id, :surname, :user_type_id, :organisation_id, :skip_invitation, :other_organisation, :accept_terms, :role_ids - - menu :priority => 15, :label => proc{ I18n.t('admin.user')}, :parent => "User management" - - filter :firstname - filter :surname - filter :email - filter :organisation - filter :created_at - filter :updated_at - - - - index do - - column I18n.t('admin.user_name'), :sortable => :email do |user_email| - link_to user_email.email, [:admin, user_email] - end - column I18n.t('admin.firstname'), :sortable => :firstname do |use_first| - link_to use_first.firstname, [:admin, use_first] - end - column I18n.t('admin.surname'), :sortable => :surname do |user| - link_to user.surname, [:admin, user] - end - column I18n.t('admin.last_logged_in'), :last_sign_in_at - - column I18n.t('admin.org_title'), :sortable => 'organisation.name' do |org_title| - if !org_title.organisation.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - end - - actions - end - - show do - attributes_table do - row :firstname - row :surname - row :email - row :orcid_id - row I18n.t('admin.org_title'), :organisation_id do |org_title| - if !org_title.organisation_id.nil? then - link_to org_title.organisation.name, [:admin, org_title.organisation] - end - end - row :other_organisation - row I18n.t('admin.user_role') do - (user.roles.map{|ro| link_to ro.name, [:admin, ro]}).join(', ').html_safe - end - # row :shibboleth_id - row :last_sign_in_at - row :sign_in_count - row :api_token - - end - end - - - form do |f| - f.inputs "Details" do - f.input :firstname - f.input :surname - f.input :email - f.input :orcid_id - f.input :api_token - # f.input :shibboleth_id - f.input :organisation_id, :label => I18n.t('admin.org_title'), - :as => :select, - :collection => Org.order('name').map{|orgp|[orgp.name, orgp.id]} - f.input :other_organisation - f.input :role_ids, :label => I18n.t('admin.user_role'), - :as => :select, - :multiple => true, - :include_blank => I18n.t('helpers.none'), - :collection => Role.order('name').map{|ro| [ro.name, ro.id]} - end - - f.actions - end - - - - controller do - - def permitted_params - params.permit! - end - - end - -end diff --git a/app/controllers/admin/answers_controller.rb b/app/controllers/admin/answers_controller.rb new file mode 100644 index 0000000..c220635 --- /dev/null +++ b/app/controllers/admin/answers_controller.rb @@ -0,0 +1,21 @@ +module Admin + class AnswersController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Answer. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Answer.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb new file mode 100644 index 0000000..0018efc --- /dev/null +++ b/app/controllers/admin/application_controller.rb @@ -0,0 +1,25 @@ +# All Administrate controllers inherit from this `Admin::ApplicationController`, +# making it the ideal place to put authentication logic or other +# before_actions. +# +# If you want to add pagination or other controller-level concerns, +# you're free to overwrite the RESTful controller actions. +module Admin + class ApplicationController < Administrate::ApplicationController + before_action :authenticate_admin + + protect_from_forgery with: :exception + include Pundit + rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized + + def authenticate_admin + redirect_to root_path unless user_signed_in? && current_user.can_super_admin? + end + + # Override this value to specify the number of elements to display at a time + # on index pages. Defaults to 20. + # def records_per_page + # params[:per_page] || 20 + # end + end +end diff --git a/app/controllers/admin/exported_plans_controller.rb b/app/controllers/admin/exported_plans_controller.rb new file mode 100644 index 0000000..aecd7f0 --- /dev/null +++ b/app/controllers/admin/exported_plans_controller.rb @@ -0,0 +1,21 @@ +module Admin + class ExportedPlansController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = ExportedPlan. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # ExportedPlan.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/guidance_groups_controller.rb b/app/controllers/admin/guidance_groups_controller.rb new file mode 100644 index 0000000..6b9ad4b --- /dev/null +++ b/app/controllers/admin/guidance_groups_controller.rb @@ -0,0 +1,21 @@ +module Admin + class GuidanceGroupsController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = GuidanceGroup. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # GuidanceGroup.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/guidances_controller.rb b/app/controllers/admin/guidances_controller.rb new file mode 100644 index 0000000..6690ff3 --- /dev/null +++ b/app/controllers/admin/guidances_controller.rb @@ -0,0 +1,21 @@ +module Admin + class GuidancesController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Guidance. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Guidance.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/identifier_schemes_controller.rb b/app/controllers/admin/identifier_schemes_controller.rb new file mode 100644 index 0000000..43911d1 --- /dev/null +++ b/app/controllers/admin/identifier_schemes_controller.rb @@ -0,0 +1,21 @@ +module Admin + class IdentifierSchemesController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = IdentifierScheme. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # IdentifierScheme.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/languages_controller.rb b/app/controllers/admin/languages_controller.rb new file mode 100644 index 0000000..e70e606 --- /dev/null +++ b/app/controllers/admin/languages_controller.rb @@ -0,0 +1,21 @@ +module Admin + class LanguagesController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Language. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Language.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/notes_controller.rb b/app/controllers/admin/notes_controller.rb new file mode 100644 index 0000000..c740124 --- /dev/null +++ b/app/controllers/admin/notes_controller.rb @@ -0,0 +1,21 @@ +module Admin + class NotesController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Note. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Note.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/orgs_controller.rb b/app/controllers/admin/orgs_controller.rb new file mode 100644 index 0000000..91092db --- /dev/null +++ b/app/controllers/admin/orgs_controller.rb @@ -0,0 +1,21 @@ +module Admin + class OrgsController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Org. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Org.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/perms_controller.rb b/app/controllers/admin/perms_controller.rb new file mode 100644 index 0000000..4e153cc --- /dev/null +++ b/app/controllers/admin/perms_controller.rb @@ -0,0 +1,21 @@ +module Admin + class PermsController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Perm. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Perm.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/phases_controller.rb b/app/controllers/admin/phases_controller.rb new file mode 100644 index 0000000..5877a50 --- /dev/null +++ b/app/controllers/admin/phases_controller.rb @@ -0,0 +1,21 @@ +module Admin + class PhasesController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Phase. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Phase.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/plan_guidance_groups_controller.rb b/app/controllers/admin/plan_guidance_groups_controller.rb new file mode 100644 index 0000000..0eeb458 --- /dev/null +++ b/app/controllers/admin/plan_guidance_groups_controller.rb @@ -0,0 +1,21 @@ +module Admin + class PlanGuidanceGroupsController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = PlanGuidanceGroup. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # PlanGuidanceGroup.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/plans_controller.rb b/app/controllers/admin/plans_controller.rb new file mode 100644 index 0000000..aaa9189 --- /dev/null +++ b/app/controllers/admin/plans_controller.rb @@ -0,0 +1,21 @@ +module Admin + class PlansController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Plan. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Plan.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/question_formats_controller.rb b/app/controllers/admin/question_formats_controller.rb new file mode 100644 index 0000000..7644265 --- /dev/null +++ b/app/controllers/admin/question_formats_controller.rb @@ -0,0 +1,21 @@ +module Admin + class QuestionFormatsController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = QuestionFormat. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # QuestionFormat.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/question_options_controller.rb b/app/controllers/admin/question_options_controller.rb new file mode 100644 index 0000000..237df25 --- /dev/null +++ b/app/controllers/admin/question_options_controller.rb @@ -0,0 +1,21 @@ +module Admin + class QuestionOptionsController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = QuestionOption. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # QuestionOption.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/questions_controller.rb b/app/controllers/admin/questions_controller.rb new file mode 100644 index 0000000..1be38bf --- /dev/null +++ b/app/controllers/admin/questions_controller.rb @@ -0,0 +1,21 @@ +module Admin + class QuestionsController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Question. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Question.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/regions_controller.rb b/app/controllers/admin/regions_controller.rb new file mode 100644 index 0000000..44d2065 --- /dev/null +++ b/app/controllers/admin/regions_controller.rb @@ -0,0 +1,21 @@ +module Admin + class RegionsController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Region. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Region.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb new file mode 100644 index 0000000..6633242 --- /dev/null +++ b/app/controllers/admin/roles_controller.rb @@ -0,0 +1,21 @@ +module Admin + class RolesController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Role. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Role.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/sections_controller.rb b/app/controllers/admin/sections_controller.rb new file mode 100644 index 0000000..b06bb8c --- /dev/null +++ b/app/controllers/admin/sections_controller.rb @@ -0,0 +1,21 @@ +module Admin + class SectionsController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Section. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Section.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/splash_logs_controller.rb b/app/controllers/admin/splash_logs_controller.rb new file mode 100644 index 0000000..4cb0f85 --- /dev/null +++ b/app/controllers/admin/splash_logs_controller.rb @@ -0,0 +1,21 @@ +module Admin + class SplashLogsController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = SplashLog. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # SplashLog.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/suggested_answers_controller.rb b/app/controllers/admin/suggested_answers_controller.rb new file mode 100644 index 0000000..5ee314e --- /dev/null +++ b/app/controllers/admin/suggested_answers_controller.rb @@ -0,0 +1,21 @@ +module Admin + class SuggestedAnswersController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = SuggestedAnswer. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # SuggestedAnswer.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/templates_controller.rb b/app/controllers/admin/templates_controller.rb new file mode 100644 index 0000000..090a84b --- /dev/null +++ b/app/controllers/admin/templates_controller.rb @@ -0,0 +1,21 @@ +module Admin + class TemplatesController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Template. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Template.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/themes_controller.rb b/app/controllers/admin/themes_controller.rb new file mode 100644 index 0000000..f15a730 --- /dev/null +++ b/app/controllers/admin/themes_controller.rb @@ -0,0 +1,21 @@ +module Admin + class ThemesController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = Theme. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # Theme.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/token_permission_types_controller.rb b/app/controllers/admin/token_permission_types_controller.rb new file mode 100644 index 0000000..7e90c37 --- /dev/null +++ b/app/controllers/admin/token_permission_types_controller.rb @@ -0,0 +1,21 @@ +module Admin + class TokenPermissionTypesController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = TokenPermissionType. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # TokenPermissionType.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/user_identifiers_controller.rb b/app/controllers/admin/user_identifiers_controller.rb new file mode 100644 index 0000000..6699719 --- /dev/null +++ b/app/controllers/admin/user_identifiers_controller.rb @@ -0,0 +1,21 @@ +module Admin + class UserIdentifiersController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = UserIdentifier. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # UserIdentifier.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb new file mode 100644 index 0000000..b456891 --- /dev/null +++ b/app/controllers/admin/users_controller.rb @@ -0,0 +1,21 @@ +module Admin + class UsersController < Admin::ApplicationController + # To customize the behavior of this controller, + # simply overwrite any of the RESTful actions. For example: + # + # def index + # super + # @resources = User. + # page(params[:page]). + # per(10) + # end + + # Define a custom finder by overriding the `find_resource` method: + # def find_resource(param) + # User.find_by!(slug: param) + # end + + # See https://administrate-prototype.herokuapp.com/customizing_controller_actions + # for more information + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d04b380..08d677c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -8,8 +8,6 @@ include Pundit helper_method GlobalHelpers.instance_methods - # Override build_footer method in ActiveAdmin::Views::Pages - require 'active_admin_views_pages_base.rb' rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized diff --git a/app/dashboards/answer_dashboard.rb b/app/dashboards/answer_dashboard.rb new file mode 100644 index 0000000..ad7df7f --- /dev/null +++ b/app/dashboards/answer_dashboard.rb @@ -0,0 +1,69 @@ +require "administrate/base_dashboard" + +class AnswerDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + question: Field::BelongsTo, + user: Field::BelongsTo, + plan: Field::BelongsTo, + notes: Field::HasMany, + question_options: Field::HasMany, + id: Field::Number, + text: Field::Text, + created_at: Field::DateTime, + updated_at: Field::DateTime, + lock_version: Field::Number, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :question, + :user, + :plan, + :notes, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :question, + :user, + :plan, + :notes, + :question_options, + :id, + :text, + :created_at, + :updated_at, + :lock_version, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :question, + :user, + :plan, + :notes, + :question_options, + :text, + :lock_version, + ].freeze + + # Overwrite this method to customize how answers are displayed + # across all pages of the admin dashboard. + # + # def display_resource(answer) + # "Answer ##{answer.id}" + # end +end diff --git a/app/dashboards/exported_plan_dashboard.rb b/app/dashboards/exported_plan_dashboard.rb new file mode 100644 index 0000000..47b352e --- /dev/null +++ b/app/dashboards/exported_plan_dashboard.rb @@ -0,0 +1,60 @@ +require "administrate/base_dashboard" + +class ExportedPlanDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + plan: Field::BelongsTo, + user: Field::BelongsTo, + setting_objects: Field::HasMany.with_options(class_name: "Settings::Template"), + id: Field::Number, + format: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :plan, + :user, + :setting_objects, + :id, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :plan, + :user, + :setting_objects, + :id, + :format, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :plan, + :user, + :setting_objects, + :format, + ].freeze + + # Overwrite this method to customize how exported plans are displayed + # across all pages of the admin dashboard. + # + # def display_resource(exported_plan) + # "ExportedPlan ##{exported_plan.id}" + # end +end diff --git a/app/dashboards/guidance_dashboard.rb b/app/dashboards/guidance_dashboard.rb new file mode 100644 index 0000000..8e6427f --- /dev/null +++ b/app/dashboards/guidance_dashboard.rb @@ -0,0 +1,66 @@ +require "administrate/base_dashboard" + +class GuidanceDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + guidance_group: Field::BelongsTo, + themes: Field::HasMany, + guidance_groups: Field::HasMany, + id: Field::Number, + text: Field::Text, + created_at: Field::DateTime, + updated_at: Field::DateTime, + question_id: Field::Number, + published: Field::Boolean, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :guidance_group, + :themes, + :guidance_groups, + :id, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :guidance_group, + :themes, + :guidance_groups, + :id, + :text, + :created_at, + :updated_at, + :question_id, + :published, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :guidance_group, + :themes, + :guidance_groups, + :text, + :question_id, + :published, + ].freeze + + # Overwrite this method to customize how guidances are displayed + # across all pages of the admin dashboard. + # + # def display_resource(guidance) + # "Guidance ##{guidance.id}" + # end +end diff --git a/app/dashboards/guidance_group_dashboard.rb b/app/dashboards/guidance_group_dashboard.rb new file mode 100644 index 0000000..5aee6df --- /dev/null +++ b/app/dashboards/guidance_group_dashboard.rb @@ -0,0 +1,63 @@ +require "administrate/base_dashboard" + +class GuidanceGroupDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + org: Field::BelongsTo, + guidances: Field::HasMany, + id: Field::Number, + name: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + optional_subset: Field::Boolean, + published: Field::Boolean, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :org, + :guidances, + :id, + :name, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :org, + :guidances, + :id, + :name, + :created_at, + :updated_at, + :optional_subset, + :published, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :org, + :guidances, + :name, + :optional_subset, + :published, + ].freeze + + # Overwrite this method to customize how guidance groups are displayed + # across all pages of the admin dashboard. + # + # def display_resource(guidance_group) + # "GuidanceGroup ##{guidance_group.id}" + # end +end diff --git a/app/dashboards/identifier_scheme_dashboard.rb b/app/dashboards/identifier_scheme_dashboard.rb new file mode 100644 index 0000000..7c65ea8 --- /dev/null +++ b/app/dashboards/identifier_scheme_dashboard.rb @@ -0,0 +1,63 @@ +require "administrate/base_dashboard" + +class IdentifierSchemeDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + user_identifiers: Field::HasMany, + users: Field::HasMany, + id: Field::Number, + name: Field::String, + description: Field::String, + active: Field::Boolean, + created_at: Field::DateTime, + updated_at: Field::DateTime, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :name, + :description, + :user_identifiers, + :users, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :user_identifiers, + :users, + :id, + :name, + :description, + :active, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :user_identifiers, + :users, + :name, + :description, + :active, + ].freeze + + # Overwrite this method to customize how identifier schemes are displayed + # across all pages of the admin dashboard. + # + # def display_resource(identifier_scheme) + # "IdentifierScheme ##{identifier_scheme.id}" + # end +end diff --git a/app/dashboards/language_dashboard.rb b/app/dashboards/language_dashboard.rb new file mode 100644 index 0000000..b6f5a48 --- /dev/null +++ b/app/dashboards/language_dashboard.rb @@ -0,0 +1,63 @@ +require "administrate/base_dashboard" + +class LanguageDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + users: Field::HasMany, + orgs: Field::HasMany, + id: Field::Number, + abbreviation: Field::String, + description: Field::String, + name: Field::String, + default_language: Field::Boolean, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :abbreviation, + :name, + :users, + :orgs, + :default_language, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :users, + :orgs, + :id, + :abbreviation, + :description, + :name, + :default_language, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :users, + :orgs, + :abbreviation, + :description, + :name, + :default_language, + ].freeze + + # Overwrite this method to customize how languages are displayed + # across all pages of the admin dashboard. + # + # def display_resource(language) + # "Language ##{language.id}" + # end +end diff --git a/app/dashboards/note_dashboard.rb b/app/dashboards/note_dashboard.rb new file mode 100644 index 0000000..5912418 --- /dev/null +++ b/app/dashboards/note_dashboard.rb @@ -0,0 +1,63 @@ +require "administrate/base_dashboard" + +class NoteDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + answer: Field::BelongsTo, + user: Field::BelongsTo, + id: Field::Number, + text: Field::Text, + archived: Field::Boolean, + archived_by: Field::Number, + created_at: Field::DateTime, + updated_at: Field::DateTime, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :answer, + :user, + :id, + :text, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :answer, + :user, + :id, + :text, + :archived, + :archived_by, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :answer, + :user, + :text, + :archived, + :archived_by, + ].freeze + + # Overwrite this method to customize how notes are displayed + # across all pages of the admin dashboard. + # + # def display_resource(note) + # "Note ##{note.id}" + # end +end diff --git a/app/dashboards/org_dashboard.rb b/app/dashboards/org_dashboard.rb new file mode 100644 index 0000000..3bc1cf4 --- /dev/null +++ b/app/dashboards/org_dashboard.rb @@ -0,0 +1,116 @@ +require "administrate/base_dashboard" + +class OrgDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + organisation_type: Field::BelongsTo, + language: Field::BelongsTo, + guidance_groups: Field::HasMany, + templates: Field::HasMany, + users: Field::HasMany, + suggested_answers: Field::HasMany, + token_permission_types: Field::HasMany, + id: Field::Number, + name: Field::String, + abbreviation: Field::String, + target_url: Field::String, + wayfless_entity: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + parent_id: Field::Number, + is_other: Field::Boolean, + sort_name: Field::String, + banner_text: Field::Text, + logo_file_name: Field::String, + region_id: Field::Number, + logo_uid: Field::String, + logo_name: Field::String, + contact_email: Field::String, + org_type: Field::Number, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :name, + :abbreviation, + :language, + :guidance_groups, + :templates, + :contact_email, + :org_type, + :organisation_type, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :name, + :abbreviation, + :language, + :guidance_groups, + :templates, + :contact_email, + :org_type, + :organisation_type, + + :id, + :users, + :suggested_answers, + :token_permission_types, + :target_url, + :wayfless_entity, + :created_at, + :updated_at, + :parent_id, + :is_other, + :sort_name, + :banner_text, + :logo_file_name, + :region_id, + :logo_uid, + :logo_name, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :organisation_type, + :language, + :guidance_groups, + :templates, + :users, + :suggested_answers, + :token_permission_types, + :name, + :abbreviation, + :target_url, + :wayfless_entity, + :parent_id, + :is_other, + :sort_name, + :banner_text, + :logo_file_name, + :region_id, + :logo_uid, + :logo_name, + :contact_email, + :org_type, + ].freeze + + # Overwrite this method to customize how orgs are displayed + # across all pages of the admin dashboard. + # + # def display_resource(org) + # "Org ##{org.id}" + # end +end diff --git a/app/dashboards/perm_dashboard.rb b/app/dashboards/perm_dashboard.rb new file mode 100644 index 0000000..63ea695 --- /dev/null +++ b/app/dashboards/perm_dashboard.rb @@ -0,0 +1,54 @@ +require "administrate/base_dashboard" + +class PermDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + users: Field::HasMany, + id: Field::Number, + name: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :id, + :name, + :users, + :created_at, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :id, + :name, + :users, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :users, + :name, + ].freeze + + # Overwrite this method to customize how perms are displayed + # across all pages of the admin dashboard. + # + # def display_resource(perm) + # "Perm ##{perm.id}" + # end +end diff --git a/app/dashboards/phase_dashboard.rb b/app/dashboards/phase_dashboard.rb new file mode 100644 index 0000000..966961b --- /dev/null +++ b/app/dashboards/phase_dashboard.rb @@ -0,0 +1,72 @@ +require "administrate/base_dashboard" + +class PhaseDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + template: Field::BelongsTo, + sections: Field::HasMany, + questions: Field::HasMany, + id: Field::Number, + title: Field::String, + description: Field::Text, + number: Field::Number, + created_at: Field::DateTime, + updated_at: Field::DateTime, + slug: Field::String, + modifiable: Field::Boolean, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :template, + :sections, + :questions, + :id, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :template, + :sections, + :questions, + :id, + :title, + :description, + :number, + :created_at, + :updated_at, + :slug, + :modifiable, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :template, + :sections, + :questions, + :title, + :description, + :number, + :slug, + :modifiable, + ].freeze + + # Overwrite this method to customize how phases are displayed + # across all pages of the admin dashboard. + # + # def display_resource(phase) + # "Phase ##{phase.id}" + # end +end diff --git a/app/dashboards/plan_dashboard.rb b/app/dashboards/plan_dashboard.rb new file mode 100644 index 0000000..e1a67fe --- /dev/null +++ b/app/dashboards/plan_dashboard.rb @@ -0,0 +1,120 @@ +require "administrate/base_dashboard" + +class PlanDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + template: Field::BelongsTo, + phases: Field::HasMany, + sections: Field::HasMany, + questions: Field::HasMany, + themes: Field::HasMany, + answers: Field::HasMany, + notes: Field::HasMany, + roles: Field::HasMany, + users: Field::HasMany, + plan_guidance_groups: Field::HasMany, + guidance_groups: Field::HasMany, + exported_plans: Field::HasMany, + setting_objects: Field::HasMany.with_options(class_name: "Settings::Template"), + id: Field::Number, + project_id: Field::Number, + title: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + slug: Field::String, + grant_number: Field::String, + identifier: Field::String, + description: Field::Text, + principal_investigator: Field::String, + principal_investigator_identifier: Field::String, + data_contact: Field::String, + funder_name: Field::String, + visibility: Field::String.with_options(searchable: false), + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :template, + :phases, + :sections, + :questions, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :template, + :phases, + :sections, + :questions, + :themes, + :answers, + :notes, + :roles, + :users, + :plan_guidance_groups, + :guidance_groups, + :exported_plans, + :setting_objects, + :id, + :project_id, + :title, + :created_at, + :updated_at, + :slug, + :grant_number, + :identifier, + :description, + :principal_investigator, + :principal_investigator_identifier, + :data_contact, + :funder_name, + :visibility, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :template, + :phases, + :sections, + :questions, + :themes, + :answers, + :notes, + :roles, + :users, + :plan_guidance_groups, + :guidance_groups, + :exported_plans, + :setting_objects, + :project_id, + :title, + :slug, + :grant_number, + :identifier, + :description, + :principal_investigator, + :principal_investigator_identifier, + :data_contact, + :funder_name, + :visibility, + ].freeze + + # Overwrite this method to customize how plans are displayed + # across all pages of the admin dashboard. + # + # def display_resource(plan) + # "Plan ##{plan.id}" + # end +end diff --git a/app/dashboards/plan_guidance_group_dashboard.rb b/app/dashboards/plan_guidance_group_dashboard.rb new file mode 100644 index 0000000..df39d80 --- /dev/null +++ b/app/dashboards/plan_guidance_group_dashboard.rb @@ -0,0 +1,57 @@ +require "administrate/base_dashboard" + +class PlanGuidanceGroupDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + plan: Field::BelongsTo, + guidance_group: Field::BelongsTo, + id: Field::Number, + created_at: Field::DateTime, + updated_at: Field::DateTime, + selected: Field::Boolean, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :plan, + :guidance_group, + :id, + :created_at, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :plan, + :guidance_group, + :id, + :created_at, + :updated_at, + :selected, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :plan, + :guidance_group, + :selected, + ].freeze + + # Overwrite this method to customize how plan guidance groups are displayed + # across all pages of the admin dashboard. + # + # def display_resource(plan_guidance_group) + # "PlanGuidanceGroup ##{plan_guidance_group.id}" + # end +end diff --git a/app/dashboards/question_dashboard.rb b/app/dashboards/question_dashboard.rb new file mode 100644 index 0000000..1d1f8aa --- /dev/null +++ b/app/dashboards/question_dashboard.rb @@ -0,0 +1,84 @@ +require "administrate/base_dashboard" + +class QuestionDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + answers: Field::HasMany, + question_options: Field::HasMany, + suggested_answers: Field::HasMany, + themes: Field::HasMany, + section: Field::BelongsTo, + question_format: Field::BelongsTo, + id: Field::Number, + text: Field::Text, + default_value: Field::Text, + guidance: Field::Text, + number: Field::Number, + created_at: Field::DateTime, + updated_at: Field::DateTime, + option_comment_display: Field::Boolean, + modifiable: Field::Boolean, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :answers, + :question_options, + :suggested_answers, + :themes, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :answers, + :question_options, + :suggested_answers, + :themes, + :section, + :question_format, + :id, + :text, + :default_value, + :guidance, + :number, + :created_at, + :updated_at, + :option_comment_display, + :modifiable, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :answers, + :question_options, + :suggested_answers, + :themes, + :section, + :question_format, + :text, + :default_value, + :guidance, + :number, + :option_comment_display, + :modifiable, + ].freeze + + # Overwrite this method to customize how questions are displayed + # across all pages of the admin dashboard. + # + # def display_resource(question) + # "Question ##{question.id}" + # end +end diff --git a/app/dashboards/question_format_dashboard.rb b/app/dashboards/question_format_dashboard.rb new file mode 100644 index 0000000..76bbff3 --- /dev/null +++ b/app/dashboards/question_format_dashboard.rb @@ -0,0 +1,63 @@ +require "administrate/base_dashboard" + +class QuestionFormatDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + questions: Field::HasMany, + id: Field::Number, + title: Field::String, + description: Field::Text, + created_at: Field::DateTime, + updated_at: Field::DateTime, + option_based: Field::Boolean, + formattype: Field::String.with_options(searchable: false), + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :questions, + :id, + :title, + :description, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :questions, + :id, + :title, + :description, + :created_at, + :updated_at, + :option_based, + :formattype, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :questions, + :title, + :description, + :option_based, + :formattype, + ].freeze + + # Overwrite this method to customize how question formats are displayed + # across all pages of the admin dashboard. + # + # def display_resource(question_format) + # "QuestionFormat ##{question_format.id}" + # end +end diff --git a/app/dashboards/question_option_dashboard.rb b/app/dashboards/question_option_dashboard.rb new file mode 100644 index 0000000..967a91d --- /dev/null +++ b/app/dashboards/question_option_dashboard.rb @@ -0,0 +1,63 @@ +require "administrate/base_dashboard" + +class QuestionOptionDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + question: Field::BelongsTo, + answers: Field::HasMany, + id: Field::Number, + text: Field::String, + number: Field::Number, + is_default: Field::Boolean, + created_at: Field::DateTime, + updated_at: Field::DateTime, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :question, + :answers, + :id, + :text, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :question, + :answers, + :id, + :text, + :number, + :is_default, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :question, + :answers, + :text, + :number, + :is_default, + ].freeze + + # Overwrite this method to customize how question options are displayed + # across all pages of the admin dashboard. + # + # def display_resource(question_option) + # "QuestionOption ##{question_option.id}" + # end +end diff --git a/app/dashboards/region_dashboard.rb b/app/dashboards/region_dashboard.rb new file mode 100644 index 0000000..851ad0e --- /dev/null +++ b/app/dashboards/region_dashboard.rb @@ -0,0 +1,62 @@ +require "administrate/base_dashboard" + +class RegionDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + sub_regions: Field::HasMany.with_options(class_name: "Region"), + super_region: Field::BelongsTo.with_options(class_name: "Region"), + id: Field::Number, + abbreviation: Field::String, + description: Field::String, + name: Field::String, + super_region_id: Field::Number, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :sub_regions, + :super_region, + :id, + :abbreviation, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :sub_regions, + :super_region, + :id, + :abbreviation, + :description, + :name, + :super_region_id, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :sub_regions, + :super_region, + :abbreviation, + :description, + :name, + :super_region_id, + ].freeze + + # Overwrite this method to customize how regions are displayed + # across all pages of the admin dashboard. + # + # def display_resource(region) + # "Region ##{region.id}" + # end +end diff --git a/app/dashboards/role_dashboard.rb b/app/dashboards/role_dashboard.rb new file mode 100644 index 0000000..0d8b9ea --- /dev/null +++ b/app/dashboards/role_dashboard.rb @@ -0,0 +1,57 @@ +require "administrate/base_dashboard" + +class RoleDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + user: Field::BelongsTo, + plan: Field::BelongsTo, + id: Field::Number, + created_at: Field::DateTime, + updated_at: Field::DateTime, + access: Field::Number, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :user, + :plan, + :id, + :created_at, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :user, + :plan, + :id, + :created_at, + :updated_at, + :access, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :user, + :plan, + :access, + ].freeze + + # Overwrite this method to customize how roles are displayed + # across all pages of the admin dashboard. + # + # def display_resource(role) + # "Role ##{role.id}" + # end +end diff --git a/app/dashboards/section_dashboard.rb b/app/dashboards/section_dashboard.rb new file mode 100644 index 0000000..2dfb78b --- /dev/null +++ b/app/dashboards/section_dashboard.rb @@ -0,0 +1,72 @@ +require "administrate/base_dashboard" + +class SectionDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + phase: Field::BelongsTo, + organisation: Field::BelongsTo, + questions: Field::HasMany, + id: Field::Number, + title: Field::String, + description: Field::Text, + number: Field::Number, + created_at: Field::DateTime, + updated_at: Field::DateTime, + published: Field::Boolean, + modifiable: Field::Boolean, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :phase, + :organisation, + :questions, + :id, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :phase, + :organisation, + :questions, + :id, + :title, + :description, + :number, + :created_at, + :updated_at, + :published, + :modifiable, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :phase, + :organisation, + :questions, + :title, + :description, + :number, + :published, + :modifiable, + ].freeze + + # Overwrite this method to customize how sections are displayed + # across all pages of the admin dashboard. + # + # def display_resource(section) + # "Section ##{section.id}" + # end +end diff --git a/app/dashboards/splash_log_dashboard.rb b/app/dashboards/splash_log_dashboard.rb new file mode 100644 index 0000000..ed549aa --- /dev/null +++ b/app/dashboards/splash_log_dashboard.rb @@ -0,0 +1,51 @@ +require "administrate/base_dashboard" + +class SplashLogDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + id: Field::Number, + destination: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :id, + :destination, + :created_at, + :updated_at, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :id, + :destination, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :destination, + ].freeze + + # Overwrite this method to customize how splash logs are displayed + # across all pages of the admin dashboard. + # + # def display_resource(splash_log) + # "SplashLog ##{splash_log.id}" + # end +end diff --git a/app/dashboards/suggested_answer_dashboard.rb b/app/dashboards/suggested_answer_dashboard.rb new file mode 100644 index 0000000..980ef11 --- /dev/null +++ b/app/dashboards/suggested_answer_dashboard.rb @@ -0,0 +1,60 @@ +require "administrate/base_dashboard" + +class SuggestedAnswerDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + org: Field::BelongsTo, + question: Field::BelongsTo, + id: Field::Number, + text: Field::Text, + is_example: Field::Boolean, + created_at: Field::DateTime, + updated_at: Field::DateTime, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :org, + :question, + :id, + :text, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :org, + :question, + :id, + :text, + :is_example, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :org, + :question, + :text, + :is_example, + ].freeze + + # Overwrite this method to customize how suggested answers are displayed + # across all pages of the admin dashboard. + # + # def display_resource(suggested_answer) + # "SuggestedAnswer ##{suggested_answer.id}" + # end +end diff --git a/app/dashboards/template_dashboard.rb b/app/dashboards/template_dashboard.rb new file mode 100644 index 0000000..cfaa8e0 --- /dev/null +++ b/app/dashboards/template_dashboard.rb @@ -0,0 +1,101 @@ +require "administrate/base_dashboard" + +class TemplateDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + org: Field::BelongsTo, + plans: Field::HasMany, + phases: Field::HasMany, + sections: Field::HasMany, + questions: Field::HasMany, + customizations: Field::HasMany.with_options(class_name: "Template"), + dmptemplate: Field::BelongsTo.with_options(class_name: "Template"), + setting_objects: Field::HasMany.with_options(class_name: "Settings::Template"), + id: Field::Number, + title: Field::String, + description: Field::Text, + published: Field::Boolean, + locale: Field::String, + is_default: Field::Boolean, + created_at: Field::DateTime, + updated_at: Field::DateTime, + version: Field::Number, + visibility: Field::Number, + customization_of: Field::Number, + dmptemplate_id: Field::Number, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :title, + :description, + :org, + :plans, + :phases, + :sections, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :org, + :plans, + :phases, + :sections, + :questions, + :customizations, + :dmptemplate, + :setting_objects, + :id, + :title, + :description, + :published, + :locale, + :is_default, + :created_at, + :updated_at, + :version, + :visibility, + :customization_of, + :dmptemplate_id, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :org, + :plans, + :phases, + :sections, + :questions, + :customizations, + :dmptemplate, + :setting_objects, + :title, + :description, + :published, + :locale, + :is_default, + :version, + :visibility, + :customization_of, + :dmptemplate_id, + ].freeze + + # Overwrite this method to customize how templates are displayed + # across all pages of the admin dashboard. + # + # def display_resource(template) + # "Template ##{template.id}" + # end +end diff --git a/app/dashboards/theme_dashboard.rb b/app/dashboards/theme_dashboard.rb new file mode 100644 index 0000000..40f8b3d --- /dev/null +++ b/app/dashboards/theme_dashboard.rb @@ -0,0 +1,63 @@ +require "administrate/base_dashboard" + +class ThemeDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + questions: Field::HasMany, + guidances: Field::HasMany, + id: Field::Number, + title: Field::String, + description: Field::Text, + created_at: Field::DateTime, + updated_at: Field::DateTime, + locale: Field::String, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :questions, + :guidances, + :id, + :title, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :questions, + :guidances, + :id, + :title, + :description, + :created_at, + :updated_at, + :locale, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :questions, + :guidances, + :title, + :description, + :locale, + ].freeze + + # Overwrite this method to customize how themes are displayed + # across all pages of the admin dashboard. + # + # def display_resource(theme) + # "Theme ##{theme.id}" + # end +end diff --git a/app/dashboards/token_permission_type_dashboard.rb b/app/dashboards/token_permission_type_dashboard.rb new file mode 100644 index 0000000..ce8d4ad --- /dev/null +++ b/app/dashboards/token_permission_type_dashboard.rb @@ -0,0 +1,57 @@ +require "administrate/base_dashboard" + +class TokenPermissionTypeDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + orgs: Field::HasMany, + id: Field::Number, + token_type: Field::String, + text_description: Field::Text, + created_at: Field::DateTime, + updated_at: Field::DateTime, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :orgs, + :id, + :token_type, + :text_description, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :orgs, + :id, + :token_type, + :text_description, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :orgs, + :token_type, + :text_description, + ].freeze + + # Overwrite this method to customize how token permission types are displayed + # across all pages of the admin dashboard. + # + # def display_resource(token_permission_type) + # "TokenPermissionType ##{token_permission_type.id}" + # end +end diff --git a/app/dashboards/user_dashboard.rb b/app/dashboards/user_dashboard.rb new file mode 100644 index 0000000..bd685f7 --- /dev/null +++ b/app/dashboards/user_dashboard.rb @@ -0,0 +1,162 @@ +require "administrate/base_dashboard" + +class UserDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + id: Field::Number, + firstname: Field::String, + surname: Field::String, + email: Field::String, + orcid_id: Field::String, + shibboleth_id: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + encrypted_password: Field::String, + reset_password_token: Field::String, + reset_password_sent_at: Field::DateTime, + remember_created_at: Field::DateTime, + sign_in_count: Field::Number, + current_sign_in_at: Field::DateTime, + last_sign_in_at: Field::DateTime, + current_sign_in_ip: Field::String, + last_sign_in_ip: Field::String, + confirmation_token: Field::String, + confirmed_at: Field::DateTime, + confirmation_sent_at: Field::DateTime, + invitation_token: Field::String, + invitation_created_at: Field::DateTime, + invitation_sent_at: Field::DateTime, + invitation_accepted_at: Field::DateTime, + other_organisation: Field::String, + dmponline3: Field::Boolean, + accept_terms: Field::Boolean, + api_token: Field::String, + invited_by: Field::Polymorphic, + perms: Field::HasMany, + language: Field::BelongsTo, + org: Field::BelongsTo, + answers: Field::HasMany, + notes: Field::HasMany, + exported_plans: Field::HasMany, + roles: Field::HasMany, + plans: Field::HasMany, + user_identifiers: Field::HasMany, + identifier_schemes: Field::HasMany, + setting_objects: Field::HasMany.with_options(class_name: "Settings::PlanList"), + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :firstname, + :surname, + :email, + :org, + :perms, + :confirmed_at, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :firstname, + :surname, + :email, + :org, + :perms, + :confirmed_at, + + :id, + :invited_by, + :language, + :answers, + :notes, + :exported_plans, + :roles, + :plans, + :user_identifiers, + :identifier_schemes, + :setting_objects, + :orcid_id, + :shibboleth_id, + :created_at, + :updated_at, + :encrypted_password, + :reset_password_token, + :reset_password_sent_at, + :remember_created_at, + :sign_in_count, + :current_sign_in_at, + :last_sign_in_at, + :current_sign_in_ip, + :last_sign_in_ip, + :confirmation_token, + :confirmation_sent_at, + :invitation_token, + :invitation_created_at, + :invitation_sent_at, + :invitation_accepted_at, + :other_organisation, + :dmponline3, + :accept_terms, + :api_token, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :invited_by, + :perms, + :language, + :org, + :answers, + :notes, + :exported_plans, + :roles, + :plans, + :user_identifiers, + :identifier_schemes, + :setting_objects, + :firstname, + :surname, + :email, + :orcid_id, + :shibboleth_id, + :encrypted_password, + :reset_password_token, + :reset_password_sent_at, + :remember_created_at, + :sign_in_count, + :current_sign_in_at, + :last_sign_in_at, + :current_sign_in_ip, + :last_sign_in_ip, + :confirmation_token, + :confirmed_at, + :confirmation_sent_at, + :invitation_token, + :invitation_created_at, + :invitation_sent_at, + :invitation_accepted_at, + :other_organisation, + :dmponline3, + :accept_terms, + :api_token, + ].freeze + + # Overwrite this method to customize how users are displayed + # across all pages of the admin dashboard. + # + # def display_resource(user) + # "User ##{user.id}" + # end +end diff --git a/app/dashboards/user_identifier_dashboard.rb b/app/dashboards/user_identifier_dashboard.rb new file mode 100644 index 0000000..181303e --- /dev/null +++ b/app/dashboards/user_identifier_dashboard.rb @@ -0,0 +1,57 @@ +require "administrate/base_dashboard" + +class UserIdentifierDashboard < Administrate::BaseDashboard + # ATTRIBUTE_TYPES + # a hash that describes the type of each of the model's fields. + # + # Each different type represents an Administrate::Field object, + # which determines how the attribute is displayed + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + user: Field::BelongsTo, + identifier_scheme: Field::BelongsTo, + id: Field::Number, + identifier: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + }.freeze + + # COLLECTION_ATTRIBUTES + # an array of attributes that will be displayed on the model's index page. + # + # By default, it's limited to four items to reduce clutter on index pages. + # Feel free to add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :user, + :identifier_scheme, + :id, + :identifier, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :user, + :identifier_scheme, + :id, + :identifier, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [ + :user, + :identifier_scheme, + :identifier, + ].freeze + + # Overwrite this method to customize how user identifiers are displayed + # across all pages of the admin dashboard. + # + # def display_resource(user_identifier) + # "UserIdentifier ##{user_identifier.id}" + # end +end diff --git a/app/views/admin/application/_admin_header.html.erb b/app/views/admin/application/_admin_header.html.erb new file mode 100644 index 0000000..6f7bcb5 --- /dev/null +++ b/app/views/admin/application/_admin_header.html.erb @@ -0,0 +1,10 @@ +
+
+
+ +
+
+
diff --git a/app/views/admin/application/_collection.html.erb b/app/views/admin/application/_collection.html.erb new file mode 100644 index 0000000..ed64ea7 --- /dev/null +++ b/app/views/admin/application/_collection.html.erb @@ -0,0 +1,83 @@ +<%# +# Collection + +This partial is used on the `index` and `show` pages +to display a collection of resources in an HTML table. + +## Local variables: + +- `collection_presenter`: + An instance of [Administrate::Page::Collection][1]. + The table presenter uses `ResourceDashboard::COLLECTION_ATTRIBUTES` to determine + the columns displayed in the table +- `resources`: + An ActiveModel::Relation collection of resources to be displayed in the table. + By default, the number of resources is limited by pagination + or by a hard limit to prevent excessive page load times + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection +%> + + + + + <% collection_presenter.attribute_types.each do |attr_name, attr_type| %> + + <% end %> + + + + + + <% resources.each do |resource| %> + + <% collection_presenter.attributes_for(resource).each do |attribute| %> + + <% end %> + + + + + + <% end %> + +
+ <%= link_to(sanitized_order_params.merge( + collection_presenter.order_params_for(attr_name) + )) do %> + <%= t( + "helpers.label.#{resource_name}.#{attr_name}", + default: attr_name.to_s, + ).titleize %> + + <% if collection_presenter.ordered_by?(attr_name) %> + + <%= svg_tag( + "administrate/sort_arrow.svg", + "sort_arrow", + width: "13", + height: "13" + ) %> + + <% end %> + <% end %> +
+ <%= render_field attribute %> + <%= link_to( + t("administrate.actions.edit"), + [:edit, namespace, resource], + class: "action-edit", + ) %><%= link_to( + t("administrate.actions.destroy"), + [namespace, resource], + class: "table__action--destroy", + method: :delete, + data: { confirm: t("administrate.actions.confirm") } + ) %>
diff --git a/app/views/admin/application/_form.html.erb b/app/views/admin/application/_form.html.erb new file mode 100644 index 0000000..cf991d0 --- /dev/null +++ b/app/views/admin/application/_form.html.erb @@ -0,0 +1,42 @@ +<%# +# Form Partial + +This partial is rendered on a resource's `new` and `edit` pages, +and renders all form fields for a resource's editable attributes. + +## Local variables: + +- `page`: + An instance of [Administrate::Page::Form][1]. + Contains helper methods to display a form, + and knows which attributes should be displayed in the resource's form. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Form +%> + +<%= form_for([namespace, page.resource], html: { class: "form" }) do |f| %> + <% if page.resource.errors.any? %> +
+

+ <%= pluralize(page.resource.errors.count, "error") %> + prohibited this <%= page.resource_name %> from being saved: +

+ + +
+ <% end %> + + <% page.attributes.each do |attribute| -%> +
+ <%= render_field attribute, f: f %> +
+ <% end -%> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/admin/application/_sidebar.html.erb b/app/views/admin/application/_sidebar.html.erb new file mode 100644 index 0000000..98adca4 --- /dev/null +++ b/app/views/admin/application/_sidebar.html.erb @@ -0,0 +1,26 @@ +<%# Hack for customisation %> +<%= render 'admin_header' %> + +<%# +# Sidebar + +This partial is used to display the sidebar in Administrate. +By default, the sidebar contains navigation links +for all resources in the admin dashboard, +as defined by the routes in the `admin/` namespace +%> + + diff --git a/app/views/admin/application/edit.html.erb b/app/views/admin/application/edit.html.erb new file mode 100644 index 0000000..4fac99a --- /dev/null +++ b/app/views/admin/application/edit.html.erb @@ -0,0 +1,31 @@ +<%# +# Edit + +This view is the template for the edit page. + +It displays a header, and renders the `_form` partial to do the heavy lifting. + +## Local variables: + +- `page`: + An instance of [Administrate::Page::Form][1]. + Contains helper methods to help display a form, + and knows which attributes should be displayed in the resource's form. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Form +%> + +<% content_for(:title) { "Edit #{page.page_title}" } %> + +
+

<%= content_for(:title) %>

+
+ <%= link_to( + "Show #{page.page_title}", + [namespace, page.resource], + class: "button", + ) %> +
+
+ +<%= render "form", page: page %> diff --git a/app/views/admin/application/index.html.erb b/app/views/admin/application/index.html.erb new file mode 100644 index 0000000..2dd2be7 --- /dev/null +++ b/app/views/admin/application/index.html.erb @@ -0,0 +1,45 @@ +<%# +# Index + +This view is the template for the index page. +It is responsible for rendering the search bar, header and pagination. +It renders the `_table` partial to display details about the resources. + +## Local variables: + +- `page`: + An instance of [Administrate::Page::Collection][1]. + Contains helper methods to help display a table, + and knows which attributes should be displayed in the resource's table. +- `resources`: + An instance of `ActiveRecord::Relation` containing the resources + that match the user's search criteria. + By default, these resources are passed to the table partial to be displayed. +- `search_term`: + A string containing the term the user has searched for, if any. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection +%> + +<% content_for(:title) do %> + <%= display_resource_name(page.resource_name) %> +<% end %> + +<% content_for(:search) do %> + <%= render "search", search_term: search_term %> +<% end %> + +
+

<%= content_for(:title) %>

+
+ <%= link_to( + "New #{page.resource_name.titleize.downcase}", + [:new, namespace, page.resource_name], + class: "button", + ) %> +
+
+ +<%= render "collection", collection_presenter: page, resources: resources %> + +<%= paginate resources %> diff --git a/app/views/admin/application/new.html.erb b/app/views/admin/application/new.html.erb new file mode 100644 index 0000000..7ff3f60 --- /dev/null +++ b/app/views/admin/application/new.html.erb @@ -0,0 +1,27 @@ +<%# +# New + +This view is the template for the "new resource" page. +It displays a header, and then renders the `_form` partial +to do the heavy lifting. + +## Local variables: + +- `page`: + An instance of [Administrate::Page::Form][1]. + Contains helper methods to help display a form, + and knows which attributes should be displayed in the resource's form. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Form +%> + +<% content_for(:title) { "New #{page.resource_name.titleize}" } %> + +
+

<%= content_for(:title) %>

+
+ <%= link_to 'Back', :back, class: "button" %> +
+
+ +<%= render 'form', page: page %> diff --git a/app/views/admin/application/show.html.erb b/app/views/admin/application/show.html.erb new file mode 100644 index 0000000..b4e453b --- /dev/null +++ b/app/views/admin/application/show.html.erb @@ -0,0 +1,44 @@ +<%# +# Show + +This view is the template for the show page. +It renders the attributes of a resource, +as well as a link to its edit page. + +## Local variables: + +- `page`: + An instance of [Administrate::Page::Show][1]. + Contains methods for accessing the resource to be displayed on the page, + as well as helpers for describing how each attribute of the resource + should be displayed. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show +%> + +<% content_for(:title) { page.page_title } %> + +
+

<%= content_for(:title) %>

+
+ <%= link_to( + "Edit", + [:edit, namespace, page.resource], + class: "button", + ) %> +
+
+ +
+ <% page.attributes.each do |attribute| %> +
+ <%= t( + "helpers.label.#{resource_name}.#{attribute.name}", + default: attribute.name.titleize, + ) %> +
+ +
<%= render_field attribute %>
+ <% end %> +
diff --git a/app/views/admin/dmptemplates/settings.html.erb b/app/views/admin/dmptemplates/settings.html.erb deleted file mode 100644 index df9557e..0000000 --- a/app/views/admin/dmptemplates/settings.html.erb +++ /dev/null @@ -1,42 +0,0 @@ -<% @settings.errors.full_messages.each do |error| %> -
<%= error %>
-<% end %> - -<%= form_for(@settings, url: update_settings_admin_dmptemplate_path(@template), method: :put, as: 'settings[export][formatting]', html: { class: 'formtastic' }) do |f| %> -
- <%= _('Formatting') %> -
    -
  1. - <%= f.label(:font_face, _('Face')) %> - <%= f.select(:font_face, options_for_select(Settings::Dmptemplate::VALID_FONT_FACES, @settings.formatting[:font_face]), as: 'formatting[font_face]') %> - <%= f.select(:font_size, options_for_select((1..36).to_a, @settings.formatting[:font_size])) %>pt -
  2. -
  3. - <%= f.label(_('Margin')) %> - <%= _('Top') -%> - <%= select_tag("settings[export][formatting][margin][top]", options_for_select((0..100).to_a, @settings.formatting[:margin][:top])) %> - <%= _('Bottom') -%> - <%= select_tag("settings[export][formatting][margin][bottom]", options_for_select((0..100).to_a, @settings.formatting[:margin][:bottom])) %> - <%= _('Left') -%> - <%= select_tag("settings[export][formatting][margin][left]", options_for_select((0..100).to_a, @settings.formatting[:margin][:left])) %> - <%= _('Right') -%> - <%= select_tag("settings[export][formatting][margin][right]", options_for_select((0..100).to_a, @settings.formatting[:margin][:right])) %> -
  4. -
-
- -
- <%= _('Max Pages')%> -
    -
  1. - <%= label_tag('settings_export_max_pages', _('Maximum number of pages')) %> - <%= select_tag('settings[export][max_pages]', options_for_select((1..10).to_a, @settings.max_pages)) %> -
  2. -
-
- -
- <%= submit_tag(_('Save'), class: 'btn btn-primary') %> - <%= submit_tag(_('Reset'), class: 'btn btn-primary') %> -
-<% end %> diff --git a/config/initializers/active_admin.rb b/config/initializers/active_admin.rb deleted file mode 100644 index 2e1c9c6..0000000 --- a/config/initializers/active_admin.rb +++ /dev/null @@ -1,274 +0,0 @@ -ActiveAdmin.setup do |config| - # == Site Title - # - # Set the title that is displayed on the main layout - # for each of the active admin pages. - # - config.site_title = "DMPRoadmap" - - # Set the link url for the title. For example, to take - # users to your main site. Defaults to no link. - # - config.site_title_link = "/" - - # Set an optional image to be displayed for the header - # instead of a string (overrides :site_title) - # - # Note: Aim for an image that's 21px high so it fits in the header. - # - # config.site_title_image = "logo.png" - - # == Default Namespace - # - # Set the default namespace each administration resource - # will be added to. - # - # eg: - # config.default_namespace = :hello_world - # - # This will create resources in the HelloWorld module and - # will namespace routes to /hello_world/* - # - # To set no namespace by default, use: - # config.default_namespace = false - # - # Default: - # config.default_namespace = :admin - # - # You can customize the settings for each namespace by using - # a namespace block. For example, to change the site title - # within a namespace: - # - # config.namespace :admin do |admin| - # admin.site_title = "Custom Admin Title" - # end - # - # This will ONLY change the title for the admin section. Other - # namespaces will continue to use the main "site_title" configuration. - - # == User Authentication - # - # Active Admin will automatically call an authentication - # method in a before filter of all controller actions to - # ensure that there is a currently logged in admin user. - # - # This setting changes the method which Active Admin calls - # within the application controller. - # config.authentication_method = :authenticate_admin_user! - config.authentication_method = :authenticate_admin! - - # == User Authorization - # - # Active Admin will automatically call an authorization - # method in a before filter of all controller actions to - # ensure that there is a user with proper rights. You can use - # CanCanAdapter or make your own. Please refer to documentation. - # config.authorization_adapter = ActiveAdmin::CanCanAdapter - - # In case you prefer Pundit over other solutions you can here pass - # the name of default policy class. This policy will be used in every - # case when Pundit is unable to find suitable policy. - # config.pundit_default_policy = "MyDefaultPunditPolicy" - - # You can customize your CanCan Ability class name here. - # config.cancan_ability_class = "Ability" - - # You can specify a method to be called on unauthorized access. - # This is necessary in order to prevent a redirect loop which happens - # because, by default, user gets redirected to Dashboard. If user - # doesn't have access to Dashboard, he'll end up in a redirect loop. - # Method provided here should be defined in application_controller.rb. - # config.on_unauthorized_access = :access_denied - - # == Current User - # - # Active Admin will associate actions with the current - # user performing them. - # - # This setting changes the method which Active Admin calls - # (within the application controller) to return the currently logged in user. - # config.current_user_method = :current_admin_user - config.current_user_method = :current_user - - # == Logging Out - # - # Active Admin displays a logout link on each screen. These - # settings configure the location and method used for the link. - # - # This setting changes the path where the link points to. If it's - # a string, the strings is used as the path. If it's a Symbol, we - # will call the method to return the path. - # - # Default: - config.logout_link_path = :destroy_user_session_path - - # This setting changes the http method used when rendering the - # link. For example :get, :delete, :put, etc.. - # - # Default: - # config.logout_link_method = :get - - # == Root - # - # Set the action to call for the root path. You can set different - # roots for each namespace. - # - # Default: - # config.root_to = 'dashboard#index' - - # == Admin Comments - # - # This allows your users to comment on any resource registered with Active Admin. - # - # You can completely disable comments: - # config.comments = false - # - # You can change the name under which comments are registered: - # config.comments_registration_name = 'AdminComment' - # - # You can change the order for the comments and you can change the column - # to be used for ordering: - # config.comments_order = 'created_at ASC' - # - # You can disable the menu item for the comments index page: - config.comments_menu = false - # - # You can customize the comment menu: - # config.comments_menu = { parent: 'Admin', priority: 1 } - - # == Batch Actions - # - # Enable and disable Batch Actions - # - config.batch_actions = true - - # == Controller Filters - # - # You can add before, after and around filters to all of your - # Active Admin resources and pages from here. - # - # config.before_filter :do_something_awesome - - # == Localize Date/Time Format - # - # Set the localize format to display dates and times. - # To understand how to localize your app with I18n, read more at - # https://github.com/svenfuchs/i18n/blob/master/lib%2Fi18n%2Fbackend%2Fbase.rb#L52 - # - config.localize_format = :long - - # == Setting a Favicon - # - # config.favicon = 'favicon.ico' - - # == Meta Tags - # - # Add additional meta tags to the head element of active admin pages. - # - # Add tags to all pages logged in users see: - # config.meta_tags = { author: 'My Company' } - - # By default, sign up/sign in/recover password pages are excluded - # from showing up in search engine results by adding a robots meta - # tag. You can reset the hash of meta tags included in logged out - # pages: - # config.meta_tags_for_logged_out_pages = {} - - # == Removing Breadcrumbs - # - # Breadcrumbs are enabled by default. You can customize them for individual - # resources or you can disable them globally from here. - # - # config.breadcrumb = false - - # == Register Stylesheets & Javascripts - # - # We recommend using the built in Active Admin layout and loading - # up your own stylesheets / javascripts to customize the look - # and feel. - # - # To load a stylesheet: - # config.register_stylesheet 'my_stylesheet.css' - # - # You can provide an options hash for more control, which is passed along to stylesheet_link_tag(): - # config.register_stylesheet 'my_print_stylesheet.css', media: :print - # - # To load a javascript file: - # config.register_javascript 'my_javascript.js' - - # == CSV options - # - # Set the CSV builder separator - # config.csv_options = { col_sep: ';' } - # - # Force the use of quotes - # config.csv_options = { force_quotes: true } - - # == Menu System - # - # You can add a navigation menu to be used in your application, or configure a provided menu - # - # To change the default utility navigation to show a link to your website & a logout btn - # - # config.namespace :admin do |admin| - # admin.build_menu :utility_navigation do |menu| - # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank } - # admin.add_logout_button_to_menu menu - # end - # end - # - # If you wanted to add a static menu item to the default menu provided: - # - # config.namespace :admin do |admin| - # admin.build_menu :default do |menu| - # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank } - # end - # end - - # == Download Links - # - # You can disable download links on resource listing pages, - # or customize the formats shown per namespace/globally - # - # To disable/customize for the :admin namespace: - # - # config.namespace :admin do |admin| - # - # # Disable the links entirely - # admin.download_links = false - # - # # Only show XML & PDF options - # admin.download_links = [:xml, :pdf] - # - # # Enable/disable the links based on block - # # (for example, with cancan) - # admin.download_links = proc { can?(:view_download_links) } - # - # end - - # == Pagination - # - # Pagination is enabled by default for all resources. - # You can control the default per page count for all resources here. - # - # config.default_per_page = 30 - # - # You can control the max per page count too. - # - # config.max_per_page = 10_000 - - # == Filters - # - # By default the index screen includes a "Filters" sidebar on the right - # hand side with a filter for each attribute of the registered model. - # You can enable or disable them for all resources here. - # - # config.filters = true - # - # By default the filters include associations in a select, which means - # that every record will be loaded for each association. - # You can enabled or disable the inclusion - # of those filters by default here. - # - # config.include_default_association_filters = true -end \ No newline at end of file diff --git a/config/initializers/formtastic.rb b/config/initializers/formtastic.rb deleted file mode 100644 index 3cf1aef..0000000 --- a/config/initializers/formtastic.rb +++ /dev/null @@ -1,79 +0,0 @@ -# encoding: utf-8 - -# Set the default text field size when input is a string. Default is nil. -# Formtastic::FormBuilder.default_text_field_size = 50 - -# Set the default text area height when input is a text. Default is 20. -# Formtastic::FormBuilder.default_text_area_height = 5 - -# Set the default text area width when input is a text. Default is nil. -# Formtastic::FormBuilder.default_text_area_width = 50 - -# Should all fields be considered "required" by default? -# Defaults to true. -# Formtastic::FormBuilder.all_fields_required_by_default = true - -# Should select fields have a blank option/prompt by default? -# Defaults to true. -# Formtastic::FormBuilder.include_blank_for_select_by_default = true - -# Set the string that will be appended to the labels/fieldsets which are required -# It accepts string or procs and the default is a localized version of -# '*'. In other words, if you configure formtastic.required -# in your locale, it will replace the abbr title properly. But if you don't want to use -# abbr tag, you can simply give a string as below -# Formtastic::FormBuilder.required_string = "(required)" - -# Set the string that will be appended to the labels/fieldsets which are optional -# Defaults to an empty string ("") and also accepts procs (see required_string above) -# Formtastic::FormBuilder.optional_string = "(optional)" - -# Set the way inline errors will be displayed. -# Defaults to :sentence, valid options are :sentence, :list, :first and :none -# Formtastic::FormBuilder.inline_errors = :sentence -# Formtastic uses the following classes as default for hints, inline_errors and error list - -# If you override the class here, please ensure to override it in your stylesheets as well -# Formtastic::FormBuilder.default_hint_class = "inline-hints" -# Formtastic::FormBuilder.default_inline_error_class = "inline-errors" -# Formtastic::FormBuilder.default_error_list_class = "errors" - -# Set the method to call on label text to transform or format it for human-friendly -# reading when formtastic is used without object. Defaults to :humanize. -# Formtastic::FormBuilder.label_str_method = :humanize - -# Set the array of methods to try calling on parent objects in :select and :radio inputs -# for the text inside each @