puffer 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +98 -80
- data/README.md +6 -0
- data/Rakefile +1 -1
- data/app/assets/javascripts/puffer/puffer.js +15 -3
- data/app/assets/javascripts/puffer/right-sortable-src.js +28 -306
- data/app/assets/stylesheets/puffer/application.css +2 -0
- data/app/assets/stylesheets/puffer/file_input.css +59 -0
- data/app/assets/stylesheets/puffer/puffer.css +1 -0
- data/app/assets/stylesheets/puffer/puffer_grid.css +23 -0
- data/app/components/boolean/filter.html.erb +9 -0
- data/app/components/boolean_component.rb +4 -0
- data/app/components/carrierwave/form.html.erb +34 -0
- data/app/components/carrierwave/index.html.erb +6 -0
- data/app/components/carrierwave_component.rb +16 -0
- data/app/components/references_one/form.html.erb +2 -3
- data/app/controllers/admin/dashboard_controller.rb +0 -1
- data/app/controllers/admin/puffer_users_controller.rb +3 -7
- data/app/controllers/admin/sessions_controller.rb +1 -1
- data/app/models/puffer_user.rb +3 -18
- data/app/views/layouts/puffer.html.erb +2 -0
- data/app/views/puffer/base/_edit.html.erb +1 -1
- data/app/views/puffer/base/new.html.erb +1 -1
- data/app/views/puffer/grid_base/_grid.html.erb +9 -0
- data/app/views/puffer/grid_base/_index.html.erb +26 -0
- data/config/routes.rb +1 -1
- data/gemfiles/Gemfile-rails-3.1 +5 -0
- data/gemfiles/Gemfile-rails-3.1.lock +201 -0
- data/gemfiles/Gemfile-rails-3.2 +5 -0
- data/gemfiles/Gemfile-rails-3.2.lock +199 -0
- data/lib/puffer.rb +38 -12
- data/{app/controllers/puffer → lib/puffer/backends/controllers}/base.rb +1 -2
- data/{app/controllers/puffer → lib/puffer/backends/controllers}/dashboard_base.rb +0 -1
- data/lib/puffer/backends/controllers/grid_base.rb +12 -0
- data/{app/controllers/puffer → lib/puffer/backends/controllers}/puffer_users_base.rb +0 -0
- data/{app/controllers/puffer → lib/puffer/backends/controllers}/sessions/base.rb +0 -1
- data/{app/controllers/puffer → lib/puffer/backends/controllers}/sessions/clearance.rb +13 -5
- data/{app/controllers/puffer → lib/puffer/backends/controllers}/sessions/devise.rb +1 -1
- data/{app/controllers/puffer → lib/puffer/backends/controllers}/sessions/simple.rb +1 -1
- data/{app/controllers/puffer → lib/puffer/backends/controllers}/tree_base.rb +0 -1
- data/lib/puffer/backends/models/user/active_record.rb +9 -0
- data/lib/puffer/backends/models/user/base.rb +30 -0
- data/lib/puffer/backends/models/user/mongoid.rb +15 -0
- data/lib/puffer/component.rb +2 -2
- data/lib/puffer/controller/auth.rb +48 -47
- data/lib/puffer/controller/config.rb +4 -6
- data/lib/puffer/controller/dsl.rb +2 -4
- data/lib/puffer/controller/mutate.rb +23 -26
- data/lib/puffer/extensions/directive_processor.rb +11 -16
- data/lib/puffer/extensions/engine.rb +7 -9
- data/lib/puffer/extensions/{mapper.rb → mapper31.rb} +10 -12
- data/lib/puffer/extensions/mapper32.rb +108 -0
- data/lib/puffer/filters.rb +15 -3
- data/lib/puffer/orm_adapter/active_record.rb +15 -2
- data/lib/puffer/orm_adapter/base.rb +4 -0
- data/lib/puffer/orm_adapter/mongoid.rb +15 -2
- data/lib/puffer/resource.rb +1 -1
- data/lib/puffer/version.rb +1 -1
- data/puffer.gemspec +10 -4
- data/spec/{app/components → components}/base_component_spec.rb +0 -0
- data/spec/{app/components → components}/boolean_component_spec.rb +0 -0
- data/spec/{app/components → components}/date_time_component_spec.rb +0 -0
- data/spec/{app/components → components}/file_component_spec.rb +0 -0
- data/spec/{app/components → components}/hidden_component_spec.rb +0 -0
- data/spec/{app/components → components}/password_component_spec.rb +0 -0
- data/spec/{app/components → components}/references_many_component_spec.rb +0 -0
- data/spec/{app/components → components}/references_one_component_spec.rb +0 -0
- data/spec/{app/components → components}/select_component_spec.rb +0 -0
- data/spec/{app/components → components}/string_component_spec.rb +0 -0
- data/spec/{app/components → components}/text_component_spec.rb +0 -0
- data/spec/controllers/sessions/base_shared.rb +66 -0
- data/spec/controllers/sessions/clearance_spec.rb +21 -0
- data/spec/controllers/sessions/simple_spec.rb +14 -0
- data/spec/dummy/app/controllers/admin/news_controller.rb +1 -1
- data/spec/dummy/app/controllers/admin/profiles_controller.rb +3 -1
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/orms/mongoid_orm_primals_controller.rb +16 -0
- data/spec/dummy/app/helpers/news_helper.rb +1 -1
- data/spec/dummy/app/models/clearance_user.rb +3 -0
- data/spec/dummy/app/models/mongoid_orm/embeds_many_reference.rb +9 -0
- data/spec/dummy/app/models/mongoid_orm/embeds_one_reference.rb +9 -0
- data/spec/dummy/app/models/mongoid_orm/has_many_reference.rb +9 -0
- data/spec/dummy/app/models/mongoid_orm/has_one_reference.rb +9 -0
- data/spec/dummy/app/models/mongoid_orm/primal.rb +8 -0
- data/spec/dummy/app/models/profile.rb +2 -0
- data/spec/dummy/app/uploaders/avatar_uploader.rb +8 -0
- data/spec/dummy/config/application.rb +5 -3
- data/spec/dummy/config/initializers/clearance.rb +3 -0
- data/spec/dummy/config/initializers/devise.rb +34 -22
- data/spec/dummy/config/locales/devise.en.yml +6 -7
- data/spec/dummy/config/routes.rb +0 -1
- data/spec/dummy/db/migrate/{20100930133425_create_admin_profiles.rb → 20100930133425_create_profiles.rb} +2 -1
- data/spec/dummy/db/migrate/20111208222355_create_clearance_users.rb +13 -0
- data/spec/dummy/db/migrate/20120129091339_upgrade_clearance_to_diesel.rb +19 -0
- data/spec/dummy/db/schema.rb +12 -1
- data/spec/fabricators/clearance_user_fabricator.rb +4 -0
- data/spec/fabricators/puffer_user_fabricator.rb +5 -0
- data/spec/lib/filters_spec.rb +1 -1
- data/spec/lib/orm_adapter/active_record_spec.rb +0 -1
- data/spec/lib/orm_adapter/base_shared.rb +80 -76
- data/spec/lib/orm_adapter/mongoid_spec.rb +0 -2
- data/spec/lib/resource/tree_spec.rb +0 -1
- data/spec/spec_helper.rb +5 -3
- metadata +150 -75
- data/VERSION +0 -1
- data/app/models/puffer/puffer_user.rb +0 -25
@@ -0,0 +1,15 @@
|
|
1
|
+
module Puffer
|
2
|
+
module User
|
3
|
+
class Mongoid
|
4
|
+
include ::Mongoid::Document
|
5
|
+
|
6
|
+
self.collection_name = 'puffer_users'
|
7
|
+
|
8
|
+
field :email, :type => String
|
9
|
+
field :password_digest, :type => String
|
10
|
+
field :roles, :type => String
|
11
|
+
|
12
|
+
include Puffer::User::Base
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/puffer/component.rb
CHANGED
@@ -35,8 +35,8 @@ module Puffer
|
|
35
35
|
helper 'puffer/helpers/component', 'puffer/helpers/puffer'
|
36
36
|
|
37
37
|
attr_reader :parent_controller, :field, :identifer, :record, :records, :resource, :opts
|
38
|
-
delegate :env, :request, :params, :session, :
|
39
|
-
helper_method :params, :session, :
|
38
|
+
delegate :env, :request, :params, :session, :to => :parent_controller
|
39
|
+
helper_method :params, :session, :parent_controller, :field, :identifer, :component_id, :event_url, :event_path, :record, :records, :resource, :opts
|
40
40
|
|
41
41
|
def initialize field
|
42
42
|
super()
|
@@ -4,7 +4,7 @@ module Puffer
|
|
4
4
|
# controllers. Puffer's authentification system is simple. In general, you
|
5
5
|
# should use different kinds of routing and controllers namespaces for
|
6
6
|
# partial access of different user types.
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# Method +has_puffer_access?+ with current namespace name as a parameter.
|
9
9
|
# If you want to use appication's own auth system - just redefine this
|
10
10
|
# method in your ApplicationController.
|
@@ -17,58 +17,59 @@ module Puffer
|
|
17
17
|
helper_method :current_puffer_user
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
# This method is also part of auth system and it can be redefined at the
|
42
|
-
# ApplicationController.
|
43
|
-
#
|
44
|
-
# ex:
|
45
|
-
#
|
46
|
-
# class ApplicationController < ActionController::Base
|
47
|
-
# # <tt>current_puffer_user.admin?</tt>
|
48
|
-
# # <tt>current_puffer_user.manager?</tt>
|
49
|
-
# # <tt>current_puffer_user.seo?</tt>
|
50
|
-
# def has_puffer_access? namespace
|
51
|
-
# current_puffer_user.send("#{namespace}?")
|
52
|
-
# end
|
53
|
-
# end
|
54
|
-
def has_puffer_access? namespace
|
55
|
-
super rescue (current_puffer_user && current_puffer_user.has_role?(namespace))
|
20
|
+
# Return current user instance, used for authorization. This method can
|
21
|
+
# be redefined in ApplicationController if you want to use application's
|
22
|
+
# auth system.
|
23
|
+
#
|
24
|
+
# ex:
|
25
|
+
#
|
26
|
+
# class ApplicationController < ActionController::Base
|
27
|
+
# def current_puffer_user
|
28
|
+
# current_user
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# In this case returner user model instance should respond to has_role?
|
33
|
+
# method, or you should properly redefine +has_puffer_access?+ See
|
34
|
+
# +has_puffer_access?+ source and docs.
|
35
|
+
def current_puffer_user
|
36
|
+
@current_puffer_user ||= begin
|
37
|
+
super
|
38
|
+
rescue NoMethodError
|
39
|
+
::Admin::SessionsController.model.to_adapter.get(session[:puffer_user_id])
|
56
40
|
end
|
41
|
+
end
|
57
42
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
43
|
+
# This method is also part of auth system and it can be redefined at the
|
44
|
+
# ApplicationController.
|
45
|
+
#
|
46
|
+
# ex:
|
47
|
+
#
|
48
|
+
# class ApplicationController < ActionController::Base
|
49
|
+
# # <tt>current_puffer_user.admin?</tt>
|
50
|
+
# # <tt>current_puffer_user.manager?</tt>
|
51
|
+
# # <tt>current_puffer_user.seo?</tt>
|
52
|
+
# def has_puffer_access? namespace
|
53
|
+
# current_puffer_user.send("#{namespace}?")
|
54
|
+
# end
|
55
|
+
# end
|
56
|
+
def has_puffer_access? namespace
|
57
|
+
super
|
58
|
+
rescue NoMethodError
|
59
|
+
(current_puffer_user && current_puffer_user.has_role?(namespace))
|
60
|
+
end
|
65
61
|
|
66
|
-
|
67
|
-
|
62
|
+
# Used in before_filter to prevent unauthorized access
|
63
|
+
def require_puffer_user
|
64
|
+
unless has_puffer_access?(puffer_namespace)
|
65
|
+
redirect_to new_admin_session_url(:return_to => request.fullpath)
|
66
|
+
return false
|
68
67
|
end
|
69
|
-
|
70
68
|
end
|
71
69
|
|
70
|
+
def redirect_back_or default
|
71
|
+
redirect_to(params[:return_to].presence || default)
|
72
|
+
end
|
72
73
|
end
|
73
74
|
end
|
74
75
|
end
|
@@ -25,16 +25,14 @@ module Puffer
|
|
25
25
|
puffer_class_attribute :scope
|
26
26
|
# order - default order option. Is a string with field name and direction. Ex: 'email', 'first_name asc', 'title desc'
|
27
27
|
puffer_class_attribute :order
|
28
|
+
# obviously< records per page
|
29
|
+
puffer_class_attribute :per_page, 30
|
28
30
|
|
29
31
|
helper_method :configuration
|
30
32
|
end
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
-
def configuration
|
35
|
-
self.class.configuration
|
36
|
-
end
|
37
|
-
|
34
|
+
def configuration
|
35
|
+
self.class.configuration
|
38
36
|
end
|
39
37
|
|
40
38
|
module ClassMethods
|
@@ -5,42 +5,39 @@ module Puffer
|
|
5
5
|
|
6
6
|
included do
|
7
7
|
helper 'puffer/helpers/puffer'
|
8
|
-
|
8
|
+
|
9
9
|
delegate :model, :model_name, :to => 'self.class'
|
10
10
|
helper_method :puffer_filters, :puffer_namespace, :resource, :record, :records
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
super
|
18
|
-
end
|
19
|
-
|
20
|
-
def puffer_filters
|
21
|
-
@puffer_filters ||= begin
|
22
|
-
filters = params[Puffer::Filters.model_name.param_key] || {}
|
23
|
-
filters = {:puffer_order => configuration.order}.merge(filters) if configuration.order.present?
|
24
|
-
Puffer::Filters.new filter_fields, filters
|
25
|
-
end
|
26
|
-
end
|
13
|
+
def process_action method_name, *args
|
14
|
+
params[:puffer] = Rails.application.routes.resources_tree[params[:puffer]] if params[:puffer]
|
15
|
+
super
|
16
|
+
end
|
27
17
|
|
28
|
-
|
29
|
-
|
18
|
+
def puffer_filters
|
19
|
+
@puffer_filters ||= begin
|
20
|
+
filters = params[Puffer::Filters.model_name.param_key] || {}
|
21
|
+
filters.reverse_merge! :puffer_order => configuration.order if configuration.order.present?
|
22
|
+
filters.reverse_merge! :puffer_per_page => configuration.per_page if configuration.per_page.present?
|
23
|
+
Puffer::Filters.new filter_fields, filters
|
30
24
|
end
|
25
|
+
end
|
31
26
|
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
def puffer_namespace
|
28
|
+
request.path_info.split('/').delete_if(&:blank?).first.to_sym
|
29
|
+
end
|
35
30
|
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
def resource
|
32
|
+
@resource ||= Puffer::Resource.new params, self
|
33
|
+
end
|
39
34
|
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
def record
|
36
|
+
@record || instance_variable_get("@#{resource.model_name}")
|
37
|
+
end
|
43
38
|
|
39
|
+
def records
|
40
|
+
@records || instance_variable_get("@#{resource.model_name.pluralize}")
|
44
41
|
end
|
45
42
|
|
46
43
|
module ClassMethods
|
@@ -5,30 +5,25 @@ module Puffer
|
|
5
5
|
module DirectiveProcessor
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
|
-
|
8
|
+
def process_require_all_directive(path)
|
9
|
+
raise ArgumentError, "require_all argument must be relative" unless relative?(path)
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
context.environment.paths.each do |root_path|
|
12
|
+
root = Pathname.new(root_path).join(path).expand_path
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
if root.exist? && root.directory?
|
15
|
+
context.depend_on(root)
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
next
|
22
|
-
elsif context.asset_requirable?(filename)
|
23
|
-
context.require_asset(filename)
|
24
|
-
end
|
17
|
+
Dir["#{root}/*"].sort.each do |filename|
|
18
|
+
if filename == self.file
|
19
|
+
next
|
20
|
+
elsif context.asset_requirable?(filename)
|
21
|
+
context.require_asset(filename)
|
25
22
|
end
|
26
23
|
end
|
27
24
|
end
|
28
25
|
end
|
29
|
-
|
30
26
|
end
|
31
|
-
|
32
27
|
end
|
33
28
|
end
|
34
29
|
end
|
@@ -4,22 +4,20 @@ module Puffer
|
|
4
4
|
module Engine
|
5
5
|
module Configuration
|
6
6
|
extend ActiveSupport::Concern
|
7
|
-
|
7
|
+
|
8
8
|
included do
|
9
9
|
alias_method_chain :paths, :components
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
paths
|
18
|
-
end
|
12
|
+
def paths_with_components
|
13
|
+
@paths ||= begin
|
14
|
+
paths = paths_without_components
|
15
|
+
paths.add 'app/components', :eager_load => true
|
16
|
+
paths
|
19
17
|
end
|
20
18
|
end
|
21
19
|
end
|
22
|
-
|
20
|
+
|
23
21
|
extend ActiveSupport::Concern
|
24
22
|
|
25
23
|
included do
|
@@ -3,11 +3,11 @@ module Puffer
|
|
3
3
|
# Extends rails mapper to provide resources nesting tree structure with
|
4
4
|
# request params. Route defaults contains <tt>:puffer</tt> key with node
|
5
5
|
# index in resources tree nodes array. See <tt>Puffer::Resource::Tree</tt>
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# Resource tree depends on routes resources nesting.
|
8
8
|
#
|
9
9
|
# ex:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# namespace :admin do
|
12
12
|
# resources :users do
|
13
13
|
# resource :profile
|
@@ -24,7 +24,7 @@ module Puffer
|
|
24
24
|
# {:scope => 'admin', :current => :articles, :children => [], :ancestors => [:users]},
|
25
25
|
# {:scope => 'admin', :current => :orders, :children => [], :ancestors => []},
|
26
26
|
# ]
|
27
|
-
#
|
27
|
+
#
|
28
28
|
# a complete tree structure with nodes array to acces with node index
|
29
29
|
# (<tt>Puffer::Resource::Tree#to_struct</tt>).
|
30
30
|
#
|
@@ -41,15 +41,13 @@ module Puffer
|
|
41
41
|
module InstanceMethods
|
42
42
|
|
43
43
|
def namespace_with_puffer path, options = {}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
@scope[:module] = old
|
52
|
-
end
|
44
|
+
namespace_without_puffer path, options do
|
45
|
+
yield
|
46
|
+
|
47
|
+
if ::Rails.application.routes.resources_tree.any? {|node| node.scope == @scope[:module].to_sym}
|
48
|
+
old, @scope[:module] = @scope[:module], 'admin'
|
49
|
+
root :to => 'dashboard#index'
|
50
|
+
@scope[:module] = old
|
53
51
|
end
|
54
52
|
end
|
55
53
|
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module Puffer
|
2
|
+
module Extensions
|
3
|
+
# Extends rails mapper to provide resources nesting tree structure with
|
4
|
+
# request params. Route defaults contains <tt>:puffer</tt> key with node
|
5
|
+
# index in resources tree nodes array. See <tt>Puffer::Resource::Tree</tt>
|
6
|
+
#
|
7
|
+
# Resource tree depends on routes resources nesting.
|
8
|
+
#
|
9
|
+
# ex:
|
10
|
+
#
|
11
|
+
# namespace :admin do
|
12
|
+
# resources :users do
|
13
|
+
# resource :profile
|
14
|
+
# resources :articles
|
15
|
+
# end
|
16
|
+
# resources :orders
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# will produce:
|
20
|
+
#
|
21
|
+
# [
|
22
|
+
# {:scope => 'admin', :current => :users, :children => [:profile, :articles], :ancestors => []},
|
23
|
+
# {:scope => 'admin', :current => :profile, :children => [], :ancestors => [:users]},
|
24
|
+
# {:scope => 'admin', :current => :articles, :children => [], :ancestors => [:users]},
|
25
|
+
# {:scope => 'admin', :current => :orders, :children => [], :ancestors => []},
|
26
|
+
# ]
|
27
|
+
#
|
28
|
+
# a complete tree structure with nodes array to acces with node index
|
29
|
+
# (<tt>Puffer::Resource::Tree#to_struct</tt>).
|
30
|
+
#
|
31
|
+
# Also this mapper extension adds come aaditional routes for every pufer
|
32
|
+
# controller and namespace.
|
33
|
+
module Mapper
|
34
|
+
extend ActiveSupport::Concern
|
35
|
+
|
36
|
+
included do
|
37
|
+
alias_method_chain :namespace, :puffer
|
38
|
+
alias_method_chain :resource_scope, :puffer
|
39
|
+
end
|
40
|
+
|
41
|
+
def namespace_with_puffer path, options = {}
|
42
|
+
namespace_without_puffer path, options do
|
43
|
+
yield
|
44
|
+
|
45
|
+
if ::Rails.application.routes.resources_tree.any? {|node| node.scope == @scope[:module].to_sym}
|
46
|
+
old, @scope[:module] = @scope[:module], 'admin'
|
47
|
+
root :to => 'dashboard#index'
|
48
|
+
@scope[:module] = old
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def resource_scope_with_puffer kind, resource, &block
|
54
|
+
controller = "#{[@scope[:module], resource.controller].compact.join("/")}_controller".camelize.constantize rescue nil
|
55
|
+
if controller && controller.puffer?
|
56
|
+
singular = kind == :resource
|
57
|
+
name = (singular ? resource.singular : resource.plural).to_sym
|
58
|
+
|
59
|
+
resource_node = ::Rails.application.routes.resources_tree.append_node swallow_nil{@scope[:defaults][:puffer]},
|
60
|
+
:name => name, :scope => @scope[:module].to_sym, :controller => controller, :singular => singular
|
61
|
+
|
62
|
+
defaults :puffer => resource_node do
|
63
|
+
resource_scope_without_puffer kind, resource do
|
64
|
+
block.call if block
|
65
|
+
|
66
|
+
member do
|
67
|
+
controller._members.each do |action|
|
68
|
+
send *action.route
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
collection do
|
73
|
+
controller._collections.each do |action|
|
74
|
+
send *action.route
|
75
|
+
end
|
76
|
+
get '/event/:fieldset/:field/:event(/:identifer)', :action => :event, :as => :event
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
else
|
81
|
+
resource_scope_without_puffer kind, resource, &block
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
module RouteSet
|
87
|
+
extend ActiveSupport::Concern
|
88
|
+
|
89
|
+
included do
|
90
|
+
alias_method_chain :clear!, :puffer
|
91
|
+
attr_writer :resources_tree
|
92
|
+
|
93
|
+
def resources_tree
|
94
|
+
@resources_tree ||= Puffer::Resource::Tree.new
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def clear_with_puffer!
|
99
|
+
@resources_tree = nil
|
100
|
+
clear_without_puffer!
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
ActionDispatch::Routing::RouteSet.send :include, Puffer::Extensions::RouteSet
|
108
|
+
ActionDispatch::Routing::Mapper.send :include, Puffer::Extensions::Mapper
|