administration-zero 0.0.15 → 0.0.16
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/administration_zero/version.rb +1 -1
- data/lib/generators/admin/install/install_generator.rb +11 -0
- data/lib/generators/admin/install/templates/erb/admin/base/_flash_messages.html.erb +1 -1
- data/lib/generators/admin/install/templates/erb/admin/base/_javascript_tags.html.erb +0 -10
- data/lib/generators/admin/install/templates/erb/admin/users/_form.html.erb +1 -1
- data/lib/generators/admin/scaffold/templates/erb/_form.html.erb.tt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35de235f43706677cf27a687d0e9dbc5fbf62635403699c96285f9d2e8687072
|
|
4
|
+
data.tar.gz: 2cffd303bf0f842d2ac57d99d2ae35103ca82469965a42b92873eeafc569c819
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 913688370fbda475f6ece5d7c3ef2024d87375d6cde185680239d6cb8b00550300c7bef224ba6f14bed115e061743d101b2e88cc4a535fa023d335ba81a2f607
|
|
7
|
+
data.tar.gz: 150ab9a4248f342ab9c407dcaf10f95892f554c4dee99867e442eddae01f138d2d749bdd985a207fc6f66812dbc891e7d7e482f68393fb1acf8cbf06ac4263e4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -11,6 +11,7 @@ The purpose of administration zero is to generate a pre-built administration pan
|
|
|
11
11
|
- [Sortable and filterable](https://github.com/activerecord-hackery/ransack)
|
|
12
12
|
- [Exportable data](https://github.com/westonganger/spreadsheet_architect)
|
|
13
13
|
- [Toastr for flash messages](https://getbootstrap.com/docs/5.1/components/toasts)
|
|
14
|
+
- Show fields with errors in red
|
|
14
15
|
- Determine time zone automatically
|
|
15
16
|
- Easy authentication system
|
|
16
17
|
- Admin scaffolds
|
|
@@ -7,6 +7,17 @@ module Admin
|
|
|
7
7
|
|
|
8
8
|
source_root File.expand_path("templates", __dir__)
|
|
9
9
|
|
|
10
|
+
def add_field_error_proc
|
|
11
|
+
field_error_proc_code = <<~RUBY
|
|
12
|
+
# Provides an HTML generator for displaying errors that come from Active Model
|
|
13
|
+
config.action_view.field_error_proc = Proc.new do |html_tag, instance|
|
|
14
|
+
raw Nokogiri::HTML.fragment(html_tag).child.add_class("is-invalid")
|
|
15
|
+
end
|
|
16
|
+
RUBY
|
|
17
|
+
|
|
18
|
+
environment field_error_proc_code
|
|
19
|
+
end
|
|
20
|
+
|
|
10
21
|
def add_gems
|
|
11
22
|
uncomment_lines "Gemfile", /"bcrypt"/
|
|
12
23
|
gem "pagy", comment: "Use Pagy to add paginated results [https://github.com/ddnexus/pagy]"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% message = notice || alert %>
|
|
2
2
|
|
|
3
|
-
<% if message %>
|
|
3
|
+
<% if message.present? %>
|
|
4
4
|
<div class="position-fixed start-50 translate-middle-x" style="z-index: 1030; top: 8rem;">
|
|
5
5
|
<div class="toast hide text-center text-white bg-dark border-0" data-controller="flash-message">
|
|
6
6
|
<div class="toast-body">
|
|
@@ -21,16 +21,6 @@
|
|
|
21
21
|
import { Application, Controller } from "https://cdn.jsdelivr.net/npm/@hotwired/stimulus@3.1.0/dist/stimulus.min.js"
|
|
22
22
|
const stimulus = Application.start()
|
|
23
23
|
|
|
24
|
-
stimulus.register("validation", class extends Controller {
|
|
25
|
-
connect() {
|
|
26
|
-
this.element.querySelectorAll(".field_with_errors").forEach((element) => {
|
|
27
|
-
element.firstChild.classList.add("is-invalid")
|
|
28
|
-
element.parentNode.insertBefore(element.firstChild, element)
|
|
29
|
-
element.parentNode.removeChild(element)
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
|
|
34
24
|
stimulus.register("flash-message", class extends Controller {
|
|
35
25
|
connect() {
|
|
36
26
|
new bootstrap.Toast(this.element).show()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%%= form_with(model: <%= model_resource_name
|
|
1
|
+
<%%= form_with(model: <%= model_resource_name %>) do |form| %>
|
|
2
2
|
<% attributes.each do |attribute| -%>
|
|
3
3
|
<div class="form-group row mb-2">
|
|
4
4
|
<% if attribute.password_digest? -%>
|