slash_admin 1.5.5 → 1.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/slash_admin/application.scss +6 -0
- data/app/controllers/slash_admin/models_controller.rb +13 -5
- data/app/views/slash_admin/base/_data_list.html.erb +30 -9
- data/app/views/slash_admin/fields/_belongs_to.html.erb +1 -1
- data/app/views/slash_admin/fields/_has_many.html.erb +1 -1
- data/app/views/slash_admin/fields/_nested_belongs_to.html.erb +1 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/fr.yml +1 -0
- data/lib/slash_admin/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88010a73a59d851d79e9ec5a1642fa6f6a8df7beb1ef864a7e0d7017f7ed4e64
|
4
|
+
data.tar.gz: 14d9b2012626a34b1be33a0a646524c317d7304543776af7cfa5b772d6d37cee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96c9018cc4f83b7c718fe96fc04675efeac895fd5dbd9703334ecfc664e81d4563eb190b1fd7d8a5e7dfca6b1e3bb76b03d66d5c51aab58a0aa31b23fa62f3f2
|
7
|
+
data.tar.gz: ab0ecfd5f77bee251f34a93aed0eb709310b705659457c330c485dd001a8db5dad615ec24d1e40ad97b2acee071f037df7e68de091c76107679200a1f49f5938
|
@@ -11,7 +11,7 @@ module SlashAdmin
|
|
11
11
|
before_action :handle_default_params
|
12
12
|
before_action :handle_associations
|
13
13
|
|
14
|
-
helper_method :list_params, :export_params, :create_params, :update_params, :show_params, :nested_params, :should_add_translatable?, :translatable_params, :available_locales, :tooltips
|
14
|
+
helper_method :list_params, :export_params, :create_params, :update_params, :show_params, :nested_params, :should_add_translatable?, :translatable_params, :available_locales, :tooltips, :no_title, :icons
|
15
15
|
|
16
16
|
def index
|
17
17
|
authorize! :index, @model_class
|
@@ -157,6 +157,14 @@ module SlashAdmin
|
|
157
157
|
{}
|
158
158
|
end
|
159
159
|
|
160
|
+
def no_title
|
161
|
+
[]
|
162
|
+
end
|
163
|
+
|
164
|
+
def icons
|
165
|
+
{}
|
166
|
+
end
|
167
|
+
|
160
168
|
def handle_has_one
|
161
169
|
@has_one = {}
|
162
170
|
Array.wrap(update_params + create_params).uniq.each do |p|
|
@@ -214,7 +222,7 @@ module SlashAdmin
|
|
214
222
|
|
215
223
|
flash[:success] = t("slash_admin.controller.nestable.success")
|
216
224
|
|
217
|
-
redirect_to(main_app.polymorphic_url([
|
225
|
+
redirect_to(main_app.polymorphic_url([:slash_admin, @model_class])) && return if params.key?(:submit_redirect)
|
218
226
|
redirect_to main_app.polymorphic_url([:nestable, :slash_admin, @model_class])
|
219
227
|
end
|
220
228
|
end
|
@@ -342,9 +350,9 @@ module SlashAdmin
|
|
342
350
|
end
|
343
351
|
|
344
352
|
def handle_redirect_after_submit
|
345
|
-
path = main_app.edit_polymorphic_url([
|
346
|
-
path = main_app.polymorphic_url([
|
347
|
-
path = main_app.new_polymorphic_url([
|
353
|
+
path = main_app.edit_polymorphic_url([:slash_admin, @model])
|
354
|
+
path = main_app.polymorphic_url([:slash_admin, @model_class]) if params.key?(:submit_redirect)
|
355
|
+
path = main_app.new_polymorphic_url([:slash_admin, @model_class]) if params.key?(:submit_add)
|
348
356
|
|
349
357
|
path
|
350
358
|
end
|
@@ -28,13 +28,20 @@
|
|
28
28
|
</th>
|
29
29
|
<% list_params.each do |attr| %>
|
30
30
|
<% if attr.is_a?(Hash) %>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
<% if no_title.include? attr.keys.first %>
|
32
|
+
<th></th>
|
33
|
+
<% else %>
|
34
|
+
<th>
|
35
|
+
<%= @model_class.human_attribute_name(attr.keys.first) %>
|
36
|
+
<% if tooltips.key? attr.keys.first %>
|
37
|
+
<a href="#" data-toggle="tooltip" data-placement="top" title="<%= tooltips[attr.keys.first] %>"><i class="fas fa-question-circle"></i></a>
|
38
|
+
<% end %>
|
39
|
+
</th>
|
40
|
+
<% end %>
|
37
41
|
<% else %>
|
42
|
+
<% if no_title.include? attr %>
|
43
|
+
<th></th>
|
44
|
+
<% else %>
|
38
45
|
<th
|
39
46
|
<% if orderable?(@model_class, attr) %>
|
40
47
|
data-order-field="<%= attr %>"
|
@@ -50,6 +57,7 @@
|
|
50
57
|
<a href="#" data-toggle="tooltip" data-placement="top" title="<%= tooltips[attr] %>"><i class="fas fa-question-circle"></i></a>
|
51
58
|
<% end %>
|
52
59
|
</th>
|
60
|
+
<% end %>
|
53
61
|
<% end %>
|
54
62
|
<% end %>
|
55
63
|
<th class="text-center"><%= t('slash_admin.view.actions') %></th>
|
@@ -92,14 +100,27 @@
|
|
92
100
|
</td>
|
93
101
|
<% elsif @has_many_fields.include?(attr) %>
|
94
102
|
<td class="<%= attr.to_s.parameterize.underscore.downcase %>">
|
95
|
-
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modal-see-assoc-<%= attr.to_s %>-<%= m.id %>"
|
96
|
-
|
103
|
+
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modal-see-assoc-<%= attr.to_s %>-<%= m.id %>"
|
104
|
+
data-toggle="tooltip" data-placement="top" title="<%= t("slash_admin.view.see_model_of", model: attr.to_s.pluralize, of: m.name) %>"
|
105
|
+
>
|
106
|
+
<span class="list-icon">
|
107
|
+
<i class="fas fa-ellipsis-v"></i>
|
108
|
+
<% if icons.key? attr %>
|
109
|
+
<%= raw icons[attr.to_sym] %>
|
110
|
+
<% else %>
|
111
|
+
<%= attr.to_s.first.upcase %>
|
112
|
+
<% end %>
|
113
|
+
</span>
|
97
114
|
</button>
|
98
115
|
<div class="modal fade" id="modal-see-assoc-<%= attr.to_s %>-<%= m.id %>" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
|
99
116
|
<div class="modal-dialog" role="document">
|
100
117
|
<div class="modal-content">
|
101
118
|
<div class="modal-header">
|
102
|
-
<h5 class="modal-title" id="exampleModalLabel"
|
119
|
+
<h5 class="modal-title" id="exampleModalLabel">
|
120
|
+
<% if icons.key? attr %>
|
121
|
+
<%= raw icons[attr.to_sym] %>
|
122
|
+
<% end %>
|
123
|
+
<%= t("model.#{attr}") %>
|
103
124
|
<strong>(<%= m.send(attr).length %>)</strong></h5>
|
104
125
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
105
126
|
<span aria-hidden="true">×</span>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= f.label a, class: "form-control-label #{required?(f.object, a).present? ? 'required' : ''}" %>
|
2
2
|
<%= render 'slash_admin/shared/tooltip', a: a %>
|
3
3
|
<%= f.collection_select a.to_s + '_id',
|
4
|
-
class_name_from_association(f.object, a).constantize.all.order(f.object.send(a).present? ? "CASE WHEN id = #{f.object.send(a).try(:id)} THEN 1 ELSE 0 END DESC" : "id DESC").limit(20), :id, object_label(class_name_from_association(f.object, a)),
|
4
|
+
class_name_from_association(f.object, a).constantize.all.order(f.object.send(a).present? ? Arel.sql("CASE WHEN id = #{f.object.send(a).try(:id)} THEN 1 ELSE 0 END DESC") : "id DESC" ).limit(20), :id, object_label(class_name_from_association(f.object, a)),
|
5
5
|
{
|
6
6
|
include_blank: true,
|
7
7
|
},
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= f.label a, class: "form-control-label #{required?(f.object, a) ? 'required' : ''}" %>
|
2
2
|
<%= render 'slash_admin/shared/tooltip', a: a %>
|
3
3
|
<%= f.collection_select "#{a.to_s.singularize}_ids",
|
4
|
-
class_name_from_association(f.object, a).constantize.all.order(f.object.send(a).present? ? "CASE WHEN id IN(#{f.object.send(a).pluck(:id).join(',')}) THEN 1 ELSE 0 END DESC" : "id DESC").limit(20), :id,
|
4
|
+
class_name_from_association(f.object, a).constantize.all.order(f.object.send(a).present? ? Arel.sql("CASE WHEN id IN(#{f.object.send(a).pluck(:id).join(',')}) THEN 1 ELSE 0 END DESC") : "id DESC").limit(20), :id,
|
5
5
|
object_label(class_name_from_association(f.object, a)),
|
6
6
|
{include_blank: true},
|
7
7
|
{
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= render 'slash_admin/shared/tooltip', a: a %>
|
3
3
|
<% class_name_from_association = class_name_from_association(f.object, a) %>
|
4
4
|
<%= f.collection_select a.to_s + '_id',
|
5
|
-
class_name_from_association.constantize.all.order(f.object.send(a).present? ? "CASE WHEN id = #{f.object.send(a).try(:id)} THEN 1 ELSE 0 END DESC" : "id DESC").limit(20), :id, object_label(a),
|
5
|
+
class_name_from_association.constantize.all.order(f.object.send(a).present? ? Arel.sql("CASE WHEN id = #{f.object.send(a).try(:id)} THEN 1 ELSE 0 END DESC") : "id DESC").limit(20), :id, object_label(a),
|
6
6
|
{
|
7
7
|
include_blank: true,
|
8
8
|
},
|
data/config/locales/en.yml
CHANGED
data/config/locales/fr.yml
CHANGED
data/lib/slash_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slash_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KOVACS Nicolas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '6.
|
19
|
+
version: '6.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '6.
|
26
|
+
version: '6.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: http_accept_language
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -457,7 +457,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
457
457
|
- !ruby/object:Gem::Version
|
458
458
|
version: '0'
|
459
459
|
requirements: []
|
460
|
-
rubygems_version: 3.
|
460
|
+
rubygems_version: 3.2.16
|
461
461
|
signing_key:
|
462
462
|
specification_version: 4
|
463
463
|
summary: A modern and overridable admin gem, just the rails way.
|