slash_admin 1.5.3 → 1.5.8
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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/slash_admin/application.scss +8 -1
- data/app/controllers/slash_admin/models_controller.rb +9 -1
- data/app/views/slash_admin/base/_data_list.html.erb +30 -9
- data/app/views/slash_admin/base/_data_show.html.erb +8 -1
- 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/initializers/js_routes.rb +3 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/fr.yml +1 -0
- data/lib/slash_admin/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eab3ae290969bd0aafca3d62534ad33addd33964b3d0a86252a3e1b572899a61
|
4
|
+
data.tar.gz: 11dc8b152fe0ae371a9455368d093053830b5022aca93e81e219241994198ad1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1270c0a3a732ccd0e5700defcfc5bb1be81987014e3a3b8329bbb8ce2d5220b9eb1403d195851d246961b31d7cb21e98b84964b6fdbbf35986a33203b585158
|
7
|
+
data.tar.gz: 9cf8b935b5d76c57eff1ccebbce9623748efff7cc703663c1e47dbcc1e623792222bbc7c775133f5a56788bea8e0d18718e588dcde153b40e72b07bc7338b73e
|
@@ -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.
|
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");
|
@@ -763,6 +763,7 @@ p[data-f-id="pbf"] {
|
|
763
763
|
> a.nav-link {
|
764
764
|
color: $textColorHover;
|
765
765
|
font-weight: bold;
|
766
|
+
background-color: $border;
|
766
767
|
}
|
767
768
|
|
768
769
|
&::after {
|
@@ -1492,3 +1493,9 @@ p[data-f-id="pbf"] {
|
|
1492
1493
|
}
|
1493
1494
|
}
|
1494
1495
|
}
|
1496
|
+
|
1497
|
+
.list-icon {
|
1498
|
+
font-weight: 900;
|
1499
|
+
display: flex;
|
1500
|
+
align-items: center;
|
1501
|
+
}
|
@@ -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|
|
@@ -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>
|
@@ -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
|
-
|
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
|
},
|
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.8
|
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-04-22 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
|
@@ -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.
|
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.
|