administration-zero 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/.documentation/screenshot.png +0 -0
  3. data/Gemfile.lock +1 -1
  4. data/lib/administration_zero/version.rb +1 -1
  5. data/lib/generators/admin/install/templates/erb/admin/application/_flash_messages.html.erb +12 -4
  6. data/lib/generators/admin/install/templates/erb/admin/application/_footer.html.erb +1 -1
  7. data/lib/generators/admin/install/templates/erb/admin/application/_javascript_tags.html.erb +7 -16
  8. data/lib/generators/admin/install/templates/erb/admin/application/_page_header.html.erb +1 -2
  9. data/lib/generators/admin/install/templates/erb/admin/application/_primary_navbar.html.erb +1 -1
  10. data/lib/generators/admin/install/templates/erb/admin/application/_secondary_navbar.html.erb +1 -1
  11. data/lib/generators/admin/install/templates/erb/admin/home/index.html.erb +1 -1
  12. data/lib/generators/admin/install/templates/erb/admin/users/edit.html.erb +1 -1
  13. data/lib/generators/admin/install/templates/erb/admin/users/index.html.erb +53 -58
  14. data/lib/generators/admin/install/templates/erb/admin/users/new.html.erb +1 -1
  15. data/lib/generators/admin/install/templates/erb/admin/users/show.html.erb +1 -1
  16. data/lib/generators/admin/install/templates/erb/layouts/admin/application.html.erb +1 -0
  17. data/lib/generators/admin/install/templates/erb/layouts/admin/authentication.html.erb +1 -3
  18. data/lib/generators/admin/scaffold/templates/erb/edit.html.erb.tt +1 -1
  19. data/lib/generators/admin/scaffold/templates/erb/index.html.erb.tt +48 -53
  20. data/lib/generators/admin/scaffold/templates/erb/new.html.erb.tt +1 -1
  21. data/lib/generators/admin/scaffold/templates/erb/show.html.erb.tt +1 -1
  22. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1604afbfe74a26d3037884f0d8789441416d05674d583cf9ce243a4fbad7e14e
4
- data.tar.gz: a2795cd1940221cf938e4f9ec2a2a9b612470d7abe79d8c4e0ecc3551d80420e
3
+ metadata.gz: 5aa731f98bd95da0a453681a5eea61541db6265488bed953764f558df6aa0e11
4
+ data.tar.gz: 8c7ca12710788cd5916d86fd70f2dd868825e82fc38ca451b794cd82203611c7
5
5
  SHA512:
6
- metadata.gz: b21b7719345ad9c1dd182c4f3cbd54e7a9b36db9b2c49bd7726e2cd38213c84a44838495aee6780c1eeb7bda42ad12fd977687134ccae94556f3db60a2f03f5e
7
- data.tar.gz: 31c2634833070929fe6674cb9c69f9488a8d5e5ba2f1cbdd2a3d4abac77514040e284321a9d143a9c3595961299392f510cdd5d14c42466621091a1b5ff7731e
6
+ metadata.gz: 86c34f86a87f38bc83ddf4900e81cf87c811b6736176799a7cc18198de257c2705a0e5a3ddedd394c85cd8f731e8bd0e9d0315549d59fb46ce159c47c566a8a9
7
+ data.tar.gz: f32f2ac7bf7e2042969226eeae8d35956b161bb39f79f0b1b9a2611b59e33a40a7ca661ffe1332833972ec9c80c5b6041189d456ef255d7f0c43631f26e50703
Binary file
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- administration-zero (0.0.6)
4
+ administration-zero (0.0.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AdministrationZero
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -1,11 +1,19 @@
1
1
  <% if flash[:notice] %>
2
- <div class="alert alert-success mb-0 mt-3" role="alert">
3
- <div class="text-muted"><%= flash[:notice] %></div>
2
+ <div class="position-fixed start-50 translate-middle-x" style="z-index: 1030; top: 8rem;">
3
+ <div class="toast hide text-center text-white bg-success border-0" data-controller="flash-message">
4
+ <div class="toast-body">
5
+ <%= flash[:notice] %>
6
+ </div>
7
+ </div>
4
8
  </div>
5
9
  <% end %>
6
10
 
7
11
  <% if flash[:alert] %>
8
- <div class="alert alert-danger mb-0 mt-3" role="alert">
9
- <div class="text-muted"><%= flash[:alert] %></div>
12
+ <div class="position-fixed start-50 translate-middle-x" style="z-index: 1030; top: 8rem;">
13
+ <div class="toast hide text-center text-white bg-danger border-0" data-controller="flash-message">
14
+ <div class="toast-body">
15
+ <%= flash[:alert] %>
16
+ </div>
17
+ </div>
10
18
  </div>
11
19
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <footer class="footer footer-transparent d-print-none">
2
- <div class="container-fluid">
2
+ <div class="container-xl">
3
3
  <div class="row text-center align-items-center flex-row-reverse">
4
4
  <div class="col-lg-auto ms-lg-auto">
5
5
  <ul class="list-inline list-inline-dots mb-0">
@@ -21,22 +21,13 @@
21
21
  });
