madmin 2.3.2 → 2.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62b6d17be04895373897532dcebc6ac0b3781b65a16b320f2bac5e518a9c1f1d
4
- data.tar.gz: 06b1f2babd3bb74728444e9cb5f3ee4dee02878dc6c6adafa4199078d0b43d9b
3
+ metadata.gz: 2862cda2a9f7f8cc5313b205404c21bc4bd2e3a9aa780dfe6ba708ef0db51c34
4
+ data.tar.gz: a6dd1ac4898938c31ab694c61ca9c7ac379510b3ab00cc9830d8df43d651aff5
5
5
  SHA512:
6
- metadata.gz: 3cfeb5f2835ad564f5f995ab37aad5c09ddc13441d93fca2fee1856d1eb1f9014b9966ca10a6e8982b4f0b35e36cedcc1b7f8300b6f96aeab2dfdccb14ae28dd
7
- data.tar.gz: 276d179f98a51df5ab9cc6000436fecb1e09183bec64663127698921674d42753514505341b03e156f3c1df1007314954f38bd29304b2a75bb9bd83a565c24e6
6
+ metadata.gz: 8958ec3db4a60cd9df3484a9eb864f6b273ef646ae5a631f13cc16f0d7870147998193552de77c4cef6aad57bf3d97db8bd3f18fa213304f35b430f5d60ac8c7
7
+ data.tar.gz: d0eb3ec050476cdd04beec7d6ec2cb3a5a1a10d47dbab182b19236b2d8d3a0b90bebdbda04a0e8f5f875a2b695379095a3681470178669a9bc23ccdcb1e55a22
@@ -39,7 +39,7 @@
39
39
  <% next if attribute.field.nil? %>
40
40
  <% next unless attribute.field.visible?(action_name) %>
41
41
 
42
- <th><%= sortable attribute.name, attribute.name.to_s.titleize %></th>
42
+ <th><%= sortable attribute.name, attribute.field.label %></th>
43
43
  <% end %>
44
44
  <th></th>
45
45
  </tr>
@@ -25,7 +25,7 @@
25
25
 
26
26
  <tr>
27
27
  <th class="label">
28
- <%= attribute.field.options.label || attribute.name.to_s.titleize %>
28
+ <%= attribute.field.label %>
29
29
  </th>
30
30
 
31
31
  <td>
data/lib/madmin/field.rb CHANGED
@@ -29,6 +29,10 @@ module Madmin
29
29
  attribute_name
30
30
  end
31
31
 
32
+ def label
33
+ options[:label].presence || attribute_name.to_s.titleize
34
+ end
35
+
32
36
  # Used for checking visibility of attribute on an view
33
37
  def visible?(action)
34
38
  action = action.to_sym
@@ -54,15 +54,16 @@ module Madmin
54
54
  config = ActiveSupport::OrderedOptions.new.merge(options)
55
55
  yield config if block_given?
56
56
 
57
- # Form is an alias for new & edit
58
- if config.has_key?(:form)
59
- config.new = config[:form]
60
- config.edit = config[:form]
61
- end
57
+ # Form is an alias for new & edit but shouldn't override their values if explicitly set (true/false)
58
+ config.new = config[:form] if config[:new].nil?
59
+ config.edit = config[:form] if config[:edit].nil?
62
60
 
63
61
  # New/create and edit/update need to match
64
- config.create = config[:create] if config.has_key?(:new)
65
- config.update = config[:update] if config.has_key?(:edit)
62
+ config.create = config.new
63
+ config.update = config.edit
64
+
65
+ # Remove any nil values to use the defaults
66
+ config.compact!
66
67
 
67
68
  attributes[name] = Attribute.new(
68
69
  name: name,
@@ -1,3 +1,3 @@
1
1
  module Madmin
2
- VERSION = "2.3.2"
2
+ VERSION = "2.3.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
@@ -285,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
285
  - !ruby/object:Gem::Version
286
286
  version: '0'
287
287
  requirements: []
288
- rubygems_version: 4.0.3
288
+ rubygems_version: 4.0.12
289
289
  specification_version: 4
290
290
  summary: A modern admin for Ruby on Rails apps
291
291
  test_files: []