Commit 42166373 authored by dgt's avatar dgt Committed by azul

Use prototype-rails branch for rails 5.X and hide actions which cannot be...

Use prototype-rails branch for rails 5.X and hide actions which cannot be hidden by hide_action anymore
parent 24e58c7f
......@@ -19,8 +19,6 @@ Metrics/LineLength:
- 'config/deploy.rb'
- 'config/permissions.rb'
- 'lib/**/*'
- 'home/dora/Dev/crabgrass-media/'
- 'home/dora/Dev/2018'
Style/FrozenStringLiteralComment:
AutoCorrect: false
......@@ -48,16 +48,9 @@ gem 'sass'
##
# Prototype - yes. we still use it.
# these will be replaced by jquery equivalents at some point:
##
# does not support rails 5
# we use the rails 4.2 branch with rails 5.0
# replace alaias_method_chain with alias_method
# tests do not pass
#gem 'prototype-rails', github: 'rails/prototype-rails', branch: '4.2'
gem 'prototype-rails', path: 'vendor/gems/prototype-rails'
#gem 'prototype-rails', path: '/home/dora/Dev/crabgrass_project/2018/august/prototype-rails-5-1'
# we use a fork which is rails 5.x compatible
# tests do not pass for this fork
gem 'prototype-rails', github: 'voxmedia/prototype-rails', ref: 'e385756cbabb5608d1eab47b6416cdd49613c73b'
# Full text search for the database
gem 'thinking-sphinx', '~> 3.4.2'
......@@ -153,9 +146,6 @@ gem 'greencloth', require: 'greencloth',
# version is rather strict for now as api may still change.
gem 'crabgrass_media', '~> 0.3.0', require: 'media',
path: 'vendor/gems/crabgrass-media'
#gem 'crabgrass_media', '~> 0.4.0', require: 'media',
# path: '/home/dora/Dev/crabgrass_project/crabgrass-media'
##
## not required, but a really good idea
......
GIT
remote: https://github.com/voxmedia/prototype-rails.git
revision: e385756cbabb5608d1eab47b6416cdd49613c73b
ref: e385756cbabb5608d1eab47b6416cdd49613c73b
specs:
prototype-rails (4.1.3)
rails (>= 4.2)
PATH
remote: vendor/gems/crabgrass-media
specs:
......@@ -5,12 +13,6 @@ PATH
activesupport (~> 5.0)
mime-types (~> 3.1)
PATH
remote: vendor/gems/prototype-rails
specs:
prototype-rails (4.0.0)
rails (~> 5.0.7)
PATH
remote: vendor/gems/riseuplabs-greencloth-0.1
specs:
......
......@@ -17,19 +17,4 @@ module Common::Application::CurrentSite
end
end
public
if Rails.env.test?
# used for testing
def disable_current_site
@current_site_disabled = true
end
# used for testing
def enable_current_site
@current_site = nil
@current_site_disabled = false
end
end
end
......@@ -18,14 +18,15 @@ class DispatchController < ApplicationController
# create a new instance of a controller, and pass it whatever info regarding
# current group or user context or page object that we have gathered.
def new_controller(controller_name)
modify_params controller: controller_name
class_name = "#{params[:controller].camelcase}Controller"
klass = class_name.constantize
klass.new.tap do |instance|
if instance.respond_to?(:seed)
instance.seed group: @group, user: @user, page: @page
end
if klass.method_defined? :seed_instance
klass.seed_instance group: @group, user: @user, page: @page
else
klass.new
end
end
......
......@@ -29,8 +29,14 @@ class Page::BaseController < ApplicationController
after_action :save_if_needed, except: :create
after_action :update_viewed, only: :show
def self.seed_instance(args)
new.seed(args)
end
include Page::BeforeFilters
protected
# if the page controller is initialized by our custom DispatchController,
# objects which have already been loaded will be passed in via this
def seed(user: nil, group: nil, page: nil)
......@@ -39,8 +45,6 @@ class Page::BaseController < ApplicationController
@page = page # the page object, if already fetched
end
protected
# to be overridden by subclasses
def fetch_data; end
......
......@@ -39,7 +39,9 @@ class Page::CreateController < ApplicationController
redirect_to page_url(@page)
end
# if the page controller is call by our custom DispatchController,
protected
# if the page controller is called by our custom DispatchController,
# objects which have already been loaded will be passed to the tool
# via this initialize method.
def initialize(seed = {})
......@@ -49,8 +51,6 @@ class Page::CreateController < ApplicationController
@page = seed[:page] # the page object, if already fetched
end
protected
#
# before filters
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment