madmin 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/app/views/layouts/madmin/application.html.erb +1 -3
- data/app/views/madmin/application/_javascript.html.erb +31 -15
- data/app/views/madmin/application/index.html.erb +1 -1
- data/app/views/madmin/application/show.html.erb +1 -1
- data/app/views/madmin/pagy/_nav.html.erb +20 -0
- data/lib/madmin/fields/nested_has_many.rb +1 -1
- data/lib/madmin/resource.rb +1 -0
- data/lib/madmin/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cd4e0b3d14780dd13db0a21a57a63e750a750298ea78cc93ec5eb327b1714e7
|
4
|
+
data.tar.gz: 92f273ea140b603a887660b36802de9e6c0021a56cbeeb49cef5318696ae7bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 677c4da0f37a96e2515584a02e6d0c941d59fae91b43a15e19386a723d1bdeb6a4e47db8bdc987c59e59c1b75ae2f507d055603a8a996dc5c45b3731d95aac13
|
7
|
+
data.tar.gz: b06f7fa04b747a761f956fccaa81e9f4535757db2276427e0cbda7a63d901295c9e275faf22a9753459290d530808f6b118806813e7858aeada501b3cb220cbf
|
data/README.md
CHANGED
@@ -73,6 +73,23 @@ rails g madmin:views:index
|
|
73
73
|
# -> app/views/madmin/application/index.html.erb
|
74
74
|
```
|
75
75
|
|
76
|
+
You might want to make some of your model's attributes visible in some views but invisible in others.
|
77
|
+
The `attribute` method in model_resource.rb gives you that flexibility.
|
78
|
+
|
79
|
+
```bash
|
80
|
+
# -> app/madmin/resources/book_resource.rb
|
81
|
+
```
|
82
|
+
```ruby
|
83
|
+
class UserResource < Madmin::Resource
|
84
|
+
attribute :id, form: false
|
85
|
+
attribute :tile
|
86
|
+
attribute :subtitle, index: false
|
87
|
+
attribute :author
|
88
|
+
attribute :genre
|
89
|
+
attribute :pages, show: false
|
90
|
+
end
|
91
|
+
```
|
92
|
+
|
76
93
|
You can also scope the copied view(s) to a specific Resource/Model:
|
77
94
|
```bash
|
78
95
|
rails generate madmin:views:index Book
|
@@ -7,9 +7,7 @@
|
|
7
7
|
<title>
|
8
8
|
Madmin: <%= Rails.application.class %>
|
9
9
|
</title>
|
10
|
-
|
11
|
-
<link href="https://unpkg.com/tailwindcss@^2.0/dist/tailwind.min.css" rel="stylesheet" />
|
12
|
-
<link href="https://unpkg.com/@tailwindcss/typography/dist/typography.min.css" rel="stylesheet" />
|
10
|
+
|
13
11
|
<%= csrf_meta_tags %>
|
14
12
|
|
15
13
|
<%= render "javascript" %>
|
@@ -1,28 +1,44 @@
|
|
1
|
+
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>
|
1
2
|
<%= stylesheet_link_tag "https://unpkg.com/flatpickr/dist/flatpickr.min.css", "data-turbo-track": "reload" %>
|
2
3
|
<%= stylesheet_link_tag "https://unpkg.com/trix/dist/trix.css", "data-turbo-track": "reload" %>
|
3
4
|
<%= stylesheet_link_tag "https://unpkg.com/tom-select/dist/css/tom-select.min.css", "data-turbo-track": "reload" %>
|
4
5
|
|
5
|
-
<script type="
|
6
|
-
|
7
|
-
|
6
|
+
<script type="importmap" data-turbo-track="reload">
|
7
|
+
{
|
8
|
+
"imports": {
|
9
|
+
"@hotwired/stimulus": "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js",
|
10
|
+
"@hotwired/turbo": "https://unpkg.com/@hotwired/turbo",
|
11
|
+
"@hotwired/turbo-rails": "https://unpkg.com/@hotwired/turbo-rails",
|
12
|
+
"@rails/actiontext": "https://unpkg.com/@rails/actiontext@<%= npm_rails_version %>/app/assets/javascripts/actiontext.js",
|
13
|
+
"@rails/activestorage": "https://unpkg.com/@rails/activestorage@<%= npm_rails_version %>/app/assets/javascripts/activestorage.esm.js",
|
14
|
+
"flatpickr": "https://unpkg.com/flatpickr/dist/esm/index.js",
|
15
|
+
"stimulus-flatpickr": "https://unpkg.com/stimulus-flatpickr@3.0.0-0/dist/index.m.js",
|
16
|
+
"tailwindcss-stimulus-components": "https://unpkg.com/tailwindcss-stimulus-components/dist/tailwindcss-stimulus-components.modern.js",
|
17
|
+
"tom-select": "https://unpkg.com/tom-select/dist/esm/tom-select.complete.js",
|
18
|
+
"trix": "https://unpkg.com/trix"
|
19
|
+
}
|
20
|
+
}
|
21
|
+
</script>
|
22
|
+
<script async src="https://unpkg.com/es-module-shims/dist/es-module-shims.js"></script>
|
8
23
|
|
9
|
-
|
10
|
-
|
24
|
+
<script type="module">
|
25
|
+
import * as Turbo from "@hotwired/turbo-rails"
|
11
26
|
|
12
|
-
import
|
13
|
-
|
27
|
+
import * as ActiveStorage from "@rails/activestorage"
|
28
|
+
ActiveStorage.start()
|
29
|
+
import "trix"
|
30
|
+
import "@rails/actiontext"
|
14
31
|
|
15
|
-
import
|
32
|
+
import { Application, Controller } from '@hotwired/stimulus'
|
33
|
+
const application = Application.start()
|
16
34
|
|
17
|
-
import
|
18
|
-
|
19
|
-
import 'https://cdn.skypack.dev/trix'
|
20
|
-
import 'https://cdn.skypack.dev/@rails/actiontext@<%= npm_rails_version %>'
|
35
|
+
import { Dropdown } from "tailwindcss-stimulus-components"
|
36
|
+
application.register("dropdown", Dropdown)
|
21
37
|
|
22
|
-
|
23
|
-
|
38
|
+
import StimulusFlatpickr from "stimulus-flatpickr"
|
39
|
+
application.register("flatpickr", StimulusFlatpickr)
|
24
40
|
|
25
|
-
import
|
41
|
+
import TomSelect from "tom-select"
|
26
42
|
|
27
43
|
(() => {
|
28
44
|
application.register('select', class extends Controller {
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<div class="mr-2">
|
10
10
|
<%= link_to "Edit", resource.edit_path(@record), class: "block bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 px-4 border border-gray-400 rounded shadow" %>
|
11
11
|
</div>
|
12
|
-
<%= button_to "Delete", resource.show_path(@record), method: :delete, data: {
|
12
|
+
<%= button_to "Delete", resource.show_path(@record), method: :delete, data: { turbo_confirm: "Are you sure?" }, class: "bg-white hover:bg-gray-100 text-red-500 font-semibold py-2 px-4 border border-red-500 rounded shadow pointer-cursor" %>
|
13
13
|
</div>
|
14
14
|
</div>
|
15
15
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%#
|
2
|
+
This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
|
3
|
+
calls with the actual strings ("‹ Prev", "Next ›", "…").
|
4
|
+
The link variable is set to a proc that returns the link tag.
|
5
|
+
Usage: link.call( page_number [, text [, extra_attributes_string ]])
|
6
|
+
-%>
|
7
|
+
<% link = pagy_link_proc(pagy) -%>
|
8
|
+
<%# -%><nav aria-label="pager" class="space-x-1 px-2 py-1" role="navigation">
|
9
|
+
<% if pagy.prev -%> <span><%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous" class="text-white bg-indigo-500 rounded-2xl px-3 py-1.5"') %></span>
|
10
|
+
<% else -%> <span class="text-gray-400 bg-gray-100 rounded-2xl px-3 py-1.5 cursor-not-allowed"><%== pagy_t('pagy.nav.prev') %></span>
|
11
|
+
<% end -%>
|
12
|
+
<% pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] -%>
|
13
|
+
<% if item.is_a?(Integer) -%> <span><%== link.call(item, item, 'class="text-gray-400 rounded-full px-2.5 py-1.5 hover:bg-indigo-200 hover:text-indigo-500"') %></span>
|
14
|
+
<% elsif item.is_a?(String) -%> <span class="text-indigo-500 font-semibold px-2.5 py-1.5"><%= item %></span>
|
15
|
+
<% elsif item == :gap -%> <span class="text-gray-400 text-xl px-1.5 py-1.5"><%== pagy_t('pagy.nav.gap') %></span>
|
16
|
+
<% end -%>
|
17
|
+
<% end -%>
|
18
|
+
<% if pagy.next -%> <span><%== link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next" class="text-white bg-indigo-500 rounded-2xl px-3 py-1.5"') %></span>
|
19
|
+
<% else -%> <span class="text-gray-400 bg-gray-100 rounded-2xl px-3 py-1.5 cursor-not-allowed"><%== pagy_t('pagy.nav.next') %></span>
|
20
|
+
<% end -%>
|
data/lib/madmin/resource.rb
CHANGED
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.2.
|
4
|
+
version: 1.2.7
|
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:
|
12
|
+
date: 2022-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- app/views/madmin/fields/time/_form.html.erb
|
140
140
|
- app/views/madmin/fields/time/_index.html.erb
|
141
141
|
- app/views/madmin/fields/time/_show.html.erb
|
142
|
+
- app/views/madmin/pagy/_nav.html.erb
|
142
143
|
- app/views/madmin/shared/_label.html.erb
|
143
144
|
- lib/generators/madmin/field/field_generator.rb
|
144
145
|
- lib/generators/madmin/field/templates/_form.html.erb
|
@@ -211,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
212
|
- !ruby/object:Gem::Version
|
212
213
|
version: '0'
|
213
214
|
requirements: []
|
214
|
-
rubygems_version: 3.
|
215
|
+
rubygems_version: 3.3.7
|
215
216
|
signing_key:
|
216
217
|
specification_version: 4
|
217
218
|
summary: A modern admin for Ruby on Rails apps
|