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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rspec.yml +30 -0
  3. data/.gitignore +4 -0
  4. data/CONTRIBUTING.md +1 -1
  5. data/README.md +1 -1
  6. data/app/assets/bundle/trestle/bundle.css +7 -7
  7. data/app/assets/bundle/trestle/bundle.js +14 -28
  8. data/app/controllers/concerns/trestle/controller/toolbars.rb +1 -1
  9. data/app/controllers/concerns/trestle/resource/controller/actions.rb +5 -5
  10. data/app/controllers/concerns/trestle/resource/controller/redirection.rb +5 -3
  11. data/app/controllers/trestle/admin_controller.rb +4 -0
  12. data/app/helpers/trestle/card_helper.rb +2 -2
  13. data/app/helpers/trestle/navigation_helper.rb +3 -1
  14. data/app/helpers/trestle/toolbars_helper.rb +1 -1
  15. data/app/views/trestle/flash/_flash.html.erb +1 -1
  16. data/app/views/trestle/resource/_scopes.html.erb +1 -1
  17. data/config/locales/vi.yml +1 -1
  18. data/frontend/css/components/_fields.scss +1 -0
  19. data/frontend/css/components/_toolbars.scss +1 -19
  20. data/frontend/css/core/_mixins.scss +1 -4
  21. data/frontend/css/layout/_content.scss +1 -1
  22. data/frontend/js/components/tabs.js +1 -1
  23. data/lib/generators/trestle/install/install_generator.rb +6 -2
  24. data/lib/generators/trestle/install/templates/_custom.css +8 -0
  25. data/lib/generators/trestle/install/templates/trestle.rb.erb +2 -1
  26. data/lib/trestle/adapters/active_record_adapter.rb +1 -1
  27. data/lib/trestle/admin/builder.rb +7 -0
  28. data/lib/trestle/admin.rb +12 -6
  29. data/lib/trestle/configurable.rb +8 -2
  30. data/lib/trestle/configuration.rb +4 -5
  31. data/lib/trestle/debug_errors.rb +24 -0
  32. data/lib/trestle/form/automatic.rb +3 -1
  33. data/lib/trestle/form/builder.rb +4 -4
  34. data/lib/trestle/hook/helpers.rb +1 -1
  35. data/lib/trestle/lazy.rb +56 -0
  36. data/lib/trestle/navigation/group.rb +1 -2
  37. data/lib/trestle/navigation/item.rb +3 -3
  38. data/lib/trestle/reloader.rb +2 -11
  39. data/lib/trestle/resource/builder.rb +1 -8
  40. data/lib/trestle/resource.rb +2 -2
  41. data/lib/trestle/scopes/block.rb +7 -7
  42. data/lib/trestle/scopes/definition.rb +2 -2
  43. data/lib/trestle/scopes/scope.rb +4 -0
  44. data/lib/trestle/table/column.rb +5 -1
  45. data/lib/trestle/version.rb +1 -1
  46. data/lib/trestle.rb +6 -0
  47. data/package.json +2 -2
  48. data/trestle.gemspec +7 -7
  49. data/webpack.config.js +8 -1
  50. data/yarn.lock +1633 -2889
  51. metadata +25 -22
  52. data/.travis.yml +0 -39
@@ -18,7 +18,7 @@ module Trestle
18
18
 
19
19
  toolbar = (toolbars[name.to_s] ||= Toolbar.new(builder))
20
20
  toolbar.clear! if options[:clear]
21
- toolbar.prepend(&block) if block_given?
21
+ toolbar.append(&block) if block_given?
22
22
  toolbar
23
23
  end
24
24
 
@@ -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, default: admin.instance_path(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, default: admin.instance_path(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, default: admin.path(:index))
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, default: admin.instance_path(instance))
119
+ redirect_to_return_location(:update, instance) { admin.instance_path(instance) }
120
120
  else
121
- redirect_to_return_location(:destroy, instance, default: admin.path(:index))
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: default, turbolinks: false
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 default, turbolinks: false
19
+ redirect_to fallback_location, turbolinks: false
18
20
  end
19
21
  end
20
22
  end
@@ -1,4 +1,8 @@
1
1
  class Trestle::AdminController < Trestle::ApplicationController
2
+ if respond_to?(:raise_on_missing_callback_actions=)
3
+ self.raise_on_missing_callback_actions = false
4
+ end
5
+
2
6
  def index
3
7
  end
4
8
 
@@ -11,12 +11,12 @@ module Trestle
11
11
  end
12
12
 
13
13
  def panel(options={}, &block)
14
- ActiveSupport::Deprecation.warn("The panel helper is deprecated and will be removed in future versions of Trestle. Please use the card helper instead.")
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
- ActiveSupport::Deprecation.warn("The well helper is deprecated and will be removed in future versions of Trestle. Please use the card helper instead.")
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) && self.admin && self.admin.name == admin.name
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
- ActiveSupport::Deprecation.warn("Using content_for(:#{name}_toolbar) is deprecated. Please use toolbar(:#{name}) instead.")
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 %>
@@ -42,7 +42,7 @@ vi:
42
42
  titles:
43
43
  index: "Danh sách %{pluralized_model_name}"
44
44
  new: "Tạo mới %{model_name}"
45
- edit: Chỉnh sửa %{model_name}"
45
+ edit: "Chỉnh sửa %{model_name}"
46
46
 
47
47
  buttons:
48
48
  new: "Tạo mới %{model_name}"
@@ -14,6 +14,7 @@
14
14
 
15
15
  ul.invalid-feedback {
16
16
  list-style: none;
17
+ margin-bottom: 0;
17
18
  padding-left: 0;
18
19
  }
19
20
 
@@ -1,23 +1,5 @@
1
1
  .btn-toolbar {
2
- .btn,
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 {
@@ -26,13 +26,10 @@
26
26
  height: 100%;
27
27
  }
28
28
 
29
- %fa {
29
+ @mixin icon-fa($content) {
30
30
  font-family: 'Font Awesome 5 Free';
31
31
  font-weight: 900;
32
- }
33
32
 
34
- @mixin icon-fa($content) {
35
- @extend %fa;
36
33
  content: fa-content($content);
37
34
  }
38
35
 
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  .btn-toolbar {
37
- justify-content: flex-end;
37
+ flex-direction: row-reverse;
38
38
  }
39
39
 
40
40
  .secondary-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 = '.is-invalid:not([type="hidden"])'
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
- template "_theme.scss", "app/assets/stylesheets/trestle/_theme.scss"
14
- template "_custom.scss", "app/assets/stylesheets/trestle/_custom.scss"
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
  #
@@ -90,7 +90,7 @@ module Trestle
90
90
 
91
91
  def enum_values(column)
92
92
  model.defined_enums[column.name].map { |key, value|
93
- [value, enum_human_name(column, key)]
93
+ [key, enum_human_name(column, key)]
94
94
  }
95
95
  end
96
96
 
@@ -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
- else
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 actions
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
@@ -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
- ActiveSupport::Deprecation.warn(message)
74
+ Trestle.deprecator.warn(message)
69
75
  end
70
76
 
71
77
  define_method(name) do |*args|
72
- ActiveSupport::Deprecation.warn(message)
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 += 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, klass)
86
- Form::Builder.register(name, klass)
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
- check_box attribute.name
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
@@ -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, klass)
22
+ def self.register(name, field)
23
23
  rename_existing_helper_method(name)
24
- self.fields[name] = klass
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.has_key?(name) || super
29
+ self.class.fields.key?(name) || super
30
30
  end
31
31
 
32
32
  def method_missing(name, *args, &block)
@@ -24,7 +24,7 @@ module Trestle
24
24
 
25
25
  def hook_sets
26
26
  @_hook_sets ||= [
27
- (admin.hooks if defined?(admin) && admin),
27
+ (admin.hooks if defined?(admin) && admin.respond_to?(:hooks)),
28
28
  Trestle.config.hooks
29
29
  ].compact
30
30
  end
@@ -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,8 +4,7 @@ module Trestle
4
4
  attr_reader :name, :options
5
5
 
6
6
  def initialize(name, options={})
7
- @name = name
8
- @options = options
7
+ @name, @options = name.to_s, options
9
8
  end
10
9
 
11
10
  def ==(other)
@@ -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.to_s.titlecase)
43
+ options[:label] || I18n.t("admin.navigation.items.#{name}", default: name.titlecase)
44
44
  end
45
45
 
46
46
  def icon
@@ -38,17 +38,8 @@ module Trestle
38
38
 
39
39
  app.reloaders << reloader
40
40
 
41
- if app.respond_to?(:reloader)
42
- # Rails >= 5.0
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)
@@ -88,8 +88,8 @@ module Trestle
88
88
  model_name.plural
89
89
  end
90
90
 
91
- def actions
92
- @actions ||= (readonly? ? READONLY_ACTIONS : RESOURCE_ACTIONS).dup
91
+ def default_actions
92
+ readonly? ? READONLY_ACTIONS : RESOURCE_ACTIONS
93
93
  end
94
94
 
95
95
  def root_action