Browse Source

Latest active_admin version should work with adl.

But waiting for ruby > 2.1 in production...
rails5
echarp 5 years ago
parent
commit
fd1c11265b
  1. 4
      Gemfile
  2. 14
      Gemfile.lock
  3. 3
      app/controllers/application_controller.rb
  4. 3
      app/controllers/digests_controller.rb
  5. 3
      app/controllers/events_controller.rb
  6. 2
      app/controllers/maps_controller.rb
  7. 3
      app/controllers/moderations_controller.rb
  8. 3
      app/controllers/orgas_controller.rb
  9. 1
      app/controllers/regions_controller.rb
  10. 3
      app/controllers/stats_controller.rb
  11. 2
      app/controllers/tags_controller.rb
  12. 118
      config/initializers/active_admin.rb

4
Gemfile

@ -45,7 +45,7 @@ gem 'actionview-encoded_mail_to'
gem 'differ'
# A generic library to administrate the tool
gem 'activeadmin', '>= 1.0.0'
gem 'activeadmin', '= 1.0.0'
# Markdown display
gem 'kramdown'
@ -109,7 +109,7 @@ group :development, :test, :assets do
gem 'coffee-rails'
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-rails'
# Turbolinks makes following links in your web application
# faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

14
Gemfile.lock

@ -87,7 +87,7 @@ GEM
railties (>= 4.1.0, < 5.2)
responders
warden (~> 1.2.3)
devise-i18n (1.1.2)
devise-i18n (1.2.0)
differ (0.1.2)
docile (1.1.5)
domain_name (0.5.20170404)
@ -235,7 +235,7 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.2.0)
minitest (5.10.2)
minitest (5.10.3)
modernizr-rails (2.7.1)
multi_json (1.12.1)
multipart-post (2.0.0)
@ -251,7 +251,7 @@ GEM
paper_trail (7.1.0)
activerecord (>= 4.0, < 5.2)
request_store (~> 1.1)
parallel (1.11.2)
parallel (1.12.0)
parser (2.4.0.0)
ast (~> 2.2)
piwik_analytics (1.0.2)
@ -331,7 +331,7 @@ GEM
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
ruby_dep (1.5.0)
ruby_parser (3.10.0)
ruby_parser (3.10.1)
sexp_processor (~> 4.9)
sass (3.5.1)
sass-listen (~> 4.0.0)
@ -377,7 +377,7 @@ GEM
ref
thor (0.19.4)
thread_safe (0.3.6)
tilt (2.0.7)
tilt (2.0.8)
tinymce-rails (4.6.4)
railties (>= 3.1.1)
tinymce-rails-langs (4.20160310)
@ -416,7 +416,7 @@ PLATFORMS
DEPENDENCIES
actionview-encoded_mail_to
activeadmin (>= 1.0.0)
activeadmin (= 1.0.0)
acts-as-taggable-on (< 5)
brakeman
bundler-audit
@ -444,7 +444,7 @@ DEPENDENCIES
i18n-active_record
ice_cube
jbuilder
jquery-rails
jquery-ui-rails
kramdown
meta-tags
modernizr-rails

3
app/controllers/application_controller.rb

@ -5,9 +5,6 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
has_scope :region
has_scope :near, type: :hash, using: %i[location distance]
private
def set_locale

3
app/controllers/digests_controller.rb

