diff --git a/Gemfile b/Gemfile index b7558d85d..aeeb9e7df 100644 --- a/Gemfile +++ b/Gemfile @@ -29,17 +29,6 @@ gem 'bourbon', '~> 4.2.2' gem 'draper' gem "kt-paperclip", "~> 6.4", ">= 6.4.1" gem 'aws-sdk-s3' -gem 'rails_admin','~> 2.2.1' -# gem 'rails_admin', git: 'https://github.com/enmand/rails_admin.git' -# rails_admin 1.1.1 has a transitive dependency on haml (~> 4.0). haml 4.0.7 in -# turn has a transitive dependency on tile and does not specify a version range. -# This causes it to pull in tilt 2.6.0 which is incompatible with haml 4.0.7. So -# specifying tilt as a direct dependency with a version range that is compatible -# with haml 4.0.7. We can remove this as soon we get upgrade to a newer version -# of rails_admin that should pull in a newer version of haml, breaking this -# dependency chain. -gem 'tilt', '~> 2.4.0' - gem 'puma', '~> 5.6' # Add Puma as the web server diff --git a/Gemfile.lock b/Gemfile.lock index 889118ed8..c2e68a4d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -184,9 +184,6 @@ GEM foundation_emails (2.2.1.0) globalid (1.1.0) activesupport (>= 5.0) - haml (5.2.2) - temple (>= 0.8.0) - tilt htmlentities (4.3.4) httparty (0.23.1) csv @@ -213,22 +210,8 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - jquery-ui-rails (6.0.1) - railties (>= 3.2.16) json (2.13.2) jwt (1.2.1) - kaminari (1.2.2) - activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.2) - kaminari-activerecord (= 1.2.2) - kaminari-core (= 1.2.2) - kaminari-actionview (1.2.2) - actionview - kaminari-core (= 1.2.2) - kaminari-activerecord (1.2.2) - activerecord - kaminari-core (= 1.2.2) - kaminari-core (1.2.2) kt-paperclip (6.4.2) activemodel (>= 4.2.0) activesupport (>= 4.2.0) @@ -268,7 +251,6 @@ GEM neat (1.7.1) bourbon (>= 4.0) sass (>= 3.3) - nested_form (0.3.2) net-imap (0.4.22) date net-protocol @@ -311,9 +293,6 @@ GEM rack (2.2.17) rack-cors (2.0.2) rack (>= 2.0.0) - rack-pjax (1.1.0) - nokogiri (~> 1.5) - rack (>= 1.1) rack-test (2.2.0) rack (>= 1.3) rails (6.1.7.10) @@ -338,18 +317,6 @@ GEM rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - rails_admin (2.2.1) - activemodel-serializers-xml (>= 1.0) - builder (~> 3.1) - haml (>= 4.0, < 6) - jquery-rails (>= 3.0, < 5) - jquery-ui-rails (>= 5.0, < 7) - kaminari (>= 0.14, < 2.0) - nested_form (~> 0.3) - rack-pjax (>= 0.7) - rails (>= 5.0, < 7) - remotipart (~> 1.3) - sassc-rails (>= 1.3, < 3) railties (6.1.7.10) actionpack (= 6.1.7.10) activesupport (= 6.1.7.10) @@ -366,7 +333,6 @@ GEM regexp_parser (2.11.2) reline (0.6.2) io-console (~> 0.5) - remotipart (1.4.4) request_store (1.7.0) rack (>= 1.4) responders (3.1.1) @@ -437,7 +403,6 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) stringio (3.1.7) - temple (0.10.3) terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) thor (1.4.0) @@ -511,7 +476,6 @@ DEPENDENCIES puma (~> 5.6) rack-cors rails (~> 6.1.7) - rails_admin (~> 2.2.1) rspec-rails sassc-rails (>= 2.1.2) search_cop (~> 1.0.6) @@ -521,7 +485,6 @@ DEPENDENCIES simplecov simplecov_json_formatter sprockets-rails (~> 3.2.2) - tilt (~> 2.4.0) uglifier wicked will_paginate (~> 3.1.7) diff --git a/app/controllers/admins/base_controller.rb b/app/controllers/admins/base_controller.rb deleted file mode 100644 index 53cd5811e..000000000 --- a/app/controllers/admins/base_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Admins::BaseController < ActionController::Base - before_action :authenticate_admin! - def show - redirect_to rails_admin_path - end -end \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7b88a2ee1..91c195227 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -24,7 +24,8 @@ def authenticate_user! flash[:notice] = 'We have migrated our data to a new system. '\ 'Please click the link below to reset your password.' end - admin_request? ? rails_admin_path : super + + super end # IMPERSONATE USER @@ -37,16 +38,12 @@ def current_user end end - def admin_request? - params['controller'].include?('rails_admin') || params['controller'].include?('ckeditor') - end - def after_sign_in_path_for(resource) - resource.class.name == 'User' ? root_path : admins_root_path + root_path end def after_sign_out_path_for(resource) - resource == :admin ? rails_admin_path : new_user_session_path + new_user_session_path end def current_api_user diff --git a/app/models/categorizable_item.rb b/app/models/categorizable_item.rb index 9ab161a1a..0fa9da739 100644 --- a/app/models/categorizable_item.rb +++ b/app/models/categorizable_item.rb @@ -5,9 +5,4 @@ class CategorizableItem < ApplicationRecord # Attr Accessor attr_accessor :_create - - # Rails Admin - rails_admin do - exclude_fields :legacy - end end diff --git a/app/models/category.rb b/app/models/category.rb index e1a65cebe..02aa7e3df 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -7,8 +7,4 @@ class Category < ApplicationRecord scope :published, -> { where(published: true) } # Validations validates_presence_of :name, uniqueness: true - - rails_admin do - exclude_fields :categorizable_items, :legacy - end end diff --git a/app/models/form.rb b/app/models/form.rb index c42c63b3d..d0044eb16 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -8,11 +8,6 @@ class Form < ApplicationRecord # Nested Attrs accepts_nested_attributes_for :form_fields, allow_destroy: true - # Rails Admin - rails_admin do - exclude_fields :form_builder_id, :reports, :user_forms, form_fields: [:form] - end - def name owner ? "#{owner.try(:name)} Form" : 'New Form' end diff --git a/app/models/form_builder.rb b/app/models/form_builder.rb index cbdd593ff..e7f0125b0 100644 --- a/app/models/form_builder.rb +++ b/app/models/form_builder.rb @@ -5,10 +5,6 @@ class FormBuilder < ApplicationRecord belongs_to :windows_type accepts_nested_attributes_for :forms - rails_admin do - exclude_fields :owner_type, forms: [:owner, :owner_id, :owner_type, :owner] - end - scope :workshop_logs, -> { where('name LIKE ?', '%Log%') } scope :monthly, -> { where('name LIKE ?', '%monthly%') } diff --git a/app/models/form_field.rb b/app/models/form_field.rb index 04c8d5819..7391ed241 100644 --- a/app/models/form_field.rb +++ b/app/models/form_field.rb @@ -30,10 +30,6 @@ class FormField < ApplicationRecord :date, ] - rails_admin do - # exclude_fields :answer_options - end - accepts_nested_attributes_for :form_field_answer_options default_scope { order(ordering: :desc) } diff --git a/app/models/monthly_report.rb b/app/models/monthly_report.rb index 30c354bad..29a2872f5 100644 --- a/app/models/monthly_report.rb +++ b/app/models/monthly_report.rb @@ -1,68 +1,5 @@ class MonthlyReport < Report - rails_admin do - configure :created_at do - show - end - configure :updated_at do - show - end - - list do - field :id - field :type - field :created_at do - column_width 200 - end - field :project do - searchable true - queryable true - searchable [:name] - end - field :date do - label do - "Month" - end - strftime_format "%m" - filterable true - searchable true - queryable true - column_width 110 - end - field :windows_type do - filterable false - visible false - end - field :on_going_participants do - column_width 10 - end - field :new_participants do - column_width 10 - end - field :has_attachment do - filterable true - searchable true - column_width 40 - end - configure :on_going_participants do - formatted_value{ bindings[:object].on_going_participants} - end - - configure :new_participants do - formatted_value{ bindings[:object].new_participants} - end - - configure :type do - formatted_value{ bindings[:object].admin_type} - end - - configure :date do - formatted_value{ bindings[:object].month} - end - - end - end - def on_going_participants if form_builder field = form_builder.form_fields.find_by(question: 'Total # On-going Participants', status: 1) @@ -81,5 +18,4 @@ def month date.strftime("%B") end - end diff --git a/app/models/project.rb b/app/models/project.rb index 5147d9002..65f065257 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -8,27 +8,6 @@ class Project < ApplicationRecord has_many :workshop_logs, through: :users belongs_to :project_status - # Rails Admin - rails_admin do - list do - exclude_fields :windows_type - end - edit do - exclude_fields :users, :project_users, :reports, :workshop_logs, :windows_type - group 'More Fields' do - active false - field :location - field :district - field :start_date - field :end_date - field :locality - field :description - field :notes - field :legacy - end - end - end - # Methods def led_by?(user) return false unless leader diff --git a/app/models/project_user.rb b/app/models/project_user.rb index b9489e97b..1e23b9d98 100644 --- a/app/models/project_user.rb +++ b/app/models/project_user.rb @@ -9,10 +9,6 @@ class ProjectUser < ApplicationRecord # Enum enum position: [:default, :liaison, :leader, :assistant] - # Rails admin - rails_admin do - exclude_fields :agency_id, :position - end # Methods def name diff --git a/app/models/quote.rb b/app/models/quote.rb index 6dd5b46af..5b34347c7 100644 --- a/app/models/quote.rb +++ b/app/models/quote.rb @@ -1,16 +1,5 @@ class Quote < ApplicationRecord scope :active, -> { where(inactive: false) } - rails_admin do - field :quote - field :speaker_name do - label 'Speaker' - end - field :inactive - field :legacy - field :workshop_id - field :age - field :gender - end def speaker speaker_name.nil? || speaker_name.empty? ? "Participant" : speaker_name diff --git a/app/models/report.rb b/app/models/report.rb index 0e6aea4bd..7d5ee4307 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -37,25 +37,6 @@ class Report < ApplicationRecord after_create :set_windows_type after_save :create_admin_notification - rails_admin do - configure :owner do - hide - end - list do - field :id - field :type - field :windows_type do - filterable true - queryable true - searchable [:name] - end - field :user - field :project - field :created_at - end - - end - def users_admin_type if form_builder && form_builder.id == 7 "Story" diff --git a/app/models/resource.rb b/app/models/resource.rb index 36bf51ef2..4aa830ab2 100644 --- a/app/models/resource.rb +++ b/app/models/resource.rb @@ -37,19 +37,6 @@ class Resource < ApplicationRecord accepts_nested_attributes_for :attachments, reject_if: :all_blank, allow_destroy: true accepts_nested_attributes_for :form, reject_if: :all_blank, allow_destroy: true - # Rails Admin - rails_admin do - exclude_fields :sectorable_items, :categorizable_items, :reports, :user_forms, :related_workshops, :filemaker_code, :legacy - field :text, :ck_editor - - list do - configure :title do - formatted_value{ "#{bindings[:object].title} - [ #{bindings[:object].kind.upcase} ]" } - end - end - - end - # Search Cop include SearchCop diff --git a/app/models/sector.rb b/app/models/sector.rb index 447a12c2d..586673304 100644 --- a/app/models/sector.rb +++ b/app/models/sector.rb @@ -13,11 +13,6 @@ class Sector < ApplicationRecord # ATTR Accessor attr_accessor :_create - # Rails Admin - rails_admin do - exclude_fields :workshops - end - default_scope { order('name') } # Methods diff --git a/app/models/story.rb b/app/models/story.rb index ff7488bed..0b1afa09f 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -1,37 +1,2 @@ class Story < Report - rails_admin do - configure :owner do - hide - end - list do - field :id do - column_width 50 - end - field :type do - column_width 50 - end - - field :windows_type do - filterable true - queryable true - searchable [:name] - column_width 110 - end - field :user do - column_width 90 - end - field :project do - column_width 120 - end - field :created_at do - column_width 120 - end - field :has_attachment do - filterable true - searchable true - column_width 10 - end - - end - end end diff --git a/app/models/user.rb b/app/models/user.rb index 59859b0c4..a04049d65 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,10 +1,3 @@ -RailsAdmin.config do |config| - config.model Report do - object_label_method do - :users_admin_type - end - end -end class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable @@ -35,148 +28,6 @@ class User < ApplicationRecord has_many :colleagues, -> { select(:user_id, :position, :project_id).distinct }, through: :projects, source: :project_users has_many :notifications, as: :noticeable - # Rails Admin - rails_admin do - exclude_fields :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, :reset, :workshops, :workshop_logs, - :bookmarks, :projects, :permissions, :user_permissions, :colleagues, - :notifications, :user_form_form_fields, :resources, :communal_reports, - :user_forms, :windows_types, :birthday - field :reports do - label do - 'Communal Reports' - end - end - - edit do - include_fields :first_name, :last_name, :email, :password, :password_confirmation, :reset_password_token - group 'More Fields' do - active false - field :agency_id - field :phone - field :address - field :city - field :state - field :zip - field :subscribecode - field :comment - field :notes - field :legacy - field :legacy_id - field :confirmed - field :phone2 - field :phone3 - field :best_time_to_call - field :address2 - field :city2 - field :state2 - field :zip2 - field :primary_address - field :avatar - end - end - - list do - field :password do - filterable false - visible false - end - field :password_confirmation do - filterable false - visible false - end - field :reset_password_token do - filterable false - visible false - end - field :agency_id do - filterable false - visible false - end - field :phone do - filterable false - visible false - end - field :address do - filterable false - visible false - end - field :city do - filterable false - visible false - end - field :state do - filterable false - visible false - end - field :zip do - filterable false - visible false - end - field :subscribecode do - filterable false - visible false - end - field :comment do - filterable false - visible false - end - field :notes do - filterable false - visible false - end - field :legacy do - filterable false - visible false - end - field :legacy_id do - filterable false - visible false - end - field :confirmed do - filterable false - visible false - end - field :phone2 do - filterable false - visible false - end - field :phone3 do - filterable false - visible false - end - field :best_time_to_call do - filterable false - visible false - end - field :address2 do - filterable false - visible false - end - field :city2 do - filterable false - visible false - end - field :state2 do - filterable false - visible false - end - field :zip2 do - filterable false - visible false - end - field :primary_address do - filterable false - visible false - end - field :avatar do - filterable false - visible false - end - end - end - # Nested accepts_nested_attributes_for :user_forms accepts_nested_attributes_for :project_users, reject_if: :all_blank, allow_destroy: true diff --git a/app/models/windows_type.rb b/app/models/windows_type.rb index 627d6af39..42316627c 100644 --- a/app/models/windows_type.rb +++ b/app/models/windows_type.rb @@ -39,10 +39,6 @@ def log_label id != 3 ? "(#{name.split(' ')[0]})" : '' end - rails_admin do - exclude_fields :short_name - end - private def self.symbolize(name) diff --git a/app/models/workshop.rb b/app/models/workshop.rb index 1893b6723..7c0109c06 100644 --- a/app/models/workshop.rb +++ b/app/models/workshop.rb @@ -92,399 +92,6 @@ class Workshop < ApplicationRecord attributes sector: ['sectors.name'] end - # Rails Admin - rails_admin do - field :english_anchors do - help false - end - field :spanish_anchors do - help false - end - field :title - field :created_at - field :full_name do - label 'Author' - end - - field :month - field :year - field :featured - - field :extra_field, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - - field :objective, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - - field :materials, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - - field :optional_materials, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :age_range - - field :setup, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - - field :introduction, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - - field :time_intro do - label 'Time Frame Introduction' - end - - field :demonstration, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - - field :time_demonstration do - label 'Time Frame Demo' - end - - field :opening_circle, :ck_editor do - label do - "Opening
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - - field :time_opening do - label 'Time Frame Opening' - end - - field :warm_up, :ck_editor do - label do - "Warm-up / Relaxation / Meditation
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - - field :time_warm_up do - label 'Time Frame Warm Up' - end - - field :visualization, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - - field :creation, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - - field :time_creation do - label 'Time Frame Creation' - end - - field :closing, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - - field :time_closing do - label 'Time Frame Closing' - end - - field :notes, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :tips, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :misc1, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :misc2, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - field :extra_field_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - field :objective_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :materials_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :optional_materials_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :timeframe_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :age_range_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :setup_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :introduction_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :demonstration_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - field :opening_circle_spanish, :ck_editor do - label do - "Opening Spanish
Back To Top".html_safe - end - pretty_value do - value.html_safe unless value.nil? - end - end - field :warm_up_spanish, :ck_editor do - label do - "Warm-up / Relaxation / Meditation Spanish
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - field :visualization_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - field :creation_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - field :closing_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - field :notes_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - field :tips_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - field :misc1_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - field :misc2_spanish, :ck_editor do - label do - "#{label}
Back To Top".html_safe - end - - pretty_value do - value.html_safe unless value.nil? - end - end - - field :workshop_variations - field :sectorable_items - field :categories - field :quotes - field :images - field :inactive - field :windows_type - field :header - field :thumbnail - field :legacy - - object_label_method do - :admin_title - end - - show do - field :month - field :year - field :english_anchors do - visible false - end - - field :spanish_anchors do - visible false - end - - end - - list do - sort_by :created_at - - field :created_at do - sort_reverse true - end - - configure :title do - formatted_value{ bindings[:object].admin_title } - end - field :english_anchors do - visible false - end - - field :spanish_anchors do - visible false - end - end - - exclude_fields :categorizable_items, :quotable_item_quotes, :timestamps, - :workshop_resources, :resources, :legacy_id, :workshop_age_ranges, - :workshop_logs, :metadata, :bookmarks, :user, :misc1, :misc2, :reports - - end - def date if month.nil? or year.nil? "#{created_at.month}/#{created_at.year}" diff --git a/app/models/workshop_idea.rb b/app/models/workshop_idea.rb index 6aea7d8aa..8832a383d 100644 --- a/app/models/workshop_idea.rb +++ b/app/models/workshop_idea.rb @@ -2,254 +2,4 @@ class WorkshopIdea < Workshop default_scope { where(inactive: true) } - # Rails Admin - rails_admin do - field :title - field :created_at - field :full_name do - label 'Author' - end - - field :month - field :year - field :featured - field :objective, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - - field :materials, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - - field :optional_materials, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :age_range - field :setup, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :introduction, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - - field :time_intro do - label 'Time Frame Introduction' - end - - field :demonstration, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - - field :time_demonstration do - label 'Time Frame Demo' - end - - field :opening_circle, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - label 'Opening' - end - - field :time_opening do - label 'Time Frame Opening' - end - - field :warm_up, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - label 'Warm-up / Relaxation / Meditation' - end - - field :time_warm_up do - label 'Time Frame Warm Up' - end - - field :visualization, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - - field :creation, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - - field :time_creation do - label 'Time Frame Creation' - end - - field :closing, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - - field :time_closing do - label 'Time Frame Closing' - end - - field :notes, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :tips, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :misc1, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :misc2, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - - field :objective_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :materials_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :optional_materials_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :timeframe_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :age_range_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :setup_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :introduction_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :demonstration_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :opening_circle_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - - label 'Opening Spanish' - end - field :warm_up_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - label 'Warm-up / Relaxation / Meditation Spanish' - end - field :visualization_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :creation_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :closing_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :notes_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :tips_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :misc1_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - field :misc2_spanish, :ck_editor do - pretty_value do - value.html_safe unless value.nil? - end - end - - field :workshop_variations - field :sectorable_items - field :categories - field :quotes - field :images - field :inactive - field :windows_type - field :header - field :thumbnail - field :legacy - - object_label_method do - :admin_title - end - - show do - field :month - field :year - end - - list do - sort_by :created_at - - field :created_at do - sort_reverse true - end - - configure :title do - formatted_value{ bindings[:object].admin_title } - end - end - - exclude_fields :categorizable_items, :quotable_item_quotes, :timestamps, - :workshop_resources, :resources, :legacy_id, :workshop_age_ranges, - :workshop_logs, :metadata, :bookmarks, :user, :misc1, :misc2, :reports - - end - end diff --git a/app/models/workshop_log.rb b/app/models/workshop_log.rb index 07d49d4b3..c58b7a012 100644 --- a/app/models/workshop_log.rb +++ b/app/models/workshop_log.rb @@ -8,125 +8,6 @@ class WorkshopLog < Report # Callbacks after_save :update_workshop_log_count - rails_admin do - configure :created_at do - show - end - configure :updated_at do - show - end - - list do - field :id - field :type - field :workshop_name do - label 'owner' - filterable true - searchable true - queryable true - end - field :windows_type do - filterable true - visible false - queryable true - searchable [:short_name] - end - field :created_at - field :updated_at - field :user do - queryable true - searchable [:first_name, :last_name] - end - - configure :workshop_name do - formatted_value{ bindings[:object].owner_title} - end - - configure :type do - formatted_value{ bindings[:object].type_title} - end - - exclude_fields :type - end - - show do - field :owner - field :user - field :project - field :date - field :rating - field :children_ongoing - field :teens_ongoing - field :adults_ongoing - field :children_first_time - field :teens_first_time - field :adults_first_time - field :quotable_item_quotes - field :quotes - field :media_files - - configure :adults_ongoing do - formatted_value{ bindings[:object].adults_ongoing} - end - configure :teens_ongoing do - formatted_value{ bindings[:object].teens_ongoing} - end - configure :children_ongoing do - formatted_value{ bindings[:object].children_ongoing} - end - configure :adults_first_time do - formatted_value{ bindings[:object].adults_first_time} - end - configure :teens_first_time do - formatted_value{ bindings[:object].teens_first_time} - end - configure :children_first_time do - formatted_value{ bindings[:object].children_first_time} - end - - exclude_fields :type - end - - edit do - field :owner - field :user - field :project - field :date - field :rating - field :children_ongoing - field :teens_ongoing - field :adults_ongoing - field :children_first_time - field :teens_first_time - field :adults_first_time - field :quotable_item_quotes - field :quotes - field :media_files - - configure :adults_ongoing do - formatted_value{ bindings[:object].adults_ongoing} - end - configure :teens_ongoing do - formatted_value{ bindings[:object].teens_ongoing} - end - configure :children_ongoing do - formatted_value{ bindings[:object].children_ongoing} - end - configure :adults_first_time do - formatted_value{ bindings[:object].adults_first_time} - end - configure :teens_first_time do - formatted_value{ bindings[:object].teens_first_time} - end - configure :children_first_time do - formatted_value{ bindings[:object].children_first_time} - end - - exclude_fields :type - end - - end - def name return "" unless user "#{user.name}" diff --git a/app/models/workshop_variation.rb b/app/models/workshop_variation.rb index cd374389c..3279f8836 100644 --- a/app/models/workshop_variation.rb +++ b/app/models/workshop_variation.rb @@ -1,12 +1,4 @@ class WorkshopVariation < ApplicationRecord belongs_to :workshop - rails_admin do - field :name - field :ordering - field :inactive - field :code, :ck_editor - - exclude_fields :workshop - end end diff --git a/app/views/admins/base/show.html.erb b/app/views/admins/base/show.html.erb index 4a5c1fd4e..e69de29bb 100644 --- a/app/views/admins/base/show.html.erb +++ b/app/views/admins/base/show.html.erb @@ -1 +0,0 @@ -<%= link_to 'Content Management System', rails_admin_path %> \ No newline at end of file diff --git a/app/views/admins/notification_mailer/email.html.inky b/app/views/admins/notification_mailer/email.html.inky deleted file mode 100644 index 1aae7a3be..000000000 --- a/app/views/admins/notification_mailer/email.html.inky +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - -

