administration-zero 0.0.18 → 1.0.1
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/_javascript_tags.html.erb +8 -17
- data/lib/generators/admin/install/templates/erb/admin/base/_secondary_navbar.html.erb +2 -2
- data/lib/generators/admin/install/templates/helpers/admin/application_helper.rb +2 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5535d5c246174e4d3f6db561d68f9e89466752094029e9cfdc45735b220bce78
|
4
|
+
data.tar.gz: b93e1c1793e35aae39e5b8d127c9253524ca3a022a5692fce47a7c342b766209
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3f3660673d5698081315d20630b4d72835bab63c3aa038b05b355d80df5a6522e1208ab8c179e5b6cf5014b9bb2e73ef20872f8a9ed2f99e3dd5f1fefdefcac
|
7
|
+
data.tar.gz: e1ba7313c918f5b294ec59fe4211c1a5a3e059d44cbb3812deb48818bc803f5aed11da75f2f146aa3a0dffbc7306e29da522937e6f81a23f3a507ae899addceb
|
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
|
|
@@ -1,30 +1,21 @@
|
|
1
|
-
<!-- Tabler Core -->
|
2
1
|
<script src="https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta17/dist/js/tabler.min.js"></script>
|
3
|
-
|
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 })
|
9
|
-
</script>
|
10
|
-
|
11
|
-
<!-- Data confirm -->
|
12
|
-
<script type="module">
|
13
|
-
document.addEventListener("click", (event) => {
|
14
|
-
if (!event.target.matches("[data-confirm]")) return
|
15
|
-
if (!confirm(event.target.dataset["confirm"])) event.preventDefault()
|
16
|
-
})
|
17
|
-
</script>
|
2
|
+
<script src="https://cdn.jsdelivr.net/npm/@rails/ujs@7.0.4-2/lib/assets/compiled/rails-ujs.min.js"></script>
|
18
3
|
|
19
4
|
<!-- Stimulus controllers -->
|
20
5
|
<script type="module">
|
21
6
|
import { Application, Controller } from "https://cdn.jsdelivr.net/npm/stimulus@3.2.1/dist/stimulus.min.js"
|
22
7
|
window.Stimulus = Application.start()
|
23
8
|
|
24
|
-
// Flash message
|
25
9
|
Stimulus.register("flash-message", class extends Controller {
|
26
10
|
connect() {
|
27
11
|
new bootstrap.Toast(this.element).show()
|
28
12
|
}
|
29
13
|
})
|
30
14
|
</script>
|
15
|
+
|
16
|
+
<!-- Time zone cookie -->
|
17
|
+
<script type="module">
|
18
|
+
import Cookies from "https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.mjs"
|
19
|
+
const { timeZone } = new Intl.DateTimeFormat().resolvedOptions()
|
20
|
+
Cookies.set("time_zone", timeZone, { expires: 365 })
|
21
|
+
</script>
|
@@ -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>
|
@@ -5,12 +5,7 @@ module Admin::ApplicationHelper
|
|
5
5
|
content_for(:title) || Rails.application.class.to_s.split("::").first
|
6
6
|
end
|
7
7
|
|
8
|
-
def active_nav_item(
|
9
|
-
|
8
|
+
def active_nav_item(*names)
|
9
|
+
names.include?(controller_path) ? "active" : ""
|
10
10
|
end
|
11
|
-
|
12
|
-
private
|
13
|
-
def active_actions?(controller, actions)
|
14
|
-
params[:controller].include?(controller) && actions.include?(params[:action])
|
15
|
-
end
|
16
11
|
end
|
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:
|
4
|
+
version: 1.0.1
|
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-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|