22
22
  </script>
23
23
 
24
- <!--
25
- ###########################################################################################################################
26
- Old school stimulus example
27
- <div data-controller="toasts" data-toats-type="notice" data-toasts-message="User created successfully"></div>
28
- ###########################################################################################################################
29
- -->
30
- <!--
24
+ <!-- flash message -->
31
25
  <script>
32
26
  document.addEventListener("DOMContentLoaded", () => {
33
- document.querySelectorAll("[data-controller='toasts']").forEach((thiz) => {
34
- if (thiz.dataset["toastsType"] === "notice") {
35
- $(document).Toasts("create", { body: thiz.dataset["toastsMessage"], class: "bg-success", title: "Success", autohide: true, delay: 7000 })
36
- } else (thiz.dataset["toastsType"] === "alert") {
37
- $(document).Toasts("create", { body: thiz.dataset["toastsMessage"], class: "bg-danger", title: "Error", autohide: true, delay: 7000 })
38
- }
39
- })
40
- })
27
+ const selector = "[data-controller='flash-message']";
28
+
29
+ document.querySelectorAll(selector).forEach((thiz) => {
30
+ new bootstrap.Toast(thiz).show();
31
+ });
32
+ });
41
33
  </script>
42
- -->
@@ -1,8 +1,7 @@
1
- <div class="container-fluid">
1
+ <div class="container-xl">
2
2
  <div class="page-header">
3
3
  <div class="row align-items-center">
4
4
  <%= yield %>
5
5
  </div>
6
6
  </div>
7
- <%= render "flash_messages" %>
8
7
  </div>
@@ -1,5 +1,5 @@
1
1
  <header class="navbar navbar-expand-md navbar-light d-print-none">
2
- <div class="container-fluid">
2
+ <div class="container-xl">
3
3
  <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu">
4
4
  <span class="navbar-toggler-icon"></span>
5
5
  </button>
@@ -1,7 +1,7 @@
1
1
  <div class="navbar-expand-md">
2
2
  <div class="collapse navbar-collapse" id="navbar-menu">
3
3
  <div class="navbar navbar-light">
4
- <div class="container-fluid">
4
+ <div class="container-xl">
5
5
  <ul class="navbar-nav">
6
6
  <li class="nav-item <%= active_nav_item 'admin/home' %>">
7
7
  <%= link_to admin_path, class: "nav-link" do %>
@@ -1,7 +1,7 @@
1
1
  <%= content_for :title, "Dashboard" %>
2
2
 
3
3
  <div class="page-body">
4
- <div class="container-fluid">
4
+ <div class="container-xl">
5
5
  <h1>Admin::Home#index</h1>
6
6
  <p>Find me in app/views/admin/home/index.html.erb</p>
7
7
  </div>
@@ -7,7 +7,7 @@
7
7
  <% end %>
8
8
 
9
9
  <div class="page-body">
10
- <div class="container-fluid">
10
+ <div class="container-xl">
11
11
  <div class="card">
12
12
  <div class="card-body">
13
13
  <%= render "form", admin_user: @admin_user %>
@@ -4,72 +4,67 @@
4
4
  <% end %>
5
5
 
6
6
  <%= render "page_header_actions" do %>
7
+ <%= link_to "Filters", "#offcanvasFilters", "data-bs-toggle": "offcanvas", class: "btn btn-light" %>
7
8
  <%= link_to "New admin user", new_admin_user_path, class: "btn btn-primary" %>
8
9
  <% end %>
9
10
  <% end %>
10
11
 
11
12
  <div class="page-body">
12
- <div class="container-fluid">
13
- <div class="row gy-3">
14
- <div class="col-md-4 col-lg-3">
15
- <div class="card">
16
- <div class="card-header">
17
- <h3 class="card-title">Filters</h3>
18
- </div>
19
- <%= search_form_for @search, class: "card-body" do |f| %>
20
- <%= f.label :email_cont, class: "form-label" %>
21
- <%= f.text_field :email_cont, class: "form-control mb-3" %>
22
-
23
- <%= f.label :created_at, class: "form-label" %>
24
- <div class="d-flex gap-1 mb-3">
25
- <%= f.date_field :created_at_gteq, class: "form-control" %>
26
- <%= f.date_field :created_at_lteq, class: "form-control" %>
27
- </div>
28
-
29
- <%= f.submit "Filter", class: "btn btn-primary" %>
30
- <%= link_to "Clear Filter", admin_users_path, class: "btn btn-light" %>
31
- <% end %>
32
- </div>
13
+ <div class="container-xl">
14
+ <div class="card">
15
+ <div class="table-responsive">
16
+ <table class="table table-vcenter table-nowrap card-table table-striped">
17
+ <thead>
18
+ <tr>
19
+ <th><%= sort_link @search, :id %></th>
20
+ <th><%= sort_link @search, :email %></th>
21
+ <th><%= sort_link @search, :created_at %></th>
22
+ <th></th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <% @admin_users.each do |admin_user| %>
27
+ <tr>
28
+ <td><%= link_to admin_user.id, admin_user %></td>
29
+ <td><%= admin_user.email %></td>
30
+ <td><%= l(admin_user.created_at, format: :long) %></td>
31
+ <td>
32
+ <%= link_to "View", admin_user, class: "btn btn-light btn-sm" %>
33
+ <%= link_to "Edit", edit_admin_user_path(admin_user), class: "btn btn-light btn-sm" %>
34
+ <%= button_to "Delete", admin_user, method: :delete, data: { confirm: "Are you sure ?" }, form_class: "d-inline", class: "btn btn-light btn-sm" %>
35
+ </td>
36
+ </tr>
37
+ <% end %>
38
+ </tbody>
39
+ </table>
33
40
  </div>
34
- <div class="col-md-8 col-lg-9 order-md-first">
35
- <div class="card">
36
- <div class="table-responsive">
37
- <table class="table table-vcenter card-table table-striped">
38
- <thead>
39
- <tr>
40
- <th><%= sort_link @search, :id %></th>
41
- <th><%= sort_link @search, :email %></th>
42
- <th><%= sort_link @search, :created_at %></th>
43
- <th></th>
44
- </tr>
45
- </thead>
46
- <tbody>
47
- <% @admin_users.each do |admin_user| %>
48
- <tr>
49
- <td><%= link_to admin_user.id, admin_user %></td>
50
- <td><%= admin_user.email %></td>
51
- <td><%= l(admin_user.created_at, format: :long) %></td>
52
- <td>
53
- <%= link_to "View", admin_user, class: "btn btn-light btn-sm" %>
54
- <%= link_to "Edit", edit_admin_user_path(admin_user), class: "btn btn-light btn-sm" %>
55
- <%= button_to "Delete", admin_user, method: :delete, data: { confirm: "Are you sure ?" }, form_class: "d-inline", class: "btn btn-light btn-sm" %>
56
- </td>
57
- </tr>
58
- <% end %>
59
- </tbody>
60
- </table>
61
- </div>
62
- <div class="card-footer d-flex align-items-center fs-5">
63
- <div>
64
- Download: <%= link_to "CSV", admin_users_path(format: :csv, q: request.params[:q]) %>
65
- </div>
66
- <div class="ms-auto d-flex align-items-center gap-2">
67
- <%== pagy_info @pagy %>
68
- <%= render "pagination", pagy: @pagy %>
69
- </div>
70
- </div>
41
+ <div class="card-footer d-flex align-items-center fs-5">
42
+ <div>Download: <%= link_to "CSV", admin_users_path(format: :csv, q: request.params[:q]) %></div>
43
+ <div class="ms-auto d-flex align-items-center gap-2">
44
+ <div class="d-none d-md-flex"><%== pagy_info @pagy %></div>
45
+ <%= render "pagination", pagy: @pagy %>
71
46
  </div>
72
47
  </div>
73
48
  </div>
74
49
  </div>
75
50
  </div>
51
+
52
+ <div id="offcanvasFilters" tabindex="-1" class="offcanvas offcanvas-end">
53
+ <div class="offcanvas-header">
54
+ <h2 class="offcanvas-title">Filters</h2>
55
+ <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas"></button>
56
+ </div>
57
+ <%= search_form_for @search, class: "offcanvas-body" do |f| %>
58
+ <%= f.label :email_cont, class: "form-label" %>
59
+ <%= f.text_field :email_cont, class: "form-control mb-3" %>
60
+
61
+ <%= f.label :created_at, class: "form-label" %>
62
+ <div class="d-flex gap-1 mb-3">
63
+ <%= f.date_field :created_at_gteq, class: "form-control" %>
64
+ <%= f.date_field :created_at_lteq, class: "form-control" %>
65
+ </div>
66
+
67
+ <%= f.submit "Filter", class: "btn btn-primary" %>
68
+ <%= link_to "Clear Filter", admin_users_path, class: "btn btn-light" %>
69
+ <% end %>
70
+ </div>
@@ -6,7 +6,7 @@
6
6
  <% end %>
7
7
 
8
8
  <div class="page-body">
9
- <div class="container-fluid">
9
+ <div class="container-xl">
10
10
  <div class="card">
11
11
  <div class="card-body">
12
12
  <%= render "form", admin_user: @admin_user %>
@@ -11,7 +11,7 @@
11
11
  <% end %>
12
12
 
13
13
  <div class="page-body">
14
- <div class="container-fluid">
14
+ <div class="container-xl">
15
15
  <div class="card">
16
16
  <div class="card-header">
17
17
  <h3 class="card-title">Admin user details</h3>
@@ -23,6 +23,7 @@
23
23
  </div>
24
24
  </div>
25
25
 
26
+ <%= render "flash_messages" %>
26
27
  <%= render "javascript_tags" %>
27
28
  </body>
28
29
  </html>
@@ -21,14 +21,12 @@
21
21
  <%= image_tag "admin/logo.svg", height: 36 %>
22
22
  <% end %>
23
23
  </div>
24
- <div class="text-center mb-2">
25
- <%= render "flash_messages" %>
26
- </div>
27
24
  <%= yield %>
28
25
  </div>
29
26
  </div>
30
27
  </div>
31
28
 
29
+ <%= render "flash_messages" %>
32
30
  <%= render "javascript_tags" %>
33
31
  </body>
34
32
  </html>
@@ -7,7 +7,7 @@
7
7
  <%% end %>
8
8
 
9
9
  <div class="page-body">
10
- <div class="container-fluid">
10
+ <div class="container-xl">
11
11
  <div class="card">
12
12
  <div class="card-body">
13
13
  <%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
@@ -4,74 +4,69 @@
4
4
  <%% end %>
5
5
 
6
6
  <%%= render "page_header_actions" do %>
7
+ <%%= link_to "Filters", "#offcanvasFilters", "data-bs-toggle": "offcanvas", class: "btn btn-light" %>
7
8
  <%%= link_to "New <%= human_name.downcase %>", <%= new_helper(type: :path) %>, class: "btn btn-primary" %>
8
9
  <%% end %>
9
10
  <%% end %>
10
11
 
11
12
  <div class="page-body">
12
- <div class="container-fluid">
13
- <div class="row gy-3">
14
- <div class="col-md-4 col-lg-3">
15
- <div class="card">
16
- <div class="card-header">
17
- <h3 class="card-title">Filters</h3>
18
- </div>
19
- <%%= search_form_for [:admin, @search], class: "card-body" do |f| %>
20
- <%%# f.label :name_cont, class: "form-label" %>
21
- <%%# f.text_field :name_cont, class: "form-control mb-3" %>
22
-
23
- <%%= f.submit "Filter", class: "btn btn-primary" %>
24
- <%%= link_to "Clear Filter", <%= index_helper(type: :path) %>, class: "btn btn-light" %>
25
- <%% end %>
26
- </div>
27
- </div>
28
- <div class="col-md-8 col-lg-9 order-md-first">
29
- <div class="card">
30
- <div class="table-responsive">
31
- <table class="table table-vcenter card-table table-striped">
32
- <thead>
33
- <tr>
13
+ <div class="container-xl">
14
+ <div class="card">
15
+ <div class="table-responsive">
16
+ <table class="table table-vcenter table-nowrap card-table table-striped">
17
+ <thead>
18
+ <tr>
34
19
  <% attributes.each do |attribute| -%>
35
- <th><%= attribute.human_name %></th>
20
+ <th><%%= sort_link @search, :<%= attribute.column_name %> %></th>
36
21
  <% end -%>
37
- <th></th>
38
- </tr>
39
- </thead>
40
- <tbody>
41
- <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
42
- <tr>
22
+ <th></th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
27
+ <tr>
43
28
  <% attributes.reject(&:password_digest?).each do |attribute| -%>
44
29
  <% if attribute.attachment? -%>
45
- <td><%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? %></td>
30
+ <td><%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? %></td>
46
31
  <% elsif attribute.attachments? -%>
47
- <%% <%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
48
- <td><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></td>
49
- <%% end %>
32
+ <%% <%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
33
+ <td><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></td>
34
+ <%% end %>
50
35
  <% else -%>
51
- <td><%%= <%= singular_name %>.<%= attribute.column_name %> %></td>
36
+ <td><%%= <%= singular_name %>.<%= attribute.column_name %> %></td>
52
37
  <% end -%>
53
38
  <% end -%>
54
- <td>
55
- <%%= link_to "View", <%= model_resource_name %>, class: "btn btn-light btn-sm" %>
56
- <%%= link_to "Edit", <%= edit_helper(singular_table_name, type: :path) %>, class: "btn btn-light btn-sm" %>
57
- <%%= button_to "Delete", <%= model_resource_name %>, method: :delete, form_class: "d-inline", class: "btn btn-light btn-sm", data: { confirm: "Are you sure ?" } %>
58
- </td>
59
- </tr>
60
- <%% end %>
61
- </tbody>
62
- </table>
63
- </div>
64
- <div class="card-footer d-flex align-items-center fs-5">
65
- <div>
66
- Download: <%%= link_to "CSV", <%= index_helper(type: :path) %>(format: :csv, q: request.params[:q]) %>
67
- </div>
68
- <div class="ms-auto d-flex align-items-center gap-2">
69
- <%%== pagy_info @pagy %>
70
- <%%= render "pagination", pagy: @pagy %>
71
- </div>
72
- </div>
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, form_class: "d-inline", class: "btn btn-light btn-sm", data: { confirm: "Are you sure ?" } %>
43
+ </td>
44
+ </tr>
45
+ <%% end %>
46
+ </tbody>
47
+ </table>
48
+ </div>
49
+ <div class="card-footer d-flex align-items-center fs-5">
50
+ <div>Download: <%%= link_to "CSV", <%= index_helper(type: :path) %>(format: :csv, q: request.params[:q]) %></div>
51
+ <div class="ms-auto d-flex align-items-center gap-2">
52
+ <div class="d-none d-md-flex"><%%== pagy_info @pagy %></div>
53
+ <%%= render "pagination", pagy: @pagy %>
73
54
  </div>
74
55
  </div>
75
56
  </div>
76
57
  </div>
77
58
  </div>
59
+
60
+ <div id="offcanvasFilters" tabindex="-1" class="offcanvas offcanvas-end">
61
+ <div class="offcanvas-header">
62
+ <h2 class="offcanvas-title">Filters</h2>
63
+ <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas"></button>
64
+ </div>
65
+ <%%= search_form_for [:admin, @search], class: "offcanvas-body" do |f| %>
66
+ <%%# f.label :name_cont, class: "form-label" %>
67
+ <%%# f.text_field :name_cont, class: "form-control mb-3" %>
68
+
69
+ <%%= f.submit "Filter", class: "btn btn-primary" %>
70
+ <%%= link_to "Clear Filter", <%= index_helper(type: :path) %>, class: "btn btn-light" %>
71
+ <%% end %>
72
+ </div>
@@ -6,7 +6,7 @@
6
6
  <%% end %>
7
7
 
8
8
  <div class="page-body">
9
- <div class="container-fluid">
9
+ <div class="container-xl">
10
10
  <div class="card">
11
11
  <div class="card-body">
12
12
  <%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
@@ -11,7 +11,7 @@
11
11
  <%% end %>
12
12
 
13
13
  <div class="page-body">
14
- <div class="container-fluid">
14
+ <div class="container-xl">
15
15
  <div class="card">
16
16
  <div class="card-header">
17
17
  <h3 class="card-title"><%= human_name %> details</h3>
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon