slash_admin 1.4 → 1.5.3
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/README.md +2 -2
- data/app/assets/stylesheets/slash_admin/application.scss +19 -19
- data/app/controllers/slash_admin/models_controller.rb +2 -2
- data/app/views/slash_admin/base/_data_list.html.erb +3 -1
- data/app/views/slash_admin/base/_filters.html.erb +7 -0
- data/app/views/slash_admin/base/_wysiwyg.html.erb +1 -0
- data/app/views/slash_admin/fields/_belongs_to.html.erb +13 -8
- data/app/views/slash_admin/fields/_has_one.html.erb +10 -8
- data/app/views/slash_admin/shared/_header.html.erb +13 -2
- data/config/locales/en.yml +1 -0
- data/config/locales/fr.yml +1 -0
- data/lib/generators/slash_admin/install/install_generator.rb +1 -1
- data/lib/slash_admin/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6caa63d44c0fd3a5ff6acafec4a72e9ac6cf3edd82ee433b0ce21abcb39d8747
|
4
|
+
data.tar.gz: 7f049cb5a8bac129a0767f73be8fd690793f69973e98097b2acb38139337d610
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf211059c6d8c11879a51e534978e3bafad97cc5207d9fcf4c62e4c9da78e0323a49267cc1298a5e8d0c919850d9b2a4ac162b4ea8a1625fb5bcaaf2211ca05a
|
7
|
+
data.tar.gz: 94393cada60879a3b3d285bdd789f83c3eeadb5bcec2127feff2103436b9db2177388fbbef505a6bc0bcf61b89645c210fcf3eece9bc6ac464f850c59156e089
|
data/README.md
CHANGED
@@ -86,8 +86,8 @@ If your apps uses Sprockets 4+, you'll need to add SlashAdmin assets to your `ma
|
|
86
86
|
`app/assets/config/manifest.js`
|
87
87
|
|
88
88
|
```
|
89
|
-
//= link
|
90
|
-
//= link
|
89
|
+
//= link slash_admin/application.css
|
90
|
+
//= link slash_admin/application.js
|
91
91
|
```
|
92
92
|
|
93
93
|
`config/routes.rb`
|
@@ -91,7 +91,7 @@ p[data-f-id="pbf"] {
|
|
91
91
|
margin: 0;
|
92
92
|
|
93
93
|
label.form-control-label {
|
94
|
-
display: block;
|
94
|
+
display: inline-block;
|
95
95
|
font-weight: 600;
|
96
96
|
}
|
97
97
|
|
@@ -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
|
}
|
@@ -266,20 +265,6 @@ p[data-f-id="pbf"] {
|
|
266
265
|
}
|
267
266
|
}
|
268
267
|
|
269
|
-
.field_with_errors {
|
270
|
-
label {
|
271
|
-
color: $red;
|
272
|
-
}
|
273
|
-
|
274
|
-
input {
|
275
|
-
border-color: $red !important;
|
276
|
-
}
|
277
|
-
|
278
|
-
& + .form-control-feedback {
|
279
|
-
color: $red;
|
280
|
-
}
|
281
|
-
}
|
282
|
-
|
283
268
|
.block-language {
|
284
269
|
display: block;
|
285
270
|
margin: 15px 0;
|
@@ -436,6 +421,16 @@ p[data-f-id="pbf"] {
|
|
436
421
|
color: $primary;
|
437
422
|
}
|
438
423
|
|
424
|
+
.has-danger {
|
425
|
+
.form-control, input, select, textarea {
|
426
|
+
border-color: $error !important;
|
427
|
+
}
|
428
|
+
|
429
|
+
label, .form-control-feedback {
|
430
|
+
color: $error !important;
|
431
|
+
}
|
432
|
+
}
|
433
|
+
|
439
434
|
.scroll-to-top {
|
440
435
|
text-align: center;
|
441
436
|
position: fixed;
|
@@ -484,11 +479,9 @@ p[data-f-id="pbf"] {
|
|
484
479
|
|
485
480
|
.badge {
|
486
481
|
font-size: 11px;
|
487
|
-
font-weight: 300;
|
488
482
|
height: 18px;
|
489
483
|
color: #fff;
|
490
484
|
padding: 3px 6px;
|
491
|
-
border-radius: 12px;
|
492
485
|
text-shadow: none;
|
493
486
|
text-align: center;
|
494
487
|
vertical-align: middle;
|
@@ -571,6 +564,10 @@ p[data-f-id="pbf"] {
|
|
571
564
|
padding-left: 8px;
|
572
565
|
}
|
573
566
|
|
567
|
+
.dropdown .dropdown-menu a.dropdown-item {
|
568
|
+
color: #7f96ac;
|
569
|
+
}
|
570
|
+
|
574
571
|
.nav-item {
|
575
572
|
margin: 0;
|
576
573
|
padding: 0;
|
@@ -1242,9 +1239,12 @@ p[data-f-id="pbf"] {
|
|
1242
1239
|
.datatable_wrapper {
|
1243
1240
|
.tag {
|
1244
1241
|
font-size: 13px;
|
1245
|
-
padding: 2px
|
1242
|
+
padding: 2px 8px;
|
1246
1243
|
color: #fff;
|
1247
1244
|
text-transform: uppercase;
|
1245
|
+
a, a:hover, a:visited, a:active {
|
1246
|
+
color: #fff;
|
1247
|
+
}
|
1248
1248
|
}
|
1249
1249
|
}
|
1250
1250
|
|
@@ -9,7 +9,7 @@ module SlashAdmin
|
|
9
9
|
before_action :handle_default
|
10
10
|
before_action :nestable_config
|
11
11
|
before_action :handle_default_params
|
12
|
-
before_action :
|
12
|
+
before_action :handle_associations
|
13
13
|
|
14
14
|
helper_method :list_params, :export_params, :create_params, :update_params, :show_params, :nested_params, :should_add_translatable?, :translatable_params, :available_locales, :tooltips
|
15
15
|
|
@@ -406,7 +406,7 @@ module SlashAdmin
|
|
406
406
|
SlashAdmin.configuration.available_locales
|
407
407
|
end
|
408
408
|
|
409
|
-
def
|
409
|
+
def handle_associations
|
410
410
|
@belongs_to_fields = @model_class.reflect_on_all_associations(:belongs_to).map(&:name)
|
411
411
|
@has_many_fields = @model_class.reflect_on_all_associations(:has_many).map(&:name)
|
412
412
|
@has_one_fields = @model_class.reflect_on_all_associations(:has_one).map(&:name)
|
@@ -75,7 +75,9 @@
|
|
75
75
|
<% end %>
|
76
76
|
</td>
|
77
77
|
<% else %>
|
78
|
-
<td class="<%= attr.to_s.parameterize.underscore.downcase %>"
|
78
|
+
<td class="<%= attr.to_s.parameterize.underscore.downcase %>">
|
79
|
+
<%= render attr[attr.keys.first][:type].to_s, model: m, attr: attr.keys.first %>
|
80
|
+
</td>
|
79
81
|
<% end %>
|
80
82
|
<% else %>
|
81
83
|
<% if m.send(attr).is_a?(TrueClass) || m.send(attr).is_a?(FalseClass) %>
|
@@ -60,6 +60,13 @@
|
|
60
60
|
<% else %>
|
61
61
|
<td> </td>
|
62
62
|
<% end %>
|
63
|
+
<% elsif attr.is_a?(Hash) && attr[:filter].present? %>
|
64
|
+
<td>
|
65
|
+
<% case attr[:filter] %>
|
66
|
+
<% when :text, :string %>
|
67
|
+
<input type="text" name="filters[<%= attr.keys.first %>]" value="<%= params[:filters][attr.keys.first] rescue nil %>" class="form-control form-control-sm"/>
|
68
|
+
<% end %>
|
69
|
+
</td>
|
63
70
|
<% else %>
|
64
71
|
<td> </td>
|
65
72
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= truncate(strip_tags(model.send(attr)), length: 50) %>
|
@@ -1,11 +1,16 @@
|
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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)),
|
5
|
+
{
|
6
|
+
include_blank: true,
|
7
|
+
},
|
8
|
+
{
|
9
|
+
'data-placeholder': t('slash_admin.view.select_model', model_name: class_name_from_association(f.object, a).constantize.model_name.human.downcase),
|
10
|
+
'data-model': class_name_from_association(f.object, a).constantize.model_name.to_s.underscore,
|
11
|
+
'data-fields': "SlashAdmin::Models::#{class_name_from_association(f.object, a).classify.pluralize}Controller".constantize.new.autocomplete_params.join(' '),
|
12
|
+
class: 'form-control select2-model-single',
|
13
|
+
required: required?(f.object, a).present?,
|
14
|
+
selected: f.object.send(a).present? ? f.object.send(a).try(:id) : nil,
|
15
|
+
}
|
16
|
+
%>
|
@@ -1,11 +1,13 @@
|
|
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.select a.to_s,
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
options_for_select(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).collect { |assoc| [assoc.send(object_label(class_name_from_association(f.object, a))), assoc.id] }, f.object.send(a).present? ? f.object.send(a).try(:id) : nil),
|
5
|
+
{
|
6
|
+
include_blank: true,
|
7
|
+
},
|
8
|
+
'data-placeholder': t('slash_admin.view.select_model', model_name: class_name_from_association(f.object, a).constantize.model_name.human.downcase),
|
9
|
+
'data-model': class_name_from_association(f.object, a).constantize.model_name.to_s.underscore,
|
10
|
+
'data-fields': "SlashAdmin::Models::#{class_name_from_association(f.object, a).classify.pluralize}Controller".constantize.new.autocomplete_params.join(' '),
|
11
|
+
class: 'form-control select2-model-single',
|
12
|
+
required: required?(f.object, a).present?
|
13
|
+
%>
|
@@ -10,8 +10,12 @@
|
|
10
10
|
<div class="navbar-nav mr-auto mt-2 mt-lg-0">
|
11
11
|
</div>
|
12
12
|
<ul class="nav right-nav-fix">
|
13
|
-
<li class="nav-item">
|
14
|
-
|
13
|
+
<li class="nav-item <%= can?(:update, current_admin) ? 'dropdown' : '' %>">
|
14
|
+
<% if can?(:update, current_admin) %>
|
15
|
+
<a class= "nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown">
|
16
|
+
<% else %>
|
17
|
+
<a class="nav-link">
|
18
|
+
<% end %>
|
15
19
|
<% if current_admin.avatar.present? %>
|
16
20
|
<img src="<%= current_admin.avatar.url %>" class="rounded-circle"/>
|
17
21
|
<% else %>
|
@@ -19,6 +23,13 @@
|
|
19
23
|
<% end %>
|
20
24
|
<span class=""><%= current_admin.login %></span>
|
21
25
|
</a>
|
26
|
+
<% if can?(:update, current_admin) %>
|
27
|
+
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
28
|
+
<a href="<%= edit_slash_admin_admin_path current_admin %>" class="dropdown-item">
|
29
|
+
<i class="fas fa-user-circle"></i> <%= t('slash_admin.view.edit_account') %>
|
30
|
+
</a>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
22
33
|
</li>
|
23
34
|
|
24
35
|
<li class="nav-item">
|
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:
|
4
|
+
version: 1.5.3
|
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-
|
11
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -342,6 +342,7 @@ files:
|
|
342
342
|
- app/views/slash_admin/base/_data_show.html.erb
|
343
343
|
- app/views/slash_admin/base/_filters.html.erb
|
344
344
|
- app/views/slash_admin/base/_translatable_fields.html.erb
|
345
|
+
- app/views/slash_admin/base/_wysiwyg.html.erb
|
345
346
|
- app/views/slash_admin/base/edit.html.erb
|
346
347
|
- app/views/slash_admin/base/index.html.erb
|
347
348
|
- app/views/slash_admin/base/index.xls.erb
|
@@ -455,7 +456,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
455
456
|
- !ruby/object:Gem::Version
|
456
457
|
version: '0'
|
457
458
|
requirements: []
|
458
|
-
rubygems_version: 3.1.
|
459
|
+
rubygems_version: 3.1.4
|
459
460
|
signing_key:
|
460
461
|
specification_version: 4
|
461
462
|
summary: A modern and overridable admin gem, just the rails way.
|