yousty-activeadmin 1.0.12.pre → 1.0.13.pre
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.
- checksums.yaml +4 -4
- data/docs/3-index-pages.md +1 -1
- data/features/index/page_title.feature +1 -1
- data/features/show/page_title.feature +1 -1
- data/lib/active_admin/application.rb +2 -2
- data/lib/active_admin/base_controller.rb +2 -2
- data/lib/active_admin/base_controller/menu.rb +1 -1
- data/lib/active_admin/page_controller.rb +1 -1
- data/lib/active_admin/resource_dsl.rb +2 -2
- data/lib/active_admin/version.rb +1 -1
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +1 -1
- data/spec/unit/action_builder_spec.rb +4 -4
- data/spec/unit/controller_filters_spec.rb +6 -6
- data/spec/unit/resource_controller/sidebars_spec.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09bd6eaa643df56eb1fb668486cb2d34e3e95f7a
|
4
|
+
data.tar.gz: 10f8c91f105f22b3d022dc138f99bc7110c48193
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 810eb316f53b7ebda871143431dec9bdd2becec4f093339a73f504eb9412108b3cf5b2eea36c7c8b52aca46b94faeac50fd4eebbdb229d7249beec009236af5a
|
7
|
+
data.tar.gz: 7ba4cfd41ae04669e1ec7cf023138ac516ea07dc9f9313be70511900a265c0d31a281a374f154071421ee1d4a394222ccffa3f8baaf64d930ab3a4f480351e3a
|
data/docs/3-index-pages.md
CHANGED
@@ -34,7 +34,7 @@ Feature: Index - Page Title
|
|
34
34
|
"""
|
35
35
|
ActiveAdmin.register Post do
|
36
36
|
controller do
|
37
|
-
|
37
|
+
before_action { @page_title = "List of #{resource_class.model_name.plural}" }
|
38
38
|
end
|
39
39
|
end
|
40
40
|
"""
|
@@ -51,7 +51,7 @@ Feature: Show - Page Title
|
|
51
51
|
"""
|
52
52
|
ActiveAdmin.register Post do
|
53
53
|
controller do
|
54
|
-
|
54
|
+
before_action { @page_title = "List of #{resource_class.model_name.plural}" }
|
55
55
|
end
|
56
56
|
end
|
57
57
|
"""
|
@@ -211,9 +211,9 @@ module ActiveAdmin
|
|
211
211
|
|
212
212
|
# Adds before, around and after filters to all controllers.
|
213
213
|
# Example usage:
|
214
|
-
# ActiveAdmin.
|
214
|
+
# ActiveAdmin.before_action :authenticate_admin!
|
215
215
|
#
|
216
|
-
%w(
|
216
|
+
%w(before_action skip_before_action after_filter skip_after_filter around_filter skip_filter).each do |name|
|
217
217
|
define_method name do |*args, &block|
|
218
218
|
controllers_for_filters.each do |controller|
|
219
219
|
controller.public_send name, *args, &block
|
@@ -10,8 +10,8 @@ module ActiveAdmin
|
|
10
10
|
|
11
11
|
layout :determine_active_admin_layout
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
before_action :only_render_implemented_actions
|
14
|
+
before_action :authenticate_active_admin_user
|
15
15
|
|
16
16
|
class << self
|
17
17
|
# Ensure that this method is available for the DSL
|
@@ -116,7 +116,7 @@ module ActiveAdmin
|
|
116
116
|
title = options.delete(:title)
|
117
117
|
|
118
118
|
controller do
|
119
|
-
|
119
|
+
before_action(only: [name]) { @page_title = title } if title
|
120
120
|
define_method(name, &block || Proc.new{})
|
121
121
|
end
|
122
122
|
end
|
@@ -160,7 +160,7 @@ module ActiveAdmin
|
|
160
160
|
delegate :before_destroy, :after_destroy, to: :controller
|
161
161
|
|
162
162
|
# Standard rails filters
|
163
|
-
delegate :
|
163
|
+
delegate :before_action, :skip_before_action, :after_filter, :skip_after_filter, :around_filter, :skip_filter,
|
164
164
|
to: :controller
|
165
165
|
|
166
166
|
# Specify which actions to create in the controller
|
data/lib/active_admin/version.rb
CHANGED
@@ -138,7 +138,7 @@ ActiveAdmin.setup do |config|
|
|
138
138
|
# You can add before, after and around filters to all of your
|
139
139
|
# Active Admin resources and pages from here.
|
140
140
|
#
|
141
|
-
# config.
|
141
|
+
# config.before_action :do_something_awesome
|
142
142
|
|
143
143
|
# == Setting a Favicon
|
144
144
|
#
|
@@ -52,7 +52,7 @@ describe 'defining new actions from registration blocks' do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
subject {
|
55
|
+
subject { find_before_action controller, :comment }
|
56
56
|
|
57
57
|
it { is_expected.to set_page_title_to "My Awesome Comment", for: controller }
|
58
58
|
end
|
@@ -102,13 +102,13 @@ describe 'defining new actions from registration blocks' do
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
-
subject {
|
105
|
+
subject { find_before_action controller, :comments }
|
106
106
|
|
107
107
|
it { is_expected.to set_page_title_to "My Awesome Comments", for: controller }
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
def
|
111
|
+
def find_before_action(controller, action)
|
112
112
|
finder = if ActiveAdmin::Dependency.rails? '>= 4.1.0'
|
113
113
|
->c { c.kind == :before && c.instance_variable_get(:@if) == ["action_name == '#{action}'"] }
|
114
114
|
else
|
@@ -126,7 +126,7 @@ describe 'defining new actions from registration blocks' do
|
|
126
126
|
end
|
127
127
|
|
128
128
|
failure_message do |filter|
|
129
|
-
message = "expected
|
129
|
+
message = "expected before_action to set the @page_title to '#{expected}', but was '#{@actual}'"
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
@@ -12,14 +12,14 @@ describe ActiveAdmin::Application do
|
|
12
12
|
]
|
13
13
|
end
|
14
14
|
|
15
|
-
it '
|
16
|
-
controllers.each{ |c| expect(c).to receive(:
|
17
|
-
application.
|
15
|
+
it 'before_action' do
|
16
|
+
controllers.each{ |c| expect(c).to receive(:before_action).and_return(true) }
|
17
|
+
application.before_action :my_filter, only: :show
|
18
18
|
end
|
19
19
|
|
20
|
-
it '
|
21
|
-
controllers.each{ |c| expect(c).to receive(:
|
22
|
-
application.
|
20
|
+
it 'skip_before_action' do
|
21
|
+
controllers.each{ |c| expect(c).to receive(:skip_before_action).and_return(true) }
|
22
|
+
application.skip_before_action :my_filter, only: :show
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'after_filter' do
|
@@ -3,12 +3,12 @@ require 'rails_helper'
|
|
3
3
|
describe ActiveAdmin::ResourceController::Sidebars do
|
4
4
|
let(:controller){ Admin::PostsController }
|
5
5
|
|
6
|
-
context 'without
|
6
|
+
context 'without before_action' do
|
7
7
|
before do
|
8
8
|
ActiveAdmin.register Post
|
9
9
|
end
|
10
10
|
|
11
|
-
subject {
|
11
|
+
subject { find_before_action controller, :skip_sidebar! }
|
12
12
|
|
13
13
|
it { is_expected.to set_skip_sidebar_to nil, for: controller }
|
14
14
|
end
|
@@ -16,16 +16,16 @@ describe ActiveAdmin::ResourceController::Sidebars do
|
|
16
16
|
describe '#skip_sidebar!' do
|
17
17
|
before do
|
18
18
|
ActiveAdmin.register Post do
|
19
|
-
|
19
|
+
before_action :skip_sidebar!
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
subject {
|
23
|
+
subject { find_before_action controller, :skip_sidebar! }
|
24
24
|
|
25
25
|
it { is_expected.to set_skip_sidebar_to true, for: controller }
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def find_before_action(controller, filter)
|
29
29
|
#raise controller._process_action_callbacks.map(&:filter).inspect
|
30
30
|
controller._process_action_callbacks.detect { |f| f.raw_filter == filter.to_sym }
|
31
31
|
end
|
@@ -39,7 +39,7 @@ describe ActiveAdmin::ResourceController::Sidebars do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
failure_message do |filter|
|
42
|
-
message = "expected
|
42
|
+
message = "expected before_action to set @skip_sidebar to '#{expected}', but was '#{@actual}'"
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yousty-activeadmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Bell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arbre
|