administration-zero 1.0.0 → 1.0.2
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 +9 -8
 - data/lib/administration_zero/version.rb +1 -1
 - data/lib/generators/admin/install/templates/erb/admin/base/_secondary_navbar.html.erb +2 -2
 - data/lib/generators/admin/install/templates/erb/admin/users/index.html.erb +3 -3
 - data/lib/generators/admin/install/templates/erb/admin/users/show.html.erb +1 -1
 - data/lib/generators/admin/install/templates/helpers/admin/application_helper.rb +4 -7
 - data/lib/generators/admin/scaffold/templates/erb/index.html.erb.tt +3 -3
 - data/lib/generators/admin/scaffold/templates/erb/show.html.erb.tt +1 -1
 - metadata +2 -3
 - data/lib/generators/admin/install/templates/erb/admin/base/_pagination.html.erb +0 -24
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d82b34403451e2ff66cae9d8475b235f3c63f063a4781b323502054c0e73f398
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a09b53b077a1f327e064e28f0faeb0a875c61c9cef1227691897fd219cdaf0fd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 742d6bcb516e30d8a0bda81e221092271277422fee9bbdd67623354e20080cd147ec538a8d41c11f5e0ba3dd274e42aec3edd64076e42e60aef567cd1dce52b8
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 44cc0737abd7a70eed80bd4f1c9292568d9db70798b6a5e778bbedd5bf8a58624c6baa237e667e2a6f810890d7500b682e38592dba160e50006e94a56e852a5b
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -22,22 +22,23 @@ The purpose of administration zero is to generate a pre-built administration pan 
     | 
|
| 
       22 
22 
     | 
    
         
             
            bundle add administration-zero
         
     | 
| 
       23 
23 
     | 
    
         
             
            ```
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
            You'll need to create a model to be administrated, if you don't have one. for this example let's use the following:
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
            ```
         
     | 
| 
       28 
     | 
    
         
            -
            rails generate model posts title:string body:text published:boolean
         
     | 
| 
       29 
     | 
    
         
            -
            ```
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
25 
     | 
    
         
             
            ## Usage
         
     | 
| 
       32 
26 
     | 
    
         | 
| 
       33 
27 
     | 
    
         
             
            ```
         
     | 
| 
       34 
28 
     | 
    
         
             
            rails generate admin:install
         
     | 
| 
       35 
29 
     | 
    
         
             
            ```
         
     | 
| 
       36 
30 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
            Then run `bundle install` 
     | 
| 
      
 31 
     | 
    
         
            +
            Then run `bundle install`
         
     | 
| 
       38 
32 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
            Then run `rails db:migrate db:seed 
     | 
| 
      
 33 
     | 
    
         
            +
            Then run `rails db:migrate db:seed`
         
     | 
| 
       40 
34 
     | 
    
         | 
| 
      
 35 
     | 
    
         
            +
            You can access the admin panel in `/admin`, using `email: "admin@example.com", password: "Password9957"`
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            You'll need to create a model to be administrated, if you don't have one. for this example let's use the following:
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            ```
         
     | 
| 
      
 40 
     | 
    
         
            +
            rails generate model posts title:string body:text published:boolean
         
     | 
| 
      
 41 
     | 
    
         
            +
            ```
         
     | 
| 
       41 
42 
     | 
    
         | 
| 
       42 
43 
     | 
    
         
             
            Now you're ready to generate your admin scaffolds.
         
     | 
| 
       43 
44 
     | 
    
         | 
| 
         @@ -3,7 +3,7 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
                <div class="navbar navbar-light">
         
     | 
| 
       4 
4 
     | 
    
         
             
                  <div class="container-xl">
         
     | 
| 
       5 
5 
     | 
    
         
             
                    <ul class="navbar-nav">
         
     | 
| 
       6 
     | 
    
         
            -
                      <li class="nav-item <%= active_nav_item 
     | 
| 
      
 6 
     | 
    
         
            +
                      <li class="nav-item <%= active_nav_item("admin/home") %>">
         
     | 
| 
       7 
7 
     | 
    
         
             
                        <%= link_to admin_path, class: "nav-link" do %>
         
     | 
| 
       8 
8 
     | 
    
         
             
                          <span class="nav-link-icon d-md-none d-lg-inline-block"><!-- Download SVG icon from http://tabler-icons.io/i/home -->
         
     | 
| 
       9 
9 
     | 
    
         
             
                            <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><polyline points="5 12 3 12 12 3 21 12 19 12" /><path d="M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7" /><path d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6" /></svg>
         
     | 
| 
         @@ -13,7 +13,7 @@ 
     | 
|
| 
       13 
13 
     | 
    
         
             
                          </span>
         
     | 
| 
       14 
14 
     | 
    
         
             
                        <% end %>
         
     | 
| 
       15 
15 
     | 
    
         
             
                      </li>
         
     | 
| 
       16 
     | 
    
         
            -
                      <li class="nav-item <%= active_nav_item 
     | 
| 
      
 16 
     | 
    
         
            +
                      <li class="nav-item <%= active_nav_item("admin/users") %>">
         
     | 
| 
       17 
17 
     | 
    
         
             
                        <%= link_to admin_users_path, class: "nav-link" do %>
         
     | 
| 
       18 
18 
     | 
    
         
             
                          <span class="nav-link-icon d-md-none d-lg-inline-block"><!-- Download SVG icon from http://tabler-icons.io/i/home -->
         
     | 
| 
       19 
19 
     | 
    
         
             
                            <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><circle cx="9" cy="7" r="4"></circle><path d="M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path><path d="M21 21v-2a4 4 0 0 0 -3 -3.85"></path></svg>
         
     | 
| 
         @@ -31,7 +31,7 @@ 
     | 
|
| 
       31 
31 
     | 
    
         
             
                            <td>
         
     | 
| 
       32 
32 
     | 
    
         
             
                              <%= link_to "View", user, class: "btn btn-white btn-sm" %>
         
     | 
| 
       33 
33 
     | 
    
         
             
                              <%= link_to "Edit", edit_admin_user_path(user), class: "btn btn-white btn-sm" %>
         
     | 
| 
       34 
     | 
    
         
            -
                              <%=  
     | 
| 
      
 34 
     | 
    
         
            +
                              <%= link_to "Delete", user, class: "btn btn-white btn-sm", data: { method: :delete, confirm: "Are you sure?" } %>
         
     | 
| 
       35 
35 
     | 
    
         
             
                            </td>
         
     | 
| 
       36 
36 
     | 
    
         
             
                          </tr>
         
     | 
| 
       37 
37 
     | 
    
         
             
                        <% end %>
         
     | 
| 
         @@ -41,10 +41,10 @@ 
     | 
|
| 
       41 
41 
     | 
    
         
             
                  <div class="card-footer d-flex align-items-center fs-5">
         
     | 
| 
       42 
42 
     | 
    
         
             
                    <div class="d-none d-md-block">
         
     | 
| 
       43 
43 
     | 
    
         
             
                      <div>Download: <%= link_to "CSV", admin_users_path(format: :csv, q: request.params[:q]) %></div>
         
     | 
| 
       44 
     | 
    
         
            -
                       
     | 
| 
      
 44 
     | 
    
         
            +
                      <%== pagy_info(@pagy) %>
         
     | 
| 
       45 
45 
     | 
    
         
             
                    </div>
         
     | 
| 
       46 
46 
     | 
    
         
             
                    <div class="ms-auto">
         
     | 
| 
       47 
     | 
    
         
            -
                       
     | 
| 
      
 47 
     | 
    
         
            +
                      <%== pagy_bootstrap_nav(@pagy) %>
         
     | 
| 
       48 
48 
     | 
    
         
             
                    </div>
         
     | 
| 
       49 
49 
     | 
    
         
             
                  </div>
         
     | 
| 
       50 
50 
     | 
    
         
             
                </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 
     | 
    
         
            -
                <%=  
     | 
| 
      
 9 
     | 
    
         
            +
                <%= link_to "Delete user", @user, class: "btn btn-white", data: { method: :delete, confirm: "Are you sure?" } %>
         
     | 
| 
       10 
10 
     | 
    
         
             
              <% end %>
         
     | 
| 
       11 
11 
     | 
    
         
             
            <% end %>
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
         @@ -1,3 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "pagy/extras/bootstrap"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            module Admin::ApplicationHelper
         
     | 
| 
       2 
4 
     | 
    
         
             
              include Pagy::Frontend
         
     | 
| 
       3 
5 
     | 
    
         | 
| 
         @@ -5,12 +7,7 @@ module Admin::ApplicationHelper 
     | 
|
| 
       5 
7 
     | 
    
         
             
                content_for(:title) || Rails.application.class.to_s.split("::").first
         
     | 
| 
       6 
8 
     | 
    
         
             
              end
         
     | 
| 
       7 
9 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              def active_nav_item( 
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
      
 10 
     | 
    
         
            +
              def active_nav_item(*names)
         
     | 
| 
      
 11 
     | 
    
         
            +
                names.include?(controller_path) ? "active" : ""
         
     | 
| 
       10 
12 
     | 
    
         
             
              end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              private
         
     | 
| 
       13 
     | 
    
         
            -
                def active_actions?(controller, actions)
         
     | 
| 
       14 
     | 
    
         
            -
                  params[:controller].include?(controller) && actions.include?(params[:action])
         
     | 
| 
       15 
     | 
    
         
            -
                end
         
     | 
| 
       16 
13 
     | 
    
         
             
            end
         
     | 
| 
         @@ -39,7 +39,7 @@ 
     | 
|
| 
       39 
39 
     | 
    
         
             
                            <td>
         
     | 
| 
       40 
40 
     | 
    
         
             
                              <%%= link_to "View", <%= model_resource_name %>, class: "btn btn-white btn-sm" %>
         
     | 
| 
       41 
41 
     | 
    
         
             
                              <%%= link_to "Edit", <%= edit_helper(singular_table_name, type: :path) %>, class: "btn btn-white btn-sm" %>
         
     | 
| 
       42 
     | 
    
         
            -
                              <%%=  
     | 
| 
      
 42 
     | 
    
         
            +
                              <%%= link_to "Delete", <%= model_resource_name %>, class: "btn btn-white btn-sm", data: { method: :delete, confirm: "Are you sure?" } %>
         
     | 
| 
       43 
43 
     | 
    
         
             
                            </td>
         
     | 
| 
       44 
44 
     | 
    
         
             
                          </tr>
         
     | 
| 
       45 
45 
     | 
    
         
             
                        <%% end %>
         
     | 
| 
         @@ -49,10 +49,10 @@ 
     | 
|
| 
       49 
49 
     | 
    
         
             
                  <div class="card-footer d-flex align-items-center fs-5">
         
     | 
| 
       50 
50 
     | 
    
         
             
                    <div class="d-none d-md-block">
         
     | 
| 
       51 
51 
     | 
    
         
             
                      <div>Download: <%%= link_to "CSV", url_for(format: :csv, q: request.params[:q]) %></div>
         
     | 
| 
       52 
     | 
    
         
            -
                       
     | 
| 
      
 52 
     | 
    
         
            +
                      <%%== pagy_info(@pagy) %>
         
     | 
| 
       53 
53 
     | 
    
         
             
                    </div>
         
     | 
| 
       54 
54 
     | 
    
         
             
                    <div class="ms-auto">
         
     | 
| 
       55 
     | 
    
         
            -
                       
     | 
| 
      
 55 
     | 
    
         
            +
                      <%%== pagy_bootstrap_nav(@pagy) %>
         
     | 
| 
       56 
56 
     | 
    
         
             
                    </div>
         
     | 
| 
       57 
57 
     | 
    
         
             
                  </div>
         
     | 
| 
       58 
58 
     | 
    
         
             
                </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 
     | 
    
         
            -
                <%%=  
     | 
| 
      
 9 
     | 
    
         
            +
                <%%= link_to "Delete <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, class: "btn btn-white", data: { method: :delete, confirm: "Are you sure?" } %>
         
     | 
| 
       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: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Nixon
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023-03- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-03-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description:
         
     | 
| 
       14 
14 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -44,7 +44,6 @@ files: 
     | 
|
| 
       44 
44 
     | 
    
         
             
            - lib/generators/admin/install/templates/erb/admin/base/_page_header.html.erb
         
     | 
| 
       45 
45 
     | 
    
         
             
            - lib/generators/admin/install/templates/erb/admin/base/_page_header_actions.html.erb
         
     | 
| 
       46 
46 
     | 
    
         
             
            - lib/generators/admin/install/templates/erb/admin/base/_page_header_breadcrumb.html.erb
         
     | 
| 
       47 
     | 
    
         
            -
            - lib/generators/admin/install/templates/erb/admin/base/_pagination.html.erb
         
     | 
| 
       48 
47 
     | 
    
         
             
            - lib/generators/admin/install/templates/erb/admin/base/_primary_navbar.html.erb
         
     | 
| 
       49 
48 
     | 
    
         
             
            - lib/generators/admin/install/templates/erb/admin/base/_secondary_navbar.html.erb
         
     | 
| 
       50 
49 
     | 
    
         
             
            - lib/generators/admin/install/templates/erb/admin/base/_stylesheet_link_tags.html.erb
         
     | 
| 
         @@ -1,24 +0,0 @@ 
     | 
|
| 
       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 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              The link variable is set to a proc that returns the link tag.
         
     | 
| 
       6 
     | 
    
         
            -
              Usage: link.call( page_number [, text [, extra_attributes_string ]])
         
     | 
| 
       7 
     | 
    
         
            -
            -%>
         
     | 
| 
       8 
     | 
    
         
            -
            <% link = pagy_link_proc(pagy, link_extra: 'class="page-link"') -%>
         
     | 
| 
       9 
     | 
    
         
            -
            <%#                            -%><nav aria-label="pager" class="pagy-bootstrap-nav d-inline-block" role="navigation">
         
     | 
| 
       10 
     | 
    
         
            -
            <%#                            -%>  <ul class="pagination m-0">
         
     | 
| 
       11 
     | 
    
         
            -
            <% if pagy.prev                -%>    <li class="page-item prev"><%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"') %></li>
         
     | 
| 
       12 
     | 
    
         
            -
            <% else                        -%>    <li class="page-item prev disabled"><a href="#" class="page-link"><%== pagy_t('pagy.nav.prev') %></a></li>
         
     | 
| 
       13 
     | 
    
         
            -
            <% end                         -%>
         
     | 
| 
       14 
     | 
    
         
            -
            <% pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] -%>
         
     | 
| 
       15 
     | 
    
         
            -
            <%   if    item.is_a?(Integer) -%>    <li class="page-item"><%== link.call(item) %></li>
         
     | 
| 
       16 
     | 
    
         
            -
            <%   elsif item.is_a?(String)  -%>    <li class="page-item active"><%== link.call(item) %></li>
         
     | 
| 
       17 
     | 
    
         
            -
            <%   elsif item == :gap        -%>    <li class="page-item disabled gap"><a href="#" class="page-link"><%== pagy_t('pagy.nav.gap') %></a></li>
         
     | 
| 
       18 
     | 
    
         
            -
            <%   end                       -%>
         
     | 
| 
       19 
     | 
    
         
            -
            <% end                         -%>
         
     | 
| 
       20 
     | 
    
         
            -
            <% if pagy.next                -%>    <li class="page-item next"><%== link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"') %></li>
         
     | 
| 
       21 
     | 
    
         
            -
            <% else                        -%>    <li class="page-item next disabled"><a href="#" class="page-link"><%== pagy_t('pagy.nav.next') %></a></li>
         
     | 
| 
       22 
     | 
    
         
            -
            <% end                         -%>
         
     | 
| 
       23 
     | 
    
         
            -
            <%#                            -%>  </ul>
         
     | 
| 
       24 
     | 
    
         
            -
            <%#                            -%></nav>
         
     |