madmin 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/app/views/madmin/fields/belongs_to/_index.html.erb +3 -2
- data/app/views/madmin/fields/belongs_to/_show.html.erb +3 -2
- data/app/views/madmin/fields/enum/_form.html.erb +1 -2
- data/lib/madmin/fields/enum.rb +3 -0
- data/lib/madmin/resource.rb +6 -1
- data/lib/madmin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f149452559626564a6b3888b89ddeaf7fb2bf1c3fedbbc4ac4ba3dc2a1df4e58
|
4
|
+
data.tar.gz: 8536e397b8d032d704b7e10c938af1ee1eda4911d9c6933ecd9c11f68fbac8f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6a4a123086ee55711728e9f2b1bff5ca90d28c7238690d5f51e9b834f1f5eb15170b7e8e3b1aac7a79e08d4b55ee2500dc11f16d4f62c4a31cc4d0d5ab0b6ba
|
7
|
+
data.tar.gz: 49a20396c04c22fbe8001d53ed4cc567b441171943a090cd888b98e94cbf11b31ad5ec89fc67dd9cae98af03282adf8bdacec159075c73605ac743c994338e51
|
data/README.md
CHANGED
@@ -48,6 +48,22 @@ For example, running the following will copy over all of the views into your app
|
|
48
48
|
rails generate madmin:views
|
49
49
|
```
|
50
50
|
|
51
|
+
The view files that are copied over in this case includes all of the standard Rails action views (index, new, edit, show, and _form), as well as:
|
52
|
+
* `application.html.erb` (layout file)
|
53
|
+
* `_javascript.html.erb` (default JavaScript setup)
|
54
|
+
* `_navigation.html.erb` (renders the navigation/sidebar menu)
|
55
|
+
|
56
|
+
As with the other views, you can specifically run the views generator for only the navigation or application layout views:
|
57
|
+
```bash
|
58
|
+
rails g madmin:views:navigation
|
59
|
+
# -> app/views/madmin/_navigation.html.erb
|
60
|
+
|
61
|
+
rails g madmin:views:layout # Note the layout generator includes the layout, javascript, and navigation files.
|
62
|
+
# -> app/views/madmin/application.html.erb
|
63
|
+
# -> app/views/madmin/_javascript.html.erb
|
64
|
+
# -> app/views/madmin/_navigation.html.erb
|
65
|
+
```
|
66
|
+
|
51
67
|
If you only need to customize specific views, you can restrict which views are copied by the generator:
|
52
68
|
```bash
|
53
69
|
rails g madmin:views:index
|
@@ -60,6 +76,11 @@ rails generate madmin:views:index Book
|
|
60
76
|
# -> app/views/madmin/books/index.html.erb
|
61
77
|
```
|
62
78
|
|
79
|
+
## Authentication
|
80
|
+
|
81
|
+
You can use a couple of strategies to authenticate users who are trying to
|
82
|
+
access your madmin panel: [Authentication Docs](docs/authentication.md)
|
83
|
+
|
63
84
|
## 🙏 Contributing
|
64
85
|
|
65
86
|
This project uses Standard for formatting Ruby code. Please make sure to run standardrb before submitting pull requests.
|
@@ -1,2 +1,3 @@
|
|
1
|
-
<% object = field.value(record) %>
|
2
|
-
<%= link_to Madmin.resource_for(object).display_name(object), Madmin.resource_for(object).show_path(object) %>
|
1
|
+
<% if (object = field.value(record)) %>
|
2
|
+
<%= link_to Madmin.resource_for(object).display_name(object), Madmin.resource_for(object).show_path(object) %>
|
3
|
+
<% end %>
|
@@ -1,2 +1,3 @@
|
|
1
|
-
<% object = field.value(record) %>
|
2
|
-
<%= link_to Madmin.resource_for(object).display_name(object), Madmin.resource_for(object).show_path(object) %>
|
1
|
+
<% if (object = field.value(record)) %>
|
2
|
+
<%= link_to Madmin.resource_for(object).display_name(object), Madmin.resource_for(object).show_path(object) %>
|
3
|
+
<% end %>
|
data/lib/madmin/fields/enum.rb
CHANGED
data/lib/madmin/resource.rb
CHANGED
@@ -143,7 +143,12 @@ module Madmin
|
|
143
143
|
name_string = name.to_s
|
144
144
|
|
145
145
|
if model.attribute_types.include?(name_string)
|
146
|
-
model.attribute_types[name_string]
|
146
|
+
column_type = model.attribute_types[name_string]
|
147
|
+
if column_type.is_a? ActiveRecord::Enum::EnumType
|
148
|
+
:enum
|
149
|
+
else
|
150
|
+
column_type.type || :string
|
151
|
+
end
|
147
152
|
elsif (association = model.reflect_on_association(name))
|
148
153
|
type_for_association(association)
|
149
154
|
elsif model.reflect_on_association(:"rich_text_#{name_string}")
|
data/lib/madmin/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|