@ -1,7 +1,8 @@
# A digest of all events over a period of time
class DigestsController < ApplicationController
has_scope :region, :locality, :tag
has_scope :near, type: :hash, using: %i[location distance]
has_scope :moderated, default: nil, allow_blank: true
has_scope :locality, :tag
has_scope :period, allow_blank: true, type: :hash, using: %i[year week],
default: (
lambda do

3
app/controllers/events_controller.rb

@ -1,7 +1,8 @@
# Event life cycle
# This is a central part to this project
class EventsController < ApplicationController
has_scope :locality, :tag, :daylimit, :year
has_scope :region, :locality, :tag, :daylimit, :year
has_scope :near, type: :hash, using: %i[location distance]
before_action :set_events, only: [:index]
before_action :set_event, except: %i[index new preview_create create]

2
app/controllers/maps_controller.rb

@ -2,6 +2,8 @@
#
# Access to OSM controls
class MapsController < ApplicationController
has_scope :region, :locality, :tag, :daylimit, :year
has_scope :near, type: :hash, using: %i[location distance]
has_scope :future, type: :boolean, default: true
has_scope :period, type: :hash, using: %i[year week]

3
app/controllers/moderations_controller.rb

@ -1,5 +1,8 @@
# Event management life cycle
class ModerationsController < ApplicationController
has_scope :region, :locality, :tag, :daylimit, :year
has_scope :near, type: :hash, using: %i[location distance]
before_action :authenticate_user!
before_action :set_moderation, :set_mailer_host, only:
%i[show edit preview update validate accept refuse destroy]

3
app/controllers/orgas_controller.rb

@ -1,5 +1,8 @@
# Groups life cycle
class OrgasController < ApplicationController
has_scope :region, :tag
has_scope :near, type: :hash, using: %i[location distance]
before_action :set_orga, except: %i[index new create]
before_action :set_mailer_host
before_action :authenticate_user!, except: %i[index new create show],

1
app/controllers/regions_controller.rb

@ -1,3 +1,4 @@
# Manage regions, mostly get stats out of them
class RegionsController < InheritedResources::Base
has_scope :region
end

3
app/controllers/stats_controller.rb

@ -1,6 +1,7 @@
# Generate statistics, around events, by date or place
class StatsController < ApplicationController
has_scope :locality, :tag, :daylimit, :year
has_scope :region, :tag
has_scope :near, type: :hash, using: %i[location distance]
before_action :set_events, :counts, :temporal, :local, only: [:index]

2
app/controllers/tags_controller.rb

@ -1,6 +1,6 @@
# Manage event and organisation tags
class TagsController < InheritedResources::Base
has_scope :locality, :daylimit
has_scope :region, :locality, :daylimit
has_scope :period, type: :hash, using: %i[year week]
has_scope :tag, as: :id

118
config/initializers/active_admin.rb

@ -9,14 +9,14 @@ ActiveAdmin.setup do |config|
# Set the link url for the title. For example, to take
# users to your main site. Defaults to no link.
#
config.site_title_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'
# config.site_title_image = "logo.png"
# == Default Namespace
#
@ -40,11 +40,11 @@ ActiveAdmin.setup do |config|
# within a namespace:
#
# config.namespace :admin do |admin|
# admin.site_title = 'Custom Admin Title'
# 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.
# namespaces will continue to use the main "site_title" configuration.
# == User Authentication
#
@ -53,7 +53,7 @@ ActiveAdmin.setup do |config|
# ensure that there is a currently logged in admin user.
#
# This setting changes the method which Active Admin calls
# within the controller.
# within the application controller.
config.authentication_method = :authenticate_admin_user!
# == User Authorization
@ -64,8 +64,13 @@ ActiveAdmin.setup do |config|
# 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'
# 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
@ -80,7 +85,7 @@ ActiveAdmin.setup do |config|
# user performing them.
#
# This setting changes the method which Active Admin calls
# to return the currently logged in user.
# (within the application controller) to return the currently logged in user.
config.current_user_method = :current_admin_user
# == Logging Out
@ -115,13 +120,20 @@ ActiveAdmin.setup do |config|
# Admin.
#
# You can completely disable comments:
# config.allow_comments = false
#
# You can disable the menu item for the comments index page:
# config.show_comments_in_menu = false
# 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
#
@ -134,11 +146,46 @@ ActiveAdmin.setup do |config|
# 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
# config.before_action :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 = '/assets/favicon.ico'
# 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
# == Create Another Checkbox
#
# Create another checkbox is disabled by default. You can customize it for
# individual resources or you can enable them globally from here.
#
# config.create_another = true
# == Register Stylesheets & Javascripts
#
@ -151,7 +198,7 @@ ActiveAdmin.setup do |config|
#
# 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
# config.register_stylesheet 'my_print_stylesheet.css', media: :print
#
# To load a javascript file:
# config.register_javascript 'my_javascript.js'
@ -159,10 +206,10 @@ ActiveAdmin.setup do |config|
# == CSV options
#
# Set the CSV builder separator
# config.csv_options = { :col_sep => ';' }
# config.csv_options = { col_sep: ';' }
#
# Force the use of quotes
# config.csv_options = { :force_quotes => true }
# config.csv_options = { force_quotes: true }
# == Menu System
#
@ -174,9 +221,8 @@ ActiveAdmin.setup do |config|
#
# 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 }
# menu.add label: "My Great Website",
# url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
# admin.add_logout_button_to_menu menu
# end
# end
@ -185,9 +231,8 @@ ActiveAdmin.setup do |config|
#
# 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 }
# menu.add label: "My Great Website",
# url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
# end
# end
@ -218,12 +263,37 @@ ActiveAdmin.setup do |config|
# 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.
# 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
# == Footer
#
# By default, the footer shows the current Active Admin version. You can
# override the content of the footer here.
#
# config.footer = 'my custom footer text'
# == Sorting
#
# By default ActiveAdmin::OrderClause is used for sorting logic
# You can inherit it with own class and inject it for all resources
#
# config.order_clause = MyOrderClause
end

Loading…
Cancel
Save