<%= @report.type.titleize %> has been <%= "#{@notification.notification_type}" %>.

- <% if @report %> -

Form information:

- - - <%= render "partials/form_row", label: "User Name", info: @noticeable.name %> - <%= render "partials/form_row", label: "User Id", info: @user.id %> - <% if @report.project %> - <%= render "partials/form_row", label: "Agency", info: @report.project.name %> - <% end %> - <%= render "partials/form_row", label: "Date", info: @report.display_date %> - <% if @report.owner_type == "MonthlyReport" %> - <%= render "partials/form_row", label: "Reporting for the month of", info: @report.month %> - <% elsif @report.type == "WorkshopLog" %> - <%= render "partials/form_row", label: "Workshop Date", info: @report.date.strftime('%m/%d/%y') %> - <% end %> - <% unless @report.children_ongoing.nil? %> - <%= render "partials/form_row", label: "On-going Children", info: @report.children_ongoing %> - <%= render "partials/form_row", label: "On-going Teens", info: @report.teens_ongoing %> - <%= render "partials/form_row", label: "On-going Adults", info: @report.adults_ongoing %> - - <%= render "partials/form_row", label: "First Time Children", info: @report.children_first_time %> - <%= render "partials/form_row", label: "First Time Teens", info: @report.teens_first_time %> - <%= render "partials/form_row", label: "First Time Adults", info: @report.adults_first_time %> - <% end %> - -
- - - <% @answers.each do |answer| %> - <% unless answer.response.blank? %> -

<%= answer.form_field.question %>

-

- <%= answer.response %> -

- - <% end %> - <% end %> - - <% unless @quotes[0].quote.blank? %> -

Quotes

- <% @quotes.each do |q| %> -
-

<%= q.quote %>

-

<%= q.age %> years old

-
- - <% end %> - <% end %> - - - -

Files

- <% unless @attachments.blank? %> - - <% else %> - No Content - <% end %> - - -
- <% if @report.owner_type == "MonthlyReport" %> - - <% elsif @report.type == "WorkshopLog" %> - - <% end %> - - View User Information - -
- - <% end %> -
-
- -
-
- - - - - - -   - - AWBW logo - - - - diff --git a/config/initializers/kaminari.rb b/config/initializers/kaminari.rb deleted file mode 100644 index 25279cf5f..000000000 --- a/config/initializers/kaminari.rb +++ /dev/null @@ -1,3 +0,0 @@ -Kaminari.configure do |config| - config.page_method_name = :per_page_kaminari -end \ No newline at end of file diff --git a/config/initializers/rails_admin.rb b/config/initializers/rails_admin.rb deleted file mode 100644 index d4c697dbf..000000000 --- a/config/initializers/rails_admin.rb +++ /dev/null @@ -1,71 +0,0 @@ -require Rails.root.join('lib', 'rails_admin', 'duplicate.rb') -RailsAdmin::Config::Actions.register(RailsAdmin::Config::Actions::Duplicate) -RailsAdmin.config do |config| - - config.navigation_static_links = { - 'Help' => '/dashboard/help' - } - - ### Popular gems integration - - ## == Devise == - config.authenticate_with do - warden.authenticate! scope: :admin - end - config.current_user_method(&:current_admin) - - ## == Cancan == - # config.authorize_with :cancan - - ## == PaperTrail == - # config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0 - - ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration - - config.actions do - dashboard # mandatory - index # mandatory - new - export - bulk_delete - show - edit - delete - duplicate - # show_in_app - - ## With an audit adapter, you can add: - # history_index - # history_show - end - - config.model 'WindowsType' do - object_label_method do - :custom_label_method - end - end - - config.model 'Resource' do - object_label_method do - :custom_label_list - end - end - - config.model 'Workshop' do - configure :english_anchors do - pretty_value do - anchors = bindings[:object] - Workshop.anchors_english_admin - end - read_only true - end - configure :spanish_anchors do - pretty_value do - anchors = bindings[:object] - Workshop.anchors_spanish_admin - end - read_only true - end - end - config.default_associated_collection_limit = 1500 -end diff --git a/config/routes.rb b/config/routes.rb index 298a2b0a2..22b673585 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,14 +1,8 @@ Rails.application.routes.draw do - mount RailsAdmin::Engine => '/admin/cms', as: 'rails_admin' mount Ckeditor::Engine => '/admin/ckeditor', as: 'ckeditor' apipie get 'cms', to: 'admins/base#show' - namespace :admins do - root 'base#show' - resources :form_builders - end - devise_for :users, controllers: { registrations: 'registrations', passwords: 'passwords' } devise_for :admins diff --git a/lib/rails_admin/duplicate.rb b/lib/rails_admin/duplicate.rb deleted file mode 100644 index 9c7db8773..000000000 --- a/lib/rails_admin/duplicate.rb +++ /dev/null @@ -1,74 +0,0 @@ -# lib/rails_admin/duplicate.rb - -module RailsAdmin - module Config - module Actions - class Duplicate < RailsAdmin::Config::Actions::Base - # This ensures the action only shows up for workshop - register_instance_option :visible? do - authorized? && bindings[:object].class == Workshop - end - - register_instance_option :member do - true - end - register_instance_option :link_icon do - 'icon-file' - end - # You may or may not want pjax for your action - register_instance_option :pjax? do - false - end - register_instance_option :http_methods do - [:get, :post] - end - register_instance_option :controller do - Proc.new do - if request.post? - @workshop = Workshop.new(@object.attributes.except("id", "created_at", "updated_at")) - - @object.categories.each do |category| - @workshop.categories = @object.categories - end - - @object.quotes.each do |quote| - @workshop.quotes << quote.dup - end - - @object.images.each do |image| - @workshop.images << image.dup - end - - - @object.workshop_variations.each do |wv| - @workshop.workshop_variations << wv.dup - end - - @workshop.save - @images_copied = @workshop.images - - @object.images.each do |image| - image_to_copy = @images_copied.where(:file_file_name => image.file_file_name ).first - - if !image_to_copy.nil? - image.file.s3_object.copy_to(image_to_copy.file.s3_object, {acl: :public_read}) - image_to_copy.file.reprocess! :thumb - end - end - - if !@object.thumbnail.path.nil? - @object.thumbnail.s3_object.copy_to(@workshop.thumbnail.s3_object, {acl: :public_read}) - end - if !@object.header.path.nil? - @object.header.s3_object.copy_to(@workshop.header.s3_object, {acl: :public_read}) - end - - redirect_to back_or_index - flash[:success] = "The Workshop has been duplicated: #{@object.title}." - end - end - end - end - end - end -end