Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
37 changes: 0 additions & 37 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions app/controllers/admins/base_controller.rb

This file was deleted.

11 changes: 4 additions & 7 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions app/models/categorizable_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,4 @@ class CategorizableItem < ApplicationRecord

# Attr Accessor
attr_accessor :_create

# Rails Admin
rails_admin do
exclude_fields :legacy
end
end
4 changes: 0 additions & 4 deletions app/models/category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions app/models/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions app/models/form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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%') }

Expand Down
4 changes: 0 additions & 4 deletions app/models/form_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
64 changes: 0 additions & 64 deletions app/models/monthly_report.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -81,5 +18,4 @@ def month
date.strftime("%B")
end


end
21 changes: 0 additions & 21 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions app/models/project_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions app/models/quote.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
19 changes: 0 additions & 19 deletions app/models/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 0 additions & 13 deletions app/models/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 0 additions & 5 deletions app/models/sector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading