ab_admin 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/ab_admin/components/admin_assets.js.coffee +6 -2
- data/app/assets/javascripts/ab_admin/components/base_assets.js.coffee +9 -0
- data/app/assets/javascripts/ab_admin/components/gmaps.js.coffee +1 -1
- data/app/assets/javascripts/ab_admin/components/in_place_edit.js.coffee +6 -0
- data/app/assets/javascripts/ab_admin/components/select2_bridge.js.coffee +2 -2
- data/app/assets/javascripts/ab_admin/core/batch_actions.js.coffee +52 -12
- data/app/assets/javascripts/ab_admin/core/init.js.coffee +2 -0
- data/app/assets/javascripts/ab_admin/core/pjax.js.coffee +3 -2
- data/app/assets/javascripts/ab_admin/core/ui_utils.js.coffee +3 -4
- data/app/assets/stylesheets/ab_admin/bootstrap_and_overrides.scss +4 -0
- data/app/assets/stylesheets/ab_admin/components/_colored_tabs.scss +4 -0
- data/app/assets/stylesheets/ab_admin/components/_form.scss +36 -3
- data/app/controllers/admin/admin_comments_controller.rb +4 -0
- data/app/controllers/admin/assets_controller.rb +5 -2
- data/app/controllers/admin/base_controller.rb +50 -41
- data/app/controllers/admin/locators_controller.rb +1 -1
- data/app/controllers/admin/manager_controller.rb +32 -3
- data/app/controllers/admin/settings_controller.rb +2 -3
- data/app/controllers/admin/static_pages_controller.rb +5 -0
- data/app/controllers/admin/structures_controller.rb +10 -4
- data/app/controllers/admin/users_controller.rb +9 -2
- data/app/views/admin/base/_search_layout.html.slim +0 -1
- data/app/views/admin/base/index.html.slim +1 -2
- data/app/views/admin/fileupload/_container.html.slim +17 -10
- data/app/views/admin/shared/_content_actions.html.slim +18 -6
- data/app/views/admin/shared/_locale_tabs.html.slim +3 -3
- data/app/views/admin/structures/_form.html.slim +2 -1
- data/app/views/layouts/admin/_footer.html.slim +5 -4
- data/app/views/layouts/admin/application.html.slim +2 -0
- data/config/locales/ru.yml +1 -0
- data/config/routes.rb +17 -22
- data/lib/ab_admin.rb +11 -1
- data/lib/ab_admin/abstract_resource.rb +11 -2
- data/lib/ab_admin/carrierwave/base_uploader.rb +45 -25
- data/lib/ab_admin/carrierwave/file_size_validator.rb +0 -1
- data/lib/ab_admin/carrierwave/glue.rb +2 -4
- data/lib/ab_admin/concerns/admin_addition.rb +12 -4
- data/lib/ab_admin/concerns/deep_cloneable.rb +0 -1
- data/lib/ab_admin/concerns/fileuploads.rb +0 -1
- data/lib/ab_admin/concerns/headerable.rb +0 -4
- data/lib/ab_admin/concerns/nested_set.rb +2 -3
- data/lib/ab_admin/concerns/reloadable.rb +0 -2
- data/lib/ab_admin/concerns/silencer.rb +0 -3
- data/lib/ab_admin/concerns/utilities.rb +2 -4
- data/lib/ab_admin/concerns/validations.rb +1 -1
- data/lib/ab_admin/config/base.rb +26 -6
- data/lib/ab_admin/controllers/callbacks.rb +6 -6
- data/lib/ab_admin/controllers/head_options.rb +0 -1
- data/lib/ab_admin/controllers/tree.rb +0 -2
- data/lib/ab_admin/core_ext.rb +1 -1
- data/lib/ab_admin/core_ext/array.rb +0 -1
- data/lib/ab_admin/core_ext/hash.rb +11 -0
- data/lib/ab_admin/core_ext/string.rb +0 -1
- data/lib/ab_admin/devise.rb +1 -1
- data/lib/ab_admin/engine.rb +2 -1
- data/lib/ab_admin/hooks/globalize_locale_suffix_accessors.rb +17 -31
- data/lib/ab_admin/hooks/will_paginate_no_uri.rb +1 -1
- data/lib/ab_admin/i18n_tools/google_translate.rb +0 -1
- data/lib/ab_admin/i18n_tools/translate_app.rb +0 -1
- data/lib/ab_admin/menu/builder.rb +3 -2
- data/lib/ab_admin/menu/group.rb +3 -1
- data/lib/ab_admin/models/asset.rb +9 -6
- data/lib/ab_admin/models/header.rb +2 -3
- data/lib/ab_admin/models/locator.rb +1 -1
- data/lib/ab_admin/models/settings.rb +6 -6
- data/lib/ab_admin/models/structure.rb +0 -6
- data/lib/ab_admin/models/track.rb +12 -3
- data/lib/ab_admin/models/type_model.rb +0 -1
- data/lib/ab_admin/models/user.rb +0 -1
- data/lib/ab_admin/models/validations/all.rb +4 -0
- data/lib/ab_admin/models/validations/domain_name_validator.rb +9 -0
- data/lib/ab_admin/models/validations/email_validator.rb +9 -0
- data/lib/ab_admin/utils.rb +12 -4
- data/lib/ab_admin/utils/eval_helpers.rb +1 -1
- data/lib/ab_admin/utils/logger.rb +0 -2
- data/lib/ab_admin/utils/xls_document.rb +25 -6
- data/lib/ab_admin/version.rb +1 -1
- data/lib/ab_admin/views/admin_helpers.rb +5 -4
- data/lib/ab_admin/views/admin_navigation_helpers.rb +16 -5
- data/lib/ab_admin/views/form_builder.rb +41 -10
- data/lib/ab_admin/views/helpers.rb +0 -2
- data/lib/ab_admin/views/inputs/uploader_input.rb +1 -0
- data/lib/ab_admin/views/search_form_builder.rb +33 -7
- data/lib/generators/ab_admin/ckeditor_assets/ckeditor_assets_generator.rb +0 -1
- data/lib/generators/ab_admin/glob/glob_generator.rb +2 -2
- data/lib/generators/ab_admin/glob/templates/migration.erb +1 -1
- data/lib/generators/ab_admin/install/install_generator.rb +0 -1
- data/lib/generators/ab_admin/install/templates/config/seeds.rb +0 -2
- data/lib/generators/ab_admin/install/templates/helpers/admin/structures_helper.rb +1 -4
- data/lib/generators/ab_admin/install/templates/models/admin_comment.rb +1 -3
- data/lib/generators/ab_admin/install/templates/models/asset.rb +3 -5
- data/lib/generators/ab_admin/install/templates/models/header.rb +1 -5
- data/lib/generators/ab_admin/install/templates/models/static_page.rb +1 -4
- data/lib/generators/ab_admin/install/templates/models/structure.rb +1 -5
- data/lib/generators/ab_admin/install/templates/models/track.rb +1 -2
- data/lib/generators/ab_admin/install/templates/models/user.rb +1 -9
- data/lib/generators/ab_admin/install/templates/uploaders/attachment_file_uploader.rb +1 -1
- data/lib/generators/ab_admin/install/templates/uploaders/avatar_uploader.rb +1 -1
- data/lib/generators/ab_admin/install/templates/uploaders/picture_uploader.rb +1 -1
- data/lib/generators/ab_admin/model/templates/resource.erb +1 -0
- data/lib/generators/template.rb +39 -59
- metadata +38 -36
- data/lib/ab_admin/hooks/active_model_attr_accessible_few_roles.rb +0 -50
data/lib/ab_admin/menu/group.rb
CHANGED
@@ -3,6 +3,7 @@ module AbAdmin
|
|
3
3
|
class Group < BaseGroup
|
4
4
|
def initialize(title, options, &block)
|
5
5
|
@menu_tree = []
|
6
|
+
@raw_title = title
|
6
7
|
@title = title.is_a?(Symbol) ? I18n.t(title, scope: [:admin, :navigation]) : title
|
7
8
|
@options = options
|
8
9
|
instance_eval &block if block_given?
|
@@ -12,8 +13,9 @@ module AbAdmin
|
|
12
13
|
return if @options[:if] && !call_method_or_proc_on(template, @options[:if])
|
13
14
|
return if @options[:unless] && call_method_or_proc_on(template, @options[:unless])
|
14
15
|
|
16
|
+
wrapper_class = "dropdown-wrap-#{@raw_title}" if @raw_title.is_a?(Symbol)
|
15
17
|
<<-HTML.html_safe
|
16
|
-
<li class="dropdown">
|
18
|
+
<li class="dropdown #{wrapper_class}">
|
17
19
|
<a class="dropdown-toggle" href="#{@options[:url] || '#'}" >#{title(template)}<b class="caret"></b></a>
|
18
20
|
<ul class="dropdown-menu">#{render_nested(template)}</ul>
|
19
21
|
<li>
|
@@ -25,12 +25,12 @@ module AbAdmin
|
|
25
25
|
|
26
26
|
module ClassMethods
|
27
27
|
def move_to(index, id)
|
28
|
-
|
28
|
+
where(id: id.to_i).update_all(sort_order: index)
|
29
29
|
end
|
30
30
|
|
31
31
|
def ext_list
|
32
32
|
return unless uploaders[:data]
|
33
|
-
uploaders[:data].new.
|
33
|
+
uploaders[:data].new.extension_whitelist
|
34
34
|
end
|
35
35
|
|
36
36
|
def clean!
|
@@ -49,7 +49,7 @@ module AbAdmin
|
|
49
49
|
|
50
50
|
def thumb_url
|
51
51
|
return unless image?
|
52
|
-
data.versions[thumb_size] ?
|
52
|
+
data.versions[thumb_size] ? url(thumb_size) : url
|
53
53
|
end
|
54
54
|
|
55
55
|
def format_created_at
|
@@ -91,7 +91,11 @@ module AbAdmin
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def main!
|
94
|
-
|
94
|
+
cond = {assetable_type: assetable_type, type: type}
|
95
|
+
if assetable_id.to_i.nonzero? || guid.presence
|
96
|
+
cond.merge!(assetable_id.to_i.zero? ? {guid: guid} : {assetable_id: assetable_id})
|
97
|
+
self.class.where(cond).update_all(is_main: false)
|
98
|
+
end
|
95
99
|
update_column(:is_main, true)
|
96
100
|
refresh_assetable
|
97
101
|
self
|
@@ -127,7 +131,7 @@ module AbAdmin
|
|
127
131
|
end
|
128
132
|
|
129
133
|
def full_url(*args)
|
130
|
-
AbAdmin.full_url
|
134
|
+
AbAdmin.full_url url(*args)
|
131
135
|
end
|
132
136
|
|
133
137
|
def url_on_fly(version)
|
@@ -167,7 +171,6 @@ module AbAdmin
|
|
167
171
|
data.cache_stored_file!
|
168
172
|
end
|
169
173
|
end
|
170
|
-
|
171
174
|
end
|
172
175
|
end
|
173
176
|
end
|
@@ -24,16 +24,15 @@ module AbAdmin
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def normalize_html
|
27
|
-
::
|
27
|
+
::Globalize.available_locales.each do |loc|
|
28
28
|
%w(title h1 keywords description).each do |attr|
|
29
29
|
send("#{attr}_#{loc}=", send("#{attr}_#{loc}").to_s.no_html)
|
30
30
|
end
|
31
31
|
end
|
32
|
-
::
|
32
|
+
::Globalize.available_locales.each do |loc|
|
33
33
|
send("seo_block_#{loc}=", sanitize(send("seo_block_#{loc}").to_s))
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
37
36
|
end
|
38
37
|
end
|
39
38
|
end
|
@@ -16,6 +16,7 @@ module AbAdmin
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def save(path, data)
|
19
|
+
data.deep_transform_values! { |v| AbAdmin.normalize_html(v) }
|
19
20
|
File.write path, data.deep_stringify_keys.to_yaml.sub(/\A---\s+/, '').gsub(/:\s+$/, ':').gsub(/^(\s+)(yes|no):/, '\1"\2":')
|
20
21
|
end
|
21
22
|
|
@@ -65,7 +66,6 @@ module AbAdmin
|
|
65
66
|
end
|
66
67
|
{message: message}
|
67
68
|
end
|
68
|
-
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -6,15 +6,16 @@ module AbAdmin
|
|
6
6
|
included do
|
7
7
|
extend ActiveModel::Naming
|
8
8
|
extend ActiveRecord::Translation
|
9
|
-
class_attribute :base_class, :base_paths, :editable_paths
|
9
|
+
class_attribute :base_class, :base_dir, :base_paths, :editable_paths
|
10
10
|
self.base_class = self
|
11
|
+
self.base_dir = Rails.root.join('config', 'settings')
|
11
12
|
self.base_paths = [
|
12
|
-
|
13
|
-
|
13
|
+
File.join(base_dir, 'settings.yml'),
|
14
|
+
File.join(base_dir, "#{Rails.env}.yml")
|
14
15
|
]
|
15
16
|
self.editable_paths = [
|
16
|
-
|
17
|
-
|
17
|
+
File.join(base_dir, "#{Rails.env}.local.yml"),
|
18
|
+
File.join(base_dir, 'settings.local.yml')
|
18
19
|
]
|
19
20
|
end
|
20
21
|
|
@@ -75,7 +76,6 @@ module AbAdmin
|
|
75
76
|
value
|
76
77
|
end
|
77
78
|
end
|
78
|
-
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -21,11 +21,6 @@ module AbAdmin
|
|
21
21
|
scope :with_type, lambda { |structure_type| where(structure_type_id: structure_type.id) }
|
22
22
|
scope :with_depth, lambda { |level| where(depth: level.to_i) }
|
23
23
|
scope :with_position, lambda { |position_type| where(position_type_id: position_type.id).order('lft DESC') }
|
24
|
-
|
25
|
-
scope :with_kind, lambda { |structure_type|
|
26
|
-
ActiveSupport::Deprecation.warn('with_kind is deprecated, use with_type instead')
|
27
|
-
with_type.call(structure_type)
|
28
|
-
}
|
29
24
|
end
|
30
25
|
|
31
26
|
def redirect?
|
@@ -35,7 +30,6 @@ module AbAdmin
|
|
35
30
|
def admin_title
|
36
31
|
[title, structure_type.title, position_type.title, "#{self.class.han(:is_visible)}: #{is_visible ? '+' : '-'}"].join(' | ')
|
37
32
|
end
|
38
|
-
|
39
33
|
end
|
40
34
|
end
|
41
35
|
end
|
@@ -22,6 +22,16 @@ module AbAdmin
|
|
22
22
|
scope :recently, -> { order('id DESC') }
|
23
23
|
end
|
24
24
|
|
25
|
+
module ClassMethods
|
26
|
+
def import_from_batch_collection_action(tracks)
|
27
|
+
tracks.each do |track|
|
28
|
+
track.run_callbacks(:save) { false }
|
29
|
+
track.run_callbacks(:create) { false }
|
30
|
+
end
|
31
|
+
::Track.import(tracks)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
25
35
|
def action_title(params = {})
|
26
36
|
parts = key.split('.')
|
27
37
|
lookups = []
|
@@ -52,10 +62,9 @@ module AbAdmin
|
|
52
62
|
private
|
53
63
|
|
54
64
|
def make_trackable
|
55
|
-
self.name ||= trackable.han
|
56
|
-
self.trackable_changes = trackable.
|
65
|
+
self.name ||= trackable.han.first(250)
|
66
|
+
self.trackable_changes = trackable.saved_changes.except(:updated_at)
|
57
67
|
end
|
58
|
-
|
59
68
|
end
|
60
69
|
end
|
61
70
|
end
|
data/lib/ab_admin/models/user.rb
CHANGED
data/lib/ab_admin/utils.rb
CHANGED
@@ -5,6 +5,13 @@ module AbAdmin
|
|
5
5
|
autoload :Logger, 'ab_admin/utils/logger'
|
6
6
|
autoload :Mysql, 'ab_admin/utils/mysql'
|
7
7
|
|
8
|
+
def all_models
|
9
|
+
Kernel.suppress_warnings do
|
10
|
+
Dir.glob(Rails.root.to_s + '/app/models/**/*.rb').reject { |path| path =~ /concerns|shared/ }.each { |file| require file }
|
11
|
+
end
|
12
|
+
ActiveRecord::Base.direct_descendants
|
13
|
+
end
|
14
|
+
|
8
15
|
def load_files!(base_path = 'lib/utils')
|
9
16
|
Dir[Rails.root.join("#{base_path}/**/*.rb")].each do |path|
|
10
17
|
require_dependency path
|
@@ -66,10 +73,11 @@ module AbAdmin
|
|
66
73
|
Rails.application.routes.url_helpers
|
67
74
|
end
|
68
75
|
|
69
|
-
def full_url(path)
|
76
|
+
def full_url(path, protocol='http://')
|
70
77
|
return path if path =~ %r{^(http|//)}
|
71
|
-
|
72
|
-
|
78
|
+
duo = Rails.application.config.action_mailer.default_url_options
|
79
|
+
host = AbAdmin.base_url || [duo[:host], duo[:port]].compact.join(':') || 'www.example.com'
|
80
|
+
"#{protocol}#{host}#{path}"
|
73
81
|
end
|
74
82
|
|
75
83
|
def js_date_data
|
@@ -142,7 +150,7 @@ module AbAdmin
|
|
142
150
|
end
|
143
151
|
|
144
152
|
def friendly_token(n=10)
|
145
|
-
SecureRandom.base64(n * 2).tr('+/=', 'xyz').first(n)
|
153
|
+
SecureRandom.base64(n * 2).tr('+/=', 'xyz').first(n).downcase
|
146
154
|
end
|
147
155
|
end
|
148
156
|
end
|
@@ -88,7 +88,7 @@ module AbAdmin
|
|
88
88
|
exec = options[:exec].nil? ? true : options[:exec]
|
89
89
|
case symbol_or_proc
|
90
90
|
when Symbol, String
|
91
|
-
obj.send(symbol_or_proc.to_sym)
|
91
|
+
obj.send(symbol_or_proc.to_sym, *options[:attrs])
|
92
92
|
when Proc
|
93
93
|
if exec
|
94
94
|
obj.instance_exec(&symbol_or_proc)
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module AbAdmin
|
2
2
|
module Utils
|
3
3
|
module Logger
|
4
|
-
|
5
4
|
class ExtendedLogger < ::Logger
|
6
5
|
def exception(e, options={})
|
7
6
|
message = "#{e.message} #{"DATA:#{options[:data].inspect}" if options && options[:data]}"
|
@@ -19,7 +18,6 @@ module AbAdmin
|
|
19
18
|
logger.formatter = ::Logger::Formatter.new
|
20
19
|
logger
|
21
20
|
end
|
22
|
-
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'write_xlsx'
|
2
|
+
require 'stringio'
|
2
3
|
|
3
4
|
module AbAdmin
|
4
5
|
module Utils
|
@@ -10,9 +11,28 @@ module AbAdmin
|
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
|
-
class XlsDocument
|
14
|
+
class XlsDocument
|
14
15
|
include AbAdmin::Utils::EvalHelpers
|
15
16
|
|
17
|
+
def initialize(source, options = {})
|
18
|
+
@source = source
|
19
|
+
@options = options
|
20
|
+
@compiled = false
|
21
|
+
@io = ::StringIO.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def workbook
|
25
|
+
@workbook ||= ::WriteXLSX.new(@io)
|
26
|
+
end
|
27
|
+
|
28
|
+
def worksheet
|
29
|
+
@worksheet ||= add_worksheet(worksheet_name)
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_worksheet(*args)
|
33
|
+
@worksheet = workbook.add_worksheet(*args)
|
34
|
+
end
|
35
|
+
|
16
36
|
def default_columns
|
17
37
|
@default_columns ||= @klass.column_names
|
18
38
|
end
|
@@ -26,7 +46,7 @@ module AbAdmin
|
|
26
46
|
end
|
27
47
|
|
28
48
|
def filename
|
29
|
-
@filename ||= [@options[:filename] || "#{@klass.model_name.plural}-#{Time.now.strftime('%Y-%m-%d')}", '.
|
49
|
+
@filename ||= [@options[:filename] || "#{@klass.model_name.plural}-#{Time.now.strftime('%Y-%m-%d')}", '.xlsx'].join
|
30
50
|
end
|
31
51
|
|
32
52
|
def render
|
@@ -55,8 +75,8 @@ module AbAdmin
|
|
55
75
|
bold = workbook.add_format(bold: 1)
|
56
76
|
worksheet.write('A1', columns_names, bold)
|
57
77
|
|
58
|
-
|
59
|
-
|
78
|
+
workbook.close
|
79
|
+
@io.string
|
60
80
|
end
|
61
81
|
|
62
82
|
def worksheet_name
|
@@ -83,7 +103,6 @@ module AbAdmin
|
|
83
103
|
end
|
84
104
|
end
|
85
105
|
end
|
86
|
-
|
87
106
|
end
|
88
107
|
end
|
89
108
|
end
|
data/lib/ab_admin/version.rb
CHANGED
@@ -42,13 +42,13 @@ module AbAdmin
|
|
42
42
|
data = {
|
43
43
|
type: options[:type],
|
44
44
|
source: options[:source].try(:to_json),
|
45
|
-
model: item.class.model_name.singular,
|
45
|
+
model: options[:model] || item.class.model_name.singular,
|
46
46
|
url: options[:url] || "/admin/#{item.class.model_name.plural}/#{item.id}",
|
47
47
|
name: attr,
|
48
48
|
value: options[:value] || item[attr],
|
49
49
|
title: options[:title] || item[attr]
|
50
50
|
}
|
51
|
-
link_to admin_pretty_data(data[:title]
|
51
|
+
link_to admin_pretty_data(data[:title]).html_safe, '#', class: "editable #{options[:class]}", data: data.update(options[:data] || {})
|
52
52
|
end
|
53
53
|
|
54
54
|
def options_for_ckeditor(options = {})
|
@@ -121,12 +121,13 @@ module AbAdmin
|
|
121
121
|
image = item.send(options[:assoc])
|
122
122
|
return nil unless image
|
123
123
|
version = options[:version] || image.class.thumb_size
|
124
|
-
|
124
|
+
image_url_method = options[:image_url_method] || :url
|
125
|
+
popover_content = "<img class='image_link_popover popover_#{options[:assoc]}' src='#{image.send(image_url_method, options[:full_version])}'></img>"
|
125
126
|
popover_data = {content: popover_content, title: AbAdmin.display_name(item)}
|
126
127
|
|
127
128
|
html_options = options.delete(:html_options) || {}
|
128
129
|
html_options.reverse_merge!(rel: 'popover', remote: options[:remote], data: popover_data)
|
129
|
-
link_to image_tag(image.
|
130
|
+
link_to image_tag(image.send(image_url_method, version)), options[:url], html_options
|
130
131
|
end
|
131
132
|
|
132
133
|
def item_image(item, assoc=:photo, size=:thumb)
|
@@ -9,6 +9,7 @@ module AbAdmin
|
|
9
9
|
options[:html][:id] ||= 'search_form'
|
10
10
|
options[:html][:class] ||= 'pjax-form'
|
11
11
|
options[:builder] ||= ::AbAdmin::Views::SearchFormBuilder
|
12
|
+
options[:compact_labels] = settings.dig(:search_form, :compact_labels)
|
12
13
|
options[:method] ||= :get
|
13
14
|
options[:as] ||= 'q'
|
14
15
|
form_for([:admin, object].flatten, *(args << options), &block)
|
@@ -28,7 +29,7 @@ module AbAdmin
|
|
28
29
|
return name unless search
|
29
30
|
|
30
31
|
options = args.first.is_a?(Hash) ? args.shift.dup : {}
|
31
|
-
search_params = params[:q] || {}.with_indifferent_access
|
32
|
+
search_params = (params[:q] || {}).to_h.with_indifferent_access
|
32
33
|
attr_name = (options.delete(:column) || attribute).to_s
|
33
34
|
default_order = options.delete :default_order
|
34
35
|
|
@@ -85,8 +86,13 @@ module AbAdmin
|
|
85
86
|
when AbAdmin::Config::ActionItem
|
86
87
|
instance_exec(item, &action.data) if action.for_context?(self)
|
87
88
|
else
|
88
|
-
|
89
|
-
|
89
|
+
resource_action_link_method = "#{resource_instance_name}_short_action_link"
|
90
|
+
list_link_method = "#{resource_instance_name}_#{action}_list_link"
|
91
|
+
if respond_to?(list_link_method)
|
92
|
+
send(list_link_method, item)
|
93
|
+
elsif respond_to?(resource_action_link_method)
|
94
|
+
send(resource_action_link_method, action, item)
|
95
|
+
end
|
90
96
|
end
|
91
97
|
end
|
92
98
|
|
@@ -110,8 +116,13 @@ module AbAdmin
|
|
110
116
|
when AbAdmin::Config::ActionItem
|
111
117
|
instance_exec(&action.data) if action.for_context?(self)
|
112
118
|
else
|
113
|
-
|
114
|
-
|
119
|
+
resource_action_link_method = "#{resource_instance_name}_action_link"
|
120
|
+
list_link_method = "#{resource_instance_name}_#{action}_link"
|
121
|
+
if respond_to?(list_link_method)
|
122
|
+
send(list_link_method)
|
123
|
+
elsif respond_to?(resource_action_link_method)
|
124
|
+
send(resource_action_link_method, action)
|
125
|
+
end
|
115
126
|
end
|
116
127
|
end
|
117
128
|
|