madmin 2.3.1 → 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: a1057d4a94a2fe018140855f9f53eadef48dc9c74f64465e886e05ea36e95ba4
4
- data.tar.gz: f67554da6c25a3f04a011375144dfd8b6ef4fc1e7dfd36fe0a724c97cbe7f568
3
+ metadata.gz: 2862cda2a9f7f8cc5313b205404c21bc4bd2e3a9aa780dfe6ba708ef0db51c34
4
+ data.tar.gz: a6dd1ac4898938c31ab694c61ca9c7ac379510b3ab00cc9830d8df43d651aff5
5
5
  SHA512:
6
- metadata.gz: 215a864a11540a1e532e47159ad04c286e04163e86d9ba240ec19f0c13dc1d604d3af153a2dc39abbf8e6449cf40ca020f987f0d76fbd92b1ef97211e8cb62db
7
- data.tar.gz: 8e54f95302d99d7d52a7ff37eecc5e01f8d8d90ce60d8c0925ef0cf7503df530d1b6e47b89eb067e7c4d34ee4e7aaee78cd764502c5c0c1e5f26c92004fd66b0
6
+ metadata.gz: 8958ec3db4a60cd9df3484a9eb864f6b273ef646ae5a631f13cc16f0d7870147998193552de77c4cef6aad57bf3d97db8bd3f18fa213304f35b430f5d60ac8c7
7
+ data.tar.gz: d0eb3ec050476cdd04beec7d6ec2cb3a5a1a10d47dbab182b19236b2d8d3a0b90bebdbda04a0e8f5f875a2b695379095a3681470178669a9bc23ccdcb1e55a22
data/README.md CHANGED
@@ -131,6 +131,7 @@ For example, we can use a select for the genre attribute and specify the collect
131
131
  class BookResource < Madmin::Resource
132
132
  attribute :genre, :select, collection: ["Fiction", "Mystery", "Thriller"]
133
133
  end
134
+ ```
134
135
 
135
136
  ## Custom Fields
136
137
 
@@ -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,
@@ -84,7 +85,7 @@ module Madmin
84
85
  namespace = model.module_parents.detect do |n|
85
86
  n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming?
86
87
  end
87
- @route_namespace = (namespace ? namespace.name.singularize.underscore.to_sym : nil)
88
+ @route_namespace = (namespace ? namespace.name.underscore.to_sym : nil)
88
89
  end
89
90
 
90
91
  def index_path(options = {})
@@ -1,3 +1,3 @@
1
1
  module Madmin
2
- VERSION = "2.3.1"
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.1
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.2
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: []