slash_admin 1.4 → 1.5.3

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: aa8f3a52be4da9f7ddc2f3a4888ed7affa7a49aeeeecca3b54b6413d92fad5f5
4
- data.tar.gz: 10bda4bc75d87a697aedb1d5f8ee48d0f5203892aeebb9d7d985a2dc8a509897
3
+ metadata.gz: 6caa63d44c0fd3a5ff6acafec4a72e9ac6cf3edd82ee433b0ce21abcb39d8747
4
+ data.tar.gz: 7f049cb5a8bac129a0767f73be8fd690793f69973e98097b2acb38139337d610
5
5
  SHA512:
6
- metadata.gz: a057c62b96bc937e332365d5b1277e598f4839af757ca616000e5f06da51a1c043087ab4ed20e18b1071f1881c2639306c0c319a74d8ba5c7a9df2e152e229ff
7
- data.tar.gz: 054aee793717a4df3bcb2aeccc26fea5e21286e7a1e2bd25d5a3e97b0be11b1962356f380bfa7e7a7342066f51a7001ba22cc10b54c43a912cc6fcb3e33fd8a7
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 administrate/application.css
90
- //= link administrate/application.js
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 5px;
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 :handle_assocations
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 handle_assocations
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 %>"><%= render attr.keys.first.to_s, model: m %></td>
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>&nbsp;</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>&nbsp;</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
- 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
- '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', required: required?(f.object, a).present? %>
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
- 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] },
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', required: required?(f.object, a).present? %>
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
- <a class="nav-link">
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">
@@ -13,6 +13,7 @@ en:
13
13
  error: Impossible to create '%{model_name}'
14
14
  success: Operation successed.
15
15
  view:
16
+ edit_account: Edit my Account
16
17
  fill_login_and_password: "Please enter your credentials to proceed."
17
18
  administration: Administration
18
19
  home: Home
@@ -13,6 +13,7 @@ fr:
13
13
  error: Impossible de trier '%{model_name}'
14
14
  success: Opération réussi.
15
15
  view:
16
+ edit_account: Modifier mon Compte
16
17
  fill_login_and_password: "Merci d'entrer votre identifiant et mot de passe."
17
18
  administration: Administration
18
19
  home: Accueil
@@ -8,7 +8,7 @@ module SlashAdmin
8
8
  def install
9
9
  template "install.erb",
10
10
  "app/helpers/slash_admin/menu_helper.rb"
11
- template "initializer.erb",
11
+ template "initializer.rb",
12
12
  "config/initializers/slash_admin.rb"
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module SlashAdmin
2
- VERSION = "1.4"
2
+ VERSION = "1.5.3"
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.4'
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-06-18 00:00:00.000000000 Z
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.2
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.