administration-zero 0.0.14 → 0.0.15

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: a291ddd1aa06b883bcbd143aeef64c9d2d87045b12fa4f33fc048987fe67ac79
4
- data.tar.gz: ac6de3699a5db5e9f02052c70b4bbf7ea80558801a7e930df4c44fb17356124b
3
+ metadata.gz: 0ddf1c47cb20c004e23f87a749887cca995b415764ba24799692a42e9d4b13ca
4
+ data.tar.gz: 34666d42bd99a7d088fc43332171b33176b7b64ae65918104caf55d13adfa6f4
5
5
  SHA512:
6
- metadata.gz: 4dc53a371733b5a796bded1aed343f94e9db143f65393a2e2f1aca27339c57df2aca9bca84458a35534ce21be2a46cc68a51f51b0386429fe8d4d7cd7d2155ec
7
- data.tar.gz: d9a3abf79a2c4b3c5e95fa040b2ed4af7cbeb1d47ecdf99416820e3872ff7ef2c746e24dc062c81cdaf7e9e38b7fd6ac6f5eb98ed34a8bba9aadda21a00389f4
6
+ metadata.gz: 3e0bcf1bdef4df5a3febdffac660073bc5d7c53976b6af83dd1ec36901ecdc6d663abae987de089eef03ed6ffbd4e8b36a63673026a8134c2744294fbf925eb5
7
+ data.tar.gz: 8c017ac485dda3c9e57db9241aa7632078cf89b9a26b60efd1bc1d4b24430c988c84901a0562d1b65a8f1746e19539a4f992f3674507036b176eaab743d69de8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- administration-zero (0.0.14)
4
+ administration-zero (0.0.15)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AdministrationZero
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -24,7 +24,7 @@ class Admin::PasswordResetsController < Admin::BaseController
24
24
  if @user.update(user_params)
25
25
  redirect_to admin_sign_in_path, notice: "Your password was reset successfully. Please sign in"
26
26
  else
27
- render :edit, status: :unprocessable_entity
27
+ redirect_to edit_admin_password_reset_path(token: params[:token]), alert: @user.errors.first.full_message
28
28
  end
29
29
  end
30
30
 
@@ -1,47 +1,39 @@
1
1
  <!-- Tabler Core -->
2
- <script src="https://unpkg.com/@tabler/core@1.0.0-beta9/dist/js/tabler.min.js"></script>
2
+ <script src="https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta11/dist/js/tabler.min.js"></script>
3
3
 
4
- <!-- set time zone cookie -->
5
- <script>
6
- const { timeZone } = new Intl.DateTimeFormat().resolvedOptions();
7
- setCookie("time_zone", timeZone);
8
-
9
- function setCookie(name, value) {
10
- const twentyYears = 20 * 365 * 24 * 60 * 60 * 1000;
11
- const body = [ name, value ].map(encodeURIComponent).join("=");
12
- const expires = new Date(Date.now() + twentyYears).toUTCString();
13
- const cookie = `${body}; path=/; expires=${expires}`;
14
- document.cookie = cookie;
15
- }
4
+ <!-- Time zone cookie -->
5
+ <script type="module">
6
+ import cookies from "https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.mjs"
7
+ const { timeZone } = new Intl.DateTimeFormat().resolvedOptions()
8
+ cookies.set("time_zone", timeZone, { expires: 365 })
16
9
  </script>
17
10
 
18
- <!-- bring back data-confirm -->
19
- <script>
11
+ <!-- Data confirm -->
12
+ <script type="module">
20
13
  document.addEventListener("click", (event) => {
21
- if (!event.target.matches("[data-confirm]")) return;
22
- if (!window.confirm(event.target.dataset["confirm"])) event.preventDefault();
23
- });
14
+ if (!event.target.matches("[data-confirm]")) return
15
+ if (!window.confirm(event.target.dataset["confirm"])) event.preventDefault()
16
+ })
24
17
  </script>
25
18
 
26
- <!-- validation rails -->
27
- <script>
28
- document.addEventListener("DOMContentLoaded", () => {
29
- document.querySelectorAll(".field_with_errors").forEach((element) => {
30
- element.firstChild.classList.add("is-invalid");
31
-
32
- element.parentNode.insertBefore(element.firstChild, element);
33
- element.parentNode.removeChild(element);
34
- });
35
- });
36
- </script>
19
+ <!-- Stimulus controllers -->
20
+ <script type="module">
21
+ import { Application, Controller } from "https://cdn.jsdelivr.net/npm/@hotwired/stimulus@3.1.0/dist/stimulus.min.js"
22
+ const stimulus = Application.start()
37
23
 
38
- <!-- flash message -->
39
- <script>
40
- document.addEventListener("DOMContentLoaded", () => {
41
- const selector = "[data-controller='flash-message']";
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
+ })
42
33
 
43
- document.querySelectorAll(selector).forEach((thiz) => {
44
- new bootstrap.Toast(thiz).show();
45
- });
46
- });
34
+ stimulus.register("flash-message", class extends Controller {
35
+ connect() {
36
+ new bootstrap.Toast(this.element).show()
37
+ }
38
+ })
47
39
  </script>
@@ -4,9 +4,9 @@
4
4
  <span class="navbar-toggler-icon"></span>
5
5
  </button>
6
6
  <h1 class="navbar-brand navbar-brand-autodark d-none-navbar-horizontal pe-0 pe-md-3">
7
- <a href=".">
7
+ <%= link_to admin_path do %>
8
8
  <%= image_tag "admin/logo.svg", width: 110, height: 32, alt: "Tabler", class: "navbar-brand-image" %>
9
- </a>
9
+ <% end %>
10
10
  </h1>
11
11
  <div class="navbar-nav flex-row order-md-last">
12
12
  <div class="nav-item d-none d-md-flex me-3">
@@ -1,5 +1,5 @@
1
1
  <!-- Tabler Core -->
2
- <link rel="stylesheet" href="https://unpkg.com/@tabler/core@1.0.0-beta9/dist/css/tabler.min.css">
2
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta11/dist/css/tabler.min.css">
3
3
 
4
4
  <!-- Customize tabler here -->
5
5
  <style>body {
@@ -7,13 +7,11 @@
7
7
  <div class="mb-3">
8
8
  <%= form.label :password, "New password", class: "form-label" %>
9
9
  <%= form.password_field :password, required: true, autofocus: true, autocomplete: "new-password", class: "form-control" %>
10
- <%= tag.div @user.errors[:password].first, class: "invalid-feedback d-block" %>
11
10
  </div>
12
11
 
13
12
  <div>
14
13
  <%= form.label :password_confirmation, "Confirm new password", class: "form-label" %>
15
14
  <%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", class: "form-control" %>
16
- <%= tag.div @user.errors[:password_confirmation].first, class: "invalid-feedback d-block" %>
17
15
  </div>
18
16
 
19
17
  <div class="form-footer">
@@ -1,4 +1,4 @@
1
- <%= form_with(model: user) do |form| %>
1
+ <%= form_with(model: user, html: { "data-controller": "validation" }) 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">
@@ -25,6 +25,6 @@
25
25
 
26
26
  <div class="form-footer">
27
27
  <%= form.submit class: "btn btn-primary" %>
28
- <%= link_to "Cancel", admin_users_path, class: "btn btn-light" %>
28
+ <%= link_to "Cancel", admin_users_path, class: "btn btn-white" %>
29
29
  </div>
30
30
  <% end %>
@@ -4,7 +4,7 @@
4
4
  <% end %>
5
5
 
6
6
  <%= render "page_header_actions" do %>
7
- <%= link_to "Filters", "#offcanvas_filters", "data-bs-toggle": "offcanvas", class: "btn btn-light" %>
7
+ <%= link_to "Filters", "#offcanvas_filters", "data-bs-toggle": "offcanvas", class: "btn btn-white" %>
8
8
  <%= link_to "New user", new_admin_user_path, class: "btn btn-primary" %>
9
9
  <% end %>
10
10
  <% end %>
@@ -29,9 +29,9 @@
29
29
  <td><%= user.email %></td>
30
30
  <td><%= l(user.created_at, format: :long) %></td>
31
31
  <td>
32
- <%= link_to "View", user, class: "btn btn-light btn-sm" %>
33
- <%= link_to "Edit", edit_admin_user_path(user), class: "btn btn-light btn-sm" %>
34
- <%= button_to "Delete", user, method: :delete, "data-confirm": "Are you sure?", form_class: "d-inline", class: "btn btn-light btn-sm" %>
32
+ <%= link_to "View", user, class: "btn btn-white btn-sm" %>
33
+ <%= link_to "Edit", edit_admin_user_path(user), class: "btn btn-white btn-sm" %>
34
+ <%= button_to "Delete", user, method: :delete, "data-confirm": "Are you sure?", form_class: "d-inline", class: "btn btn-white btn-sm" %>
35
35
  </td>
36
36
  </tr>
37
37
  <% end %>
@@ -67,6 +67,6 @@
67
67
  </div>
68
68
 
69
69
  <%= f.submit "Filter", class: "btn btn-primary" %>
70
- <%= link_to "Clear Filter", admin_users_path, class: "btn btn-light" %>
70
+ <%= link_to "Clear Filter", admin_users_path, class: "btn btn-white" %>
71
71
  <% end %>
72
72
  </div>
@@ -6,7 +6,7 @@
6
6
 
7
7
  <%= render "page_header_actions" do %>
8
8
  <%= link_to "Edit user", edit_admin_user_path(@user), class: "btn btn-primary" %>
9
- <%= button_to "Delete user", @user, method: :delete, "data-confirm": "Are you sure?", form_class: "d-inline", class: "btn btn-light" %>
9
+ <%= button_to "Delete user", @user, method: :delete, "data-confirm": "Are you sure?", form_class: "d-inline", class: "btn btn-white" %>
10
10
  <% end %>
11
11
  <% end %>
12
12
 
@@ -1,4 +1,4 @@
1
- <%%= form_with(model: <%= model_resource_name %>) do |form| %>
1
+ <%%= form_with(model: <%= model_resource_name %>, html: { "data-controller": "validation" }) do |form| %>
2
2
  <% attributes.each do |attribute| -%>
3
3
  <div class="form-group row mb-2">
4
4
  <% if attribute.password_digest? -%>
@@ -36,6 +36,6 @@
36
36
  <% end -%>
37
37
  <div class="form-footer">
38
38
  <%%= form.submit class: "btn btn-primary" %>
39
- <%%= link_to "Cancel", <%= index_helper(type: :path) %>, class: "btn btn-light" %>
39
+ <%%= link_to "Cancel", <%= index_helper(type: :path) %>, class: "btn btn-white" %>
40
40
  </div>
41
41
  <%% end %>
@@ -4,7 +4,7 @@
4
4
  <%% end %>
5
5
 
6
6
  <%%= render "page_header_actions" do %>
7
- <%%= link_to "Filters", "#offcanvas_filters", "data-bs-toggle": "offcanvas", class: "btn btn-light" %>
7
+ <%%= link_to "Filters", "#offcanvas_filters", "data-bs-toggle": "offcanvas", class: "btn btn-white" %>
8
8
  <%%= link_to "New <%= human_name.downcase %>", <%= new_helper(type: :path) %>, class: "btn btn-primary" %>
9
9
  <%% end %>
10
10
  <%% end %>
@@ -37,9 +37,9 @@
37
37
  <% end -%>
38
38
  <% end -%>
39
39
  <td>
40
- <%%= link_to "View", <%= model_resource_name %>, class: "btn btn-light btn-sm" %>
41
- <%%= link_to "Edit", <%= edit_helper(singular_table_name, type: :path) %>, class: "btn btn-light btn-sm" %>
42
- <%%= button_to "Delete", <%= model_resource_name %>, method: :delete, "data-confirm": "Are you sure?", form_class: "d-inline", class: "btn btn-light btn-sm" %>
40
+ <%%= link_to "View", <%= model_resource_name %>, class: "btn btn-white btn-sm" %>
41
+ <%%= link_to "Edit", <%= edit_helper(singular_table_name, type: :path) %>, class: "btn btn-white btn-sm" %>
42
+ <%%= button_to "Delete", <%= model_resource_name %>, method: :delete, "data-confirm": "Are you sure?", form_class: "d-inline", class: "btn btn-white btn-sm" %>
43
43
  </td>
44
44
  </tr>
45
45
  <%% end %>
@@ -48,7 +48,7 @@
48
48
  </div>
49
49
  <div class="card-footer d-flex align-items-center fs-5">
50
50
  <div class="d-none d-md-block">
51
- <div>Download: <%%= link_to "CSV", <%= index_helper(type: :path) %>(format: :csv, q: request.params[:q]) %></div>
51
+ <div>Download: <%%= link_to "CSV", url_for(format: :csv, q: request.params[:q]) %></div>
52
52
  <%%= raw pagy_info(@pagy) %>
53
53
  </div>
54
54
  <div class="ms-auto">
@@ -69,6 +69,6 @@
69
69
  <%%# f.text_field :name_cont, class: "form-control mb-3" %>
70
70
 
71
71
  <%%= f.submit "Filter", class: "btn btn-primary" %>
72
- <%%= link_to "Clear Filter", <%= index_helper(type: :path) %>, class: "btn btn-light" %>
72
+ <%%= link_to "Clear Filter", <%= index_helper(type: :path) %>, class: "btn btn-white" %>
73
73
  <%% end %>
74
74
  </div>
@@ -6,7 +6,7 @@
6
6
 
7
7
  <%%= render "page_header_actions" do %>
8
8
  <%%= link_to "Edit <%= human_name.downcase %>", <%= edit_helper(type: :path) %>, class: "btn btn-primary" %>
9
- <%%= button_to "Delete <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete, "data-confirm": "Are you sure?", form_class: "d-inline", class: "btn btn-light" %>
9
+ <%%= button_to "Delete <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete, "data-confirm": "Are you sure?", form_class: "d-inline", class: "btn btn-white" %>
10
10
  <%% end %>
11
11
  <%% end %>
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administration-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-28 00:00:00.000000000 Z
11
+ date: 2022-08-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: