administration-zero 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ddf1c47cb20c004e23f87a749887cca995b415764ba24799692a42e9d4b13ca
4
- data.tar.gz: 34666d42bd99a7d088fc43332171b33176b7b64ae65918104caf55d13adfa6f4
3
+ metadata.gz: 35de235f43706677cf27a687d0e9dbc5fbf62635403699c96285f9d2e8687072
4
+ data.tar.gz: 2cffd303bf0f842d2ac57d99d2ae35103ca82469965a42b92873eeafc569c819
5
5
  SHA512:
6
- metadata.gz: 3e0bcf1bdef4df5a3febdffac660073bc5d7c53976b6af83dd1ec36901ecdc6d663abae987de089eef03ed6ffbd4e8b36a63673026a8134c2744294fbf925eb5
7
- data.tar.gz: 8c017ac485dda3c9e57db9241aa7632078cf89b9a26b60efd1bc1d4b24430c988c84901a0562d1b65a8f1746e19539a4f992f3674507036b176eaab743d69de8
6
+ metadata.gz: 913688370fbda475f6ece5d7c3ef2024d87375d6cde185680239d6cb8b00550300c7bef224ba6f14bed115e061743d101b2e88cc4a535fa023d335ba81a2f607
7
+ data.tar.gz: 150ab9a4248f342ab9c407dcaf10f95892f554c4dee99867e442eddae01f138d2d749bdd985a207fc6f66812dbc891e7d7e482f68393fb1acf8cbf06ac4263e4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- administration-zero (0.0.15)
4
+ administration-zero (0.0.16)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
@@ -1,3 +1,3 @@
1
1
  module AdministrationZero
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -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: user, html: { "data-controller": "validation" }) do |form| %>
1
+ <%= form_with(model: user) do |form| %>
2
2
  <div class="form-group row mb-2">
3
3
  <%= form.label :email, class: "form-label col-md-3 col-form-label" %>
4
4
  <div class="col-md px-0">
@@ -1,4 +1,4 @@
1
- <%%= form_with(model: <%= model_resource_name %>, html: { "data-controller": "validation" }) do |form| %>
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? -%>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administration-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon