slash_admin 1.5.2 → 1.5.7

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: dd6fca0261e85e32892848c0fc3b5ea84e76c839c410a6e0f37d05474cc41b1a
4
- data.tar.gz: ee1e603f3e4acb9e0ea876f1aba28495ae7686eae58ea7be36dadb95ef68b644
3
+ metadata.gz: 905087476b4fe1a2cefd7cba21a3214fcf4834cb4fed1f1c5ccf00570fb246af
4
+ data.tar.gz: 5d29e7eb6d2ee39960526c5a85f033b34aa7549c3b38e53db84d137778ac1993
5
5
  SHA512:
6
- metadata.gz: 79d797a173c872decb0062ba27623a110870ecf13039953f0c37d7cdad0dedcbe32a3d4b4028ce802e563c7023e25e9bee086f6b4774cd255de095e6a8f26f54
7
- data.tar.gz: 2df908377331a6a5ed064c6b4a38784bad47d6f07b30d9cb0c7743ffd41918f30b345d53bedeac6db8acf35dd7233511dac88c3699ec0d76860b7177b625d368
6
+ metadata.gz: 0aafd6dfba8ff8d7a46059b7a37380d8ef8b16df1b5fa6b7659942259ea99f0114e2f6e855857a92b7f50b4cea5763c6aec1a7a6913cf5fbb763e7e8ed0ca801
7
+ data.tar.gz: 32ef3759aa3558806282585bc470fbbcaf9dacdc9677a6710d0b96554c87f208380ba45b6335b0a68f89937dd68e99df4bd5d600ffc910378d47f7452b5470e3
@@ -29,7 +29,7 @@ $border-radius: 0.15rem !default;
29
29
 
30
30
  @import "bootstrap";
31
31
 
32
- @import url("https://use.fontawesome.com/releases/v5.12.1/css/all.css");
32
+ @import url("https://use.fontawesome.com/releases/v5.15.1/css/all.css");
33
33
 
34
34
  @import url("https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all");
35
35
  @import url("https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css");
@@ -252,7 +252,6 @@ p[data-f-id="pbf"] {
252
252
  }
253
253
 
254
254
  .tag-boolean {
255
- width: 45px;
256
255
  text-align: center;
257
256
  display: inline-block;
258
257
  }
@@ -764,6 +763,7 @@ p[data-f-id="pbf"] {
764
763
  > a.nav-link {
765
764
  color: $textColorHover;
766
765
  font-weight: bold;
766
+ background-color: $border;
767
767
  }
768
768
 
769
769
  &::after {
@@ -1240,9 +1240,12 @@ p[data-f-id="pbf"] {
1240
1240
  .datatable_wrapper {
1241
1241
  .tag {
1242
1242
  font-size: 13px;
1243
- padding: 2px 5px;
1243
+ padding: 2px 8px;
1244
1244
  color: #fff;
1245
1245
  text-transform: uppercase;
1246
+ a, a:hover, a:visited, a:active {
1247
+ color: #fff;
1248
+ }
1246
1249
  }
1247
1250
  }
1248
1251
 
@@ -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
15
15
 
16
16
  def index
17
17
  authorize! :index, @model_class
@@ -157,6 +157,10 @@ module SlashAdmin
157
157
  {}
158
158
  end
159
159
 
160
+ def no_title
161
+ []
162
+ end
163
+
160
164
  def handle_has_one
161
165
  @has_one = {}
162
166
  Array.wrap(update_params + create_params).uniq.each do |p|
@@ -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,8 +100,10 @@
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", model: attr.to_s.pluralize) %>"
105
+ >
106
+ <i class="fa fa-list"></i>
97
107
  </button>
98
108
  <div class="modal fade" id="modal-see-assoc-<%= attr.to_s %>-<%= m.id %>" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
99
109
  <div class="modal-dialog" role="document">
@@ -19,7 +19,14 @@
19
19
  <span class="show-attr-title"><%= @model_class.human_attribute_name(a) %></span>
20
20
  <% if @model.send(a).present? %>
21
21
  <br/>
22
- <img src="<%= @model.send(a) %>" class="img-fluid background-default"/>
22
+ <% extension = @model.send(a).file.try(:extension).try(:downcase) || @model.send(a).file.try(:format).try(:downcase) || file.try(:file).try(:extension) %>
23
+ <% if extension.present? %>
24
+ <% if %w{pdf doc docx xls xlsx ppt pptx}.include?(extension) %>
25
+ <iframe src="https://docs.google.com/gview?url=<%= @model.send(a) %>&embedded=true" style="width:100%; height:600px;" frameborder="0"></iframe>
26
+ <% else %>
27
+ <img src="<%= @model.send(a) %>" class="img-fluid background-default"/>
28
+ <% end %>
29
+ <% end %>
23
30
  <% end %>
24
31
  </div>
25
32
  </div>
@@ -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
  },
@@ -0,0 +1,3 @@
1
+ JsRoutes.setup do |config|
2
+ config.namespace = "Routes"
3
+ end
@@ -26,6 +26,7 @@ en:
26
26
  save: Save
27
27
  delete: Delete
28
28
  new: New
29
+ see_model: "View the %{model}"
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: "Voir les %{model}"
32
33
  tools: Outils
33
34
  order: Trier
34
35
  erase: Effacer
@@ -1,3 +1,3 @@
1
1
  module SlashAdmin
2
- VERSION = "1.5.2"
2
+ VERSION = "1.5.7"
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.2
4
+ version: 1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - KOVACS Nicolas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-31 00:00:00.000000000 Z
11
+ date: 2021-04-21 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.0'
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.0'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: http_accept_language
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -390,6 +390,7 @@ files:
390
390
  - app/views/slash_admin/shared/_new_form_buttons.html.erb
391
391
  - app/views/slash_admin/shared/_sub_header.html.erb
392
392
  - app/views/slash_admin/shared/_tooltip.html.erb
393
+ - config/initializers/js_routes.rb
393
394
  - config/initializers/validators.rb
394
395
  - config/locales/en.yml
395
396
  - config/locales/fr.yml
@@ -456,7 +457,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
456
457
  - !ruby/object:Gem::Version
457
458
  version: '0'
458
459
  requirements: []
459
- rubygems_version: 3.1.4
460
+ rubygems_version: 3.2.16
460
461
  signing_key:
461
462
  specification_version: 4
462
463
  summary: A modern and overridable admin gem, just the rails way.