slash_admin 1.5.6 → 1.5.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75a4d10e9ae3f3459f4f84a212d4cd959af543dfe9313daa264b860f057f93ad
4
- data.tar.gz: 220d6763eea19e9eea0b556b092305d7e27b1cc25d075612df92888383f225e7
3
+ metadata.gz: 3e44e1ffffa251040a29d6c0475dc7bbdb6f8f10a37f964fcbcdb73a4c72c02a
4
+ data.tar.gz: 6179d302e57eea112b621656361cb863ce813fed1bc8f1f1e58cd2caea9c3d86
5
5
  SHA512:
6
- metadata.gz: 68e65e9c493da98d401df31ff689bb752d67d2d4343083473b988ae5a228dbc03969778807e3199de72eb5f5d23c55f8934771020a447b18bc33feafdd424524
7
- data.tar.gz: 93556b4c7d5e7078698f1cf30cab0ed0ac8900a5f6bf0d83570244c1c45eebcc814bbeacc5e79473416096018b137ebe63c037682f1ab69b847c9fc9a6a49894
6
+ metadata.gz: 2eaf5a8185b3fc853a0159c853be6bc5ba301fb6272401d305cc47623189211df42ff3e4b3026fb76cbc19311687e3feb4d034694a1a46cb7ae866114d78b45b
7
+ data.tar.gz: 2737b58165c8b74999c6d96faa5b83d55edad399388ada8b671759c3b5de3526d57c923ff87293b1130c7c71238311e90e26bb5dd64a21d94281cd73ed413919
@@ -1493,3 +1493,13 @@ p[data-f-id="pbf"] {
1493
1493
  }
1494
1494
  }
1495
1495
  }
1496
+
1497
+ .list-icon {
1498
+ font-weight: 900;
1499
+ display: flex;
1500
+ align-items: center;
1501
+ }
1502
+
1503
+ .menu-divider-below {
1504
+ border-bottom: #e3e9fc 1px solid;
1505
+ }
@@ -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(["slash_admin", @model_class])) && return if params.key?(:submit_redirect)
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(["slash_admin", @model])
346
- path = main_app.polymorphic_url(["slash_admin", @model_class]) if params.key?(:submit_redirect)
347
- path = main_app.new_polymorphic_url(["slash_admin", @model_class]) if params.key?(:submit_add)
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
- <th>
32
- <%= @model_class.human_attribute_name(attr.keys.first) %>
33
- <% if tooltips.key? attr.keys.first %>
34
- <a href="#" data-toggle="tooltip" data-placement="top" title="<%= tooltips[attr.keys.first] %>"><i class="fas fa-question-circle"></i></a>
35
- <% end %>
36
- </th>
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
- <i class="fa fa-list"></i> <%= t('slash_admin.view.see') %>
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
+ &nbsp;<%= raw icons[attr.to_sym] %>
110
+ <% else %>
111
+ &nbsp;<%= 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"><%= t('slash_admin.view.associations') %>
119
+ <h5 class="modal-title" id="exampleModalLabel">
120
+ <% if icons.key? attr %>
121
+ <%= raw icons[attr.to_sym] %>&nbsp;
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">&times;</span>
@@ -22,11 +22,11 @@
22
22
  <div class="sub-menu">
23
23
  <table class="table-sm">
24
24
  <tbody>
25
- <% s[:sub_menu].each do |sub| %>
25
+ <% s[:sub_menu].each_with_index do |sub, idx| %>
26
26
  <% if sub[:path].present? %>
27
- <tr class="clickable-row <%= request.fullpath == sub[:path] ? 'active' : '' %>"
28
- data-href="<%= sub[:path] %>"
29
- data-blank="<%= s[:blank].present? ? 'true' : 'false' %>">
27
+ <tr class="clickable-row <%= request.fullpath == sub[:path] ? 'active' : '' %> <%= s.dig(:sub_menu, idx + 1, :layout) == 'divider' ? 'menu-divider-below' : '' %>"
28
+ data-href="<%= sub[:path] %>"
29
+ data-blank="<%= s[:blank].present? ? 'true' : 'false' %>">
30
30
  <td>
31
31
  <a href="<%= sub[:path] %>" class="<%= request.fullpath == sub[:path] ? 'active' : '' %>" target="<%= s[:blank].present? ? '_blank' : '_self' %>">
32
32
  <% if sub[:icon] %>
@@ -41,8 +41,8 @@
41
41
  </td>
42
42
  </tr>
43
43
  <% else %>
44
- <% if access_model?(sub) %>
45
- <tr class="clickable-row <%= controller.controller_name == sub[:model].name.split('::').last.tableize ? 'active' : '' %>"
44
+ <% if access_model?(sub) && sub[:layout].blank? %>
45
+ <tr class="clickable-row <%= controller.controller_name == sub[:model].name.split('::').last.tableize ? 'active' : '' %> <%= s.dig(:sub_menu, idx + 1, :layout) == 'divider' ? 'menu-divider-below' : '' %>"
46
46
  data-href="<%= polymorphic_url([:slash_admin, sub[:model]]) %>"
47
47
  data-blank="<%= s[:blank].present? ? 'true' : 'false' %>">
48
48
  <td>
@@ -26,6 +26,7 @@ en:
26
26
  save: Save
27
27
  delete: Delete
28
28
  new: New
29
+ see_model_of: "View the %{model} of %{of}"
29
30
  edit: "Edit: %{model_name}"
30
31
  show: "Show: %{model_name}"
31
32
  tools: Tools
@@ -29,6 +29,7 @@ fr:
29
29
  edit: "Édition: %{model_name}"
30
30
  show: "Affichage: %{model_name}"
31
31
  see: Voir
32
+ see_model_of: "Voir les %{model} de %{of}"
32
33
  tools: Outils
33
34
  order: Trier
34
35
  erase: Effacer
@@ -1,3 +1,3 @@
1
1
  module SlashAdmin
2
- VERSION = "1.5.6"
2
+ VERSION = "1.5.10"
3
3
  end
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.6
4
+ version: 1.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - KOVACS Nicolas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-13 00:00:00.000000000 Z
11
+ date: 2021-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -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.1.4
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.