madmin 2.0.2 → 2.0.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: 4b751bd0646e9d0cf013c394c5724e0873ba7c1d7f6e209ebb415eccb1468fa9
4
- data.tar.gz: 8e6a92c242c2a9937391e403dad3fe6d664f334cd36c5c686d611ca09fa5a02e
3
+ metadata.gz: 1e151654e85ee04e468708ebcb264633db5647e24964ea20a8b94f29850059fc
4
+ data.tar.gz: b709f0e2c7cae8461fc4ff7fc7470fc720b7c84bd4eecea9b647e61c2a647d21
5
5
  SHA512:
6
- metadata.gz: b6c32d6e92da3f973086c18edf4b9f2d870d3391a32748587e6097ce34973b1416e532da904bc452cd943aa5f6438493b62ae6627d375a6d7fcfa51f4998fdb4
7
- data.tar.gz: 30d59f92c948e6bc6621accbd17ec4d0ae8701a349c4561ba3a9072010a655c0e1db9edfca785fa1cfdc2ffb5f8356ed8fe0e7b31c10a24aca176fec7c61a5b5
6
+ metadata.gz: 3b8de42f8febe633ac7398b4e69be0acca9c20cd0b1ea1025079a81508b233c75e2ec3aa14969acf6685fdbef6ff7d9461818b753734731c97549e3f8973410c
7
+ data.tar.gz: ec7843b7ec7e89a521d39150bdde71b9359369b2de988711aa50b75399a70252947516e15387dced3f0161ecb04d0ca4094b0914f7a836e3f13197ae9fefdbd7
data/README.md CHANGED
@@ -103,9 +103,9 @@ The `attribute` method in model_resource.rb gives you that flexibility.
103
103
  ```
104
104
 
105
105
  ```ruby
106
- class UserResource < Madmin::Resource
106
+ class BookResource < Madmin::Resource
107
107
  attribute :id, form: false
108
- attribute :tile
108
+ attribute :title
109
109
  attribute :subtitle, index: false
110
110
  attribute :author
111
111
  attribute :genre
@@ -120,6 +120,18 @@ rails generate madmin:views:index Book
120
120
  # -> app/views/madmin/books/index.html.erb
121
121
  ```
122
122
 
123
+ ### Specifying Field Types
124
+
125
+ You can set a field type as the second argument. Field types may have additional options to render the field UI.
126
+
127
+
128
+ For example, we can use a select for the genre attribute and specify the collection of options to choose from.
129
+
130
+ ```ruby
131
+ class BookResource < Madmin::Resource
132
+ attribute :genre, :select, collection: ["Fiction", "Mystery", "Thriller"]
133
+ end
134
+
123
135
  ## Custom Fields
124
136
 
125
137
  You can generate a custom field with:
@@ -45,10 +45,8 @@ module Madmin
45
45
 
46
46
  if field.nil?
47
47
  Rails.logger.warn <<~MESSAGE
48
- WARNING: Madmin could not infer a field type for `#{name}` attribute. Defaulting to a String type.
49
- You can set the type by specifying the type on the attribute:
50
-
51
- attribute :#{name}, :boolean
48
+ WARNING: Madmin could not infer a field type for `#{name}` attribute in `#{self.name}`. Defaulting to a String type.
49
+ #{caller.find { _1.start_with? Rails.root.to_s }}
52
50
  MESSAGE
53
51
  field = Fields::String
54
52
  end
@@ -1,3 +1,3 @@
1
1
  module Madmin
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  - Andrea Fomera
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-06 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  - !ruby/object:Gem::Version
256
256
  version: '0'
257
257
  requirements: []
258
- rubygems_version: 3.6.6
258
+ rubygems_version: 3.6.9
259
259
  specification_version: 4
260
260
  summary: A modern admin for Ruby on Rails apps
261
261
  test_files: []