trestle 0.9.6 → 0.9.9
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/.github/workflows/rspec.yml +30 -0
- data/.gitignore +4 -0
- data/CONTRIBUTING.md +1 -1
- data/README.md +1 -1
- data/app/assets/bundle/trestle/bundle.css +7 -7
- data/app/assets/bundle/trestle/bundle.js +14 -28
- data/app/controllers/concerns/trestle/controller/toolbars.rb +1 -1
- data/app/controllers/concerns/trestle/resource/controller/actions.rb +5 -5
- data/app/controllers/concerns/trestle/resource/controller/redirection.rb +5 -3
- data/app/controllers/trestle/admin_controller.rb +4 -0
- data/app/helpers/trestle/card_helper.rb +2 -2
- data/app/helpers/trestle/navigation_helper.rb +3 -1
- data/app/helpers/trestle/toolbars_helper.rb +1 -1
- data/app/views/trestle/flash/_flash.html.erb +1 -1
- data/app/views/trestle/resource/_scopes.html.erb +1 -1
- data/config/locales/vi.yml +1 -1
- data/frontend/css/components/_fields.scss +1 -0
- data/frontend/css/components/_toolbars.scss +1 -19
- data/frontend/css/core/_mixins.scss +1 -4
- data/frontend/css/layout/_content.scss +1 -1
- data/frontend/js/components/tabs.js +1 -1
- data/lib/generators/trestle/install/install_generator.rb +6 -2
- data/lib/generators/trestle/install/templates/_custom.css +8 -0
- data/lib/generators/trestle/install/templates/trestle.rb.erb +2 -1
- data/lib/trestle/adapters/active_record_adapter.rb +1 -1
- data/lib/trestle/admin/builder.rb +7 -0
- data/lib/trestle/admin.rb +12 -6
- data/lib/trestle/configurable.rb +8 -2
- data/lib/trestle/configuration.rb +4 -5
- data/lib/trestle/debug_errors.rb +24 -0
- data/lib/trestle/form/automatic.rb +3 -1
- data/lib/trestle/form/builder.rb +4 -4
- data/lib/trestle/hook/helpers.rb +1 -1
- data/lib/trestle/lazy.rb +56 -0
- data/lib/trestle/navigation/group.rb +1 -2
- data/lib/trestle/navigation/item.rb +3 -3
- data/lib/trestle/reloader.rb +2 -11
- data/lib/trestle/resource/builder.rb +1 -8
- data/lib/trestle/resource.rb +2 -2
- data/lib/trestle/scopes/block.rb +7 -7
- data/lib/trestle/scopes/definition.rb +2 -2
- data/lib/trestle/scopes/scope.rb +4 -0
- data/lib/trestle/table/column.rb +5 -1
- data/lib/trestle/version.rb +1 -1
- data/lib/trestle.rb +6 -0
- data/package.json +2 -2
- data/trestle.gemspec +7 -7
- data/webpack.config.js +8 -1
- data/yarn.lock +1633 -2889
- metadata +25 -22
- data/.travis.yml +0 -39
@@ -25,7 +25,7 @@ module Trestle
|
|
25
25
|
respond_to do |format|
|
26
26
|
format.html do
|
27
27
|
flash[:message] = flash_message("create.success", title: "Success!", message: "The %{lowercase_model_name} was successfully created.")
|
28
|
-
redirect_to_return_location(:create, instance
|
28
|
+
redirect_to_return_location(:create, instance) { admin.instance_path(instance) }
|
29
29
|
end
|
30
30
|
format.json { render json: instance, status: :created, location: admin.instance_path(instance) }
|
31
31
|
|
@@ -85,7 +85,7 @@ module Trestle
|
|
85
85
|
respond_to do |format|
|
86
86
|
format.html do
|
87
87
|
flash[:message] = flash_message("update.success", title: "Success!", message: "The %{lowercase_model_name} was successfully updated.")
|
88
|
-
redirect_to_return_location(:update, instance
|
88
|
+
redirect_to_return_location(:update, instance) { admin.instance_path(instance) }
|
89
89
|
end
|
90
90
|
format.json { render json: instance, status: :ok }
|
91
91
|
|
@@ -111,14 +111,14 @@ module Trestle
|
|
111
111
|
format.html do
|
112
112
|
if success
|
113
113
|
flash[:message] = flash_message("destroy.success", title: "Success!", message: "The %{lowercase_model_name} was successfully deleted.")
|
114
|
-
redirect_to_return_location(:destroy, instance
|
114
|
+
redirect_to_return_location(:destroy, instance) { admin.path(:index) }
|
115
115
|
else
|
116
116
|
flash[:error] = flash_message("destroy.failure", title: "Warning!", message: "Could not delete %{lowercase_model_name}.")
|
117
117
|
|
118
118
|
if load_instance
|
119
|
-
redirect_to_return_location(:update, instance
|
119
|
+
redirect_to_return_location(:update, instance) { admin.instance_path(instance) }
|
120
120
|
else
|
121
|
-
redirect_to_return_location(:destroy, instance
|
121
|
+
redirect_to_return_location(:destroy, instance) { admin.path(:index) }
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
@@ -3,18 +3,20 @@ module Trestle
|
|
3
3
|
module Controller
|
4
4
|
module Redirection
|
5
5
|
protected
|
6
|
-
def redirect_to_return_location(action, instance, default:)
|
6
|
+
def redirect_to_return_location(action, instance, default: nil, &block)
|
7
|
+
fallback_location = block_given? ? block : default
|
8
|
+
|
7
9
|
if admin.return_locations[action] && !dialog_request?
|
8
10
|
location = instance_exec(instance, &admin.return_locations[action])
|
9
11
|
|
10
12
|
case location
|
11
13
|
when :back
|
12
|
-
redirect_back fallback_location:
|
14
|
+
redirect_back fallback_location: fallback_location, turbolinks: false
|
13
15
|
else
|
14
16
|
redirect_to location, turbolinks: false
|
15
17
|
end
|
16
18
|
else
|
17
|
-
redirect_to
|
19
|
+
redirect_to fallback_location, turbolinks: false
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -11,12 +11,12 @@ module Trestle
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def panel(options={}, &block)
|
14
|
-
|
14
|
+
Trestle.deprecator.warn("The panel helper is deprecated and will be removed in future versions of Trestle. Please use the card helper instead.")
|
15
15
|
card(options.merge(header: options[:title]), &block)
|
16
16
|
end
|
17
17
|
|
18
18
|
def well(options={}, &block)
|
19
|
-
|
19
|
+
Trestle.deprecator.warn("The well helper is deprecated and will be removed in future versions of Trestle. Please use the card helper instead.")
|
20
20
|
card(options, &block)
|
21
21
|
end
|
22
22
|
end
|
@@ -5,7 +5,9 @@ module Trestle
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def current_admin?(admin)
|
8
|
-
respond_to?(:admin) &&
|
8
|
+
respond_to?(:admin) &&
|
9
|
+
self.admin.respond_to?(:name) &&
|
10
|
+
self.admin.name == admin.name
|
9
11
|
end
|
10
12
|
|
11
13
|
def navigation_group_collapsed?(group)
|
@@ -16,7 +16,7 @@ module Trestle
|
|
16
16
|
|
17
17
|
def deprecated_toolbar(name)
|
18
18
|
if content_for?(:"#{name}_toolbar")
|
19
|
-
|
19
|
+
Trestle.deprecator.warn("Using content_for(:#{name}_toolbar) is deprecated. Please use toolbar(:#{name}) instead.")
|
20
20
|
content_for(:"#{name}_toolbar")
|
21
21
|
end
|
22
22
|
end
|
@@ -2,6 +2,6 @@
|
|
2
2
|
<%= render "trestle/flash/alert", html_class: "alert-success", icon: icon("alert-icon far fa-check-circle"), alert: normalize_flash_alert(flash[:message]) %>
|
3
3
|
<% elsif flash[:error] -%>
|
4
4
|
<%= render layout: "trestle/flash/alert", locals: { html_class: "alert-danger", icon: icon("alert-icon far fa-times-circle"), alert: normalize_flash_alert(flash[:error]) } do %>
|
5
|
-
<%= render "trestle/flash/debug", errors: instance.errors if debug_form_errors? %>
|
5
|
+
<%= render "trestle/flash/debug", errors: Trestle::DebugErrors.new(instance.errors) if debug_form_errors? %>
|
6
6
|
<% end %>
|
7
7
|
<% end -%>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<li>
|
9
9
|
<%= link_to persistent_params.merge(scope: (scope unless scope.active?(params))), class: ["scope", ("active" if scope.active?(params))] do %>
|
10
10
|
<strong><%= scope.label %></strong>
|
11
|
-
(<%= number_with_delimiter(scope.count(admin.collection(params))) %>)
|
11
|
+
<% if scope.count? %>(<%= number_with_delimiter(scope.count(admin.collection(params))) %>)<% end %>
|
12
12
|
<% end %>
|
13
13
|
</li>
|
14
14
|
<% end %>
|
data/config/locales/vi.yml
CHANGED
@@ -1,23 +1,5 @@
|
|
1
1
|
.btn-toolbar {
|
2
|
-
|
3
|
-
.btn-group,
|
4
|
-
.input-group {
|
5
|
-
+ .btn,
|
6
|
-
+ .btn-group,
|
7
|
-
+ .input-group {
|
8
|
-
margin-left: 5px;
|
9
|
-
}
|
10
|
-
}
|
11
|
-
|
12
|
-
.btn-group {
|
13
|
-
.btn,
|
14
|
-
.btn-group {
|
15
|
-
+ .btn,
|
16
|
-
+ .btn-group {
|
17
|
-
margin-left: 0;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
2
|
+
gap: 5px;
|
21
3
|
}
|
22
4
|
|
23
5
|
.primary-toolbar {
|
@@ -6,7 +6,7 @@ import { init } from '../core/events'
|
|
6
6
|
|
7
7
|
const TAB_SELECTOR = 'a[data-toggle="tab"]'
|
8
8
|
const TAB_PANE_SELECTOR = '.tab-pane'
|
9
|
-
const ERROR_SELECTOR = '.
|
9
|
+
const ERROR_SELECTOR = '.has-error'
|
10
10
|
|
11
11
|
// Save active tab to URL hash
|
12
12
|
init(function (root) {
|
@@ -10,8 +10,12 @@ module Trestle
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_assets
|
13
|
-
|
14
|
-
|
13
|
+
if defined?(Sass) || defined?(SassC)
|
14
|
+
template "_custom.scss", "app/assets/stylesheets/trestle/_custom.scss"
|
15
|
+
template "_theme.scss", "app/assets/stylesheets/trestle/_theme.scss"
|
16
|
+
else
|
17
|
+
template "_custom.css", "app/assets/stylesheets/trestle/_custom.css"
|
18
|
+
end
|
15
19
|
|
16
20
|
template "custom.js", "app/assets/javascripts/trestle/custom.js"
|
17
21
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/* This file may be used for providing additional customizations to the Trestle
|
2
|
+
* admin. It will be automatically included within all admin pages.
|
3
|
+
*
|
4
|
+
* For organizational purposes, you may wish to define your customizations
|
5
|
+
* within individual partials in this folder and they'll be required below.
|
6
|
+
*
|
7
|
+
*= require_tree .
|
8
|
+
*/
|
@@ -70,6 +70,7 @@ Trestle.configure do |config|
|
|
70
70
|
# Specify helper modules to expose to the admin.
|
71
71
|
#
|
72
72
|
# config.helper :all
|
73
|
+
# config.helper -> { CustomHelper }
|
73
74
|
|
74
75
|
# Register callbacks to run before, after or around all Trestle actions.
|
75
76
|
#
|
@@ -123,7 +124,7 @@ Trestle.configure do |config|
|
|
123
124
|
# def render; end
|
124
125
|
# end
|
125
126
|
#
|
126
|
-
# config.form_field :custom, CustomFormField
|
127
|
+
# config.form_field :custom, -> { CustomFormField }
|
127
128
|
|
128
129
|
# == Debugging Options
|
129
130
|
#
|
@@ -88,6 +88,13 @@ module Trestle
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
def remove_action(*actions)
|
92
|
+
actions.each do |action|
|
93
|
+
controller.remove_possible_method(action.to_sym)
|
94
|
+
@admin.actions.delete(action.to_sym)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
91
98
|
protected
|
92
99
|
def normalize_table_options(name, options)
|
93
100
|
if name.is_a?(Hash)
|
data/lib/trestle/admin.rb
CHANGED
@@ -2,8 +2,6 @@ module Trestle
|
|
2
2
|
class Admin
|
3
3
|
require_relative "admin/builder"
|
4
4
|
|
5
|
-
delegate :to_param, to: :class
|
6
|
-
|
7
5
|
def initialize(context=nil)
|
8
6
|
@context = context
|
9
7
|
end
|
@@ -52,13 +50,13 @@ module Trestle
|
|
52
50
|
end
|
53
51
|
|
54
52
|
def breadcrumbs
|
55
|
-
Breadcrumb::Trail.new(Array(Trestle.config.root_breadcrumbs) + [breadcrumb])
|
53
|
+
Breadcrumb::Trail.new(Array(Trestle.config.root_breadcrumbs) + [breadcrumb].compact)
|
56
54
|
end
|
57
55
|
|
58
56
|
def breadcrumb
|
59
57
|
if @breadcrumb
|
60
58
|
Breadcrumb.cast(@breadcrumb.call)
|
61
|
-
|
59
|
+
elsif actions.include?(:index)
|
62
60
|
default_breadcrumb
|
63
61
|
end
|
64
62
|
end
|
@@ -128,10 +126,14 @@ module Trestle
|
|
128
126
|
raise NoMethodError, "#to_param called on non-resourceful admin. You may need to explicitly specify the admin."
|
129
127
|
end
|
130
128
|
|
131
|
-
def
|
129
|
+
def default_actions
|
132
130
|
[:index]
|
133
131
|
end
|
134
132
|
|
133
|
+
def actions
|
134
|
+
@actions ||= default_actions.dup
|
135
|
+
end
|
136
|
+
|
135
137
|
def root_action
|
136
138
|
:index
|
137
139
|
end
|
@@ -145,7 +147,7 @@ module Trestle
|
|
145
147
|
|
146
148
|
Proc.new do
|
147
149
|
scope controller: admin.controller_namespace, path: admin.options[:path] || admin.admin_name do
|
148
|
-
get "", action: "index", as: admin.route_name
|
150
|
+
get "", action: "index", as: admin.route_name if admin.actions.include?(:index)
|
149
151
|
|
150
152
|
admin.additional_routes.each do |block|
|
151
153
|
instance_exec(&block)
|
@@ -176,5 +178,9 @@ module Trestle
|
|
176
178
|
end
|
177
179
|
end
|
178
180
|
end
|
181
|
+
|
182
|
+
# This delegate call is deferred until the class method is defined,
|
183
|
+
# since the method signature is different from Object#to_param.
|
184
|
+
delegate :to_param, to: :class
|
179
185
|
end
|
180
186
|
end
|
data/lib/trestle/configurable.rb
CHANGED
@@ -15,6 +15,12 @@ module Trestle
|
|
15
15
|
options.fetch(name) {
|
16
16
|
if defaults.key?(name)
|
17
17
|
value = defaults[name]
|
18
|
+
|
19
|
+
# Avoid references to the same instance of a default value
|
20
|
+
if value.respond_to?(:dup) && !value.is_a?(Proc)
|
21
|
+
value = value.dup
|
22
|
+
end
|
23
|
+
|
18
24
|
assign(name, value)
|
19
25
|
end
|
20
26
|
}
|
@@ -65,11 +71,11 @@ module Trestle
|
|
65
71
|
|
66
72
|
def deprecated_option(name, message=nil)
|
67
73
|
define_method("#{name}=") do |value|
|
68
|
-
|
74
|
+
Trestle.deprecator.warn(message)
|
69
75
|
end
|
70
76
|
|
71
77
|
define_method(name) do |*args|
|
72
|
-
|
78
|
+
Trestle.deprecator.warn(message)
|
73
79
|
end
|
74
80
|
end
|
75
81
|
end
|
@@ -54,18 +54,17 @@ module Trestle
|
|
54
54
|
menus << Navigation::Block.new(&block)
|
55
55
|
end
|
56
56
|
|
57
|
-
|
58
57
|
## Extension Options
|
59
58
|
|
60
59
|
# [Internal] List of helper modules to include in all Trestle controllers
|
61
|
-
option :helpers,
|
60
|
+
option :helpers, Lazy::List.new
|
62
61
|
|
63
62
|
# [Internal] Container module for block-defined helpers
|
64
63
|
option :helper_module, Module.new
|
65
64
|
|
66
65
|
# Register global helpers available to all Trestle admins
|
67
66
|
def helper(*helpers, &block)
|
68
|
-
self.helpers
|
67
|
+
self.helpers << helpers
|
69
68
|
self.helper_module.module_eval(&block) if block_given?
|
70
69
|
end
|
71
70
|
|
@@ -82,8 +81,8 @@ module Trestle
|
|
82
81
|
option :default_adapter, Adapters.compose(Adapters::ActiveRecordAdapter, Adapters::DraperAdapter)
|
83
82
|
|
84
83
|
# Register a custom form field class
|
85
|
-
def form_field(name,
|
86
|
-
Form::Builder.register(name,
|
84
|
+
def form_field(name, field)
|
85
|
+
Form::Builder.register(name, field)
|
87
86
|
end
|
88
87
|
|
89
88
|
# [Internal] List of registered hooks
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Trestle
|
2
|
+
class DebugErrors
|
3
|
+
def initialize(errors)
|
4
|
+
@errors = errors
|
5
|
+
end
|
6
|
+
|
7
|
+
def any?
|
8
|
+
@errors.any?
|
9
|
+
end
|
10
|
+
|
11
|
+
def each
|
12
|
+
if defined?(ActiveModel::Error)
|
13
|
+
# Rails 6.1 introduces a unified Error class
|
14
|
+
@errors.each do |error|
|
15
|
+
yield error.attribute, error.message
|
16
|
+
end
|
17
|
+
else
|
18
|
+
@errors.each do |error, message|
|
19
|
+
yield error, message
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -31,7 +31,9 @@ module Trestle
|
|
31
31
|
when :datetime
|
32
32
|
datetime_field attribute.name
|
33
33
|
when :boolean
|
34
|
-
|
34
|
+
form_group label: false do
|
35
|
+
check_box attribute.name
|
36
|
+
end
|
35
37
|
when :enum
|
36
38
|
collection_radio_buttons attribute.name, attribute.options[:values] || [], :first, :last
|
37
39
|
when :json, :jsonb
|
data/lib/trestle/form/builder.rb
CHANGED
@@ -9,7 +9,7 @@ module Trestle
|
|
9
9
|
undef_method :display
|
10
10
|
|
11
11
|
cattr_accessor :fields
|
12
|
-
self.fields =
|
12
|
+
self.fields = Lazy::Hash.new
|
13
13
|
|
14
14
|
def errors(name)
|
15
15
|
if object.respond_to?(:errors) && object.errors.respond_to?(:[])
|
@@ -19,14 +19,14 @@ module Trestle
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.register(name,
|
22
|
+
def self.register(name, field)
|
23
23
|
rename_existing_helper_method(name)
|
24
|
-
self.fields[name] =
|
24
|
+
self.fields[name] = field
|
25
25
|
end
|
26
26
|
|
27
27
|
protected
|
28
28
|
def respond_to_missing?(name, include_all=false)
|
29
|
-
self.class.fields.
|
29
|
+
self.class.fields.key?(name) || super
|
30
30
|
end
|
31
31
|
|
32
32
|
def method_missing(name, *args, &block)
|
data/lib/trestle/hook/helpers.rb
CHANGED
data/lib/trestle/lazy.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
module Trestle
|
2
|
+
module Lazy
|
3
|
+
module Constantize
|
4
|
+
def constantize(value)
|
5
|
+
case value
|
6
|
+
when String
|
7
|
+
value.safe_constantize
|
8
|
+
when Proc
|
9
|
+
value.call
|
10
|
+
else
|
11
|
+
value
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class List
|
17
|
+
include Enumerable
|
18
|
+
include Constantize
|
19
|
+
|
20
|
+
def initialize(*items)
|
21
|
+
@list = items
|
22
|
+
end
|
23
|
+
|
24
|
+
def each(&block)
|
25
|
+
@list.each do |item|
|
26
|
+
yield constantize(item)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def <<(items)
|
31
|
+
@list += Array(items)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Hash
|
36
|
+
include Enumerable
|
37
|
+
include Constantize
|
38
|
+
|
39
|
+
delegate :[]=, :key?, to: :@hash
|
40
|
+
|
41
|
+
def initialize
|
42
|
+
@hash = {}
|
43
|
+
end
|
44
|
+
|
45
|
+
def each(&block)
|
46
|
+
@hash.each do |key, value|
|
47
|
+
yield key, constantize(value)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def [](key)
|
52
|
+
constantize(@hash[key])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -4,7 +4,7 @@ module Trestle
|
|
4
4
|
attr_reader :name, :path, :options
|
5
5
|
|
6
6
|
def initialize(name, path=nil, options={})
|
7
|
-
@name, @path, @options = name, path, options
|
7
|
+
@name, @path, @options = name.to_s, path, options
|
8
8
|
end
|
9
9
|
|
10
10
|
def ==(other)
|
@@ -17,7 +17,7 @@ module Trestle
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def <=>(other)
|
20
|
-
priority <=> other.priority
|
20
|
+
[priority, name] <=> [other.priority, other.name]
|
21
21
|
end
|
22
22
|
|
23
23
|
def priority
|
@@ -40,7 +40,7 @@ module Trestle
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def label
|
43
|
-
options[:label] || I18n.t("admin.navigation.items.#{name}", default: name.
|
43
|
+
options[:label] || I18n.t("admin.navigation.items.#{name}", default: name.titlecase)
|
44
44
|
end
|
45
45
|
|
46
46
|
def icon
|
data/lib/trestle/reloader.rb
CHANGED
@@ -38,17 +38,8 @@ module Trestle
|
|
38
38
|
|
39
39
|
app.reloaders << reloader
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
app.reloader.to_run do
|
44
|
-
reloader.execute_if_updated
|
45
|
-
true # Rails <= 5.1
|
46
|
-
end
|
47
|
-
else
|
48
|
-
# Rails 4.2
|
49
|
-
ActionDispatch::Reloader.to_prepare do
|
50
|
-
reloader.execute_if_updated
|
51
|
-
end
|
41
|
+
app.reloader.to_run do
|
42
|
+
reloader.execute_if_updated
|
52
43
|
end
|
53
44
|
|
54
45
|
reloader.execute
|
@@ -14,13 +14,6 @@ module Trestle
|
|
14
14
|
admin.adapter_class = adapter
|
15
15
|
end
|
16
16
|
|
17
|
-
def remove_action(*actions)
|
18
|
-
actions.each do |action|
|
19
|
-
controller.remove_possible_method(action.to_sym)
|
20
|
-
admin.actions.delete(action.to_sym)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
17
|
def collection(&block)
|
25
18
|
admin.define_adapter_method(:collection, &block)
|
26
19
|
end
|
@@ -85,7 +78,7 @@ module Trestle
|
|
85
78
|
|
86
79
|
def scopes(options={}, &block)
|
87
80
|
admin.scopes.options.merge!(options)
|
88
|
-
admin.scopes.append(&block) if block_given?
|
81
|
+
admin.scopes.append(options, &block) if block_given?
|
89
82
|
end
|
90
83
|
|
91
84
|
def scope(name, scope=nil, options={}, &block)
|
data/lib/trestle/resource.rb
CHANGED