basecoat 1.1.1 → 2.0.0
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/lib/basecoat/version.rb +1 -1
- data/lib/generators/basecoat/templates/layouts/_aside.html.erb +1 -1
- data/lib/generators/basecoat/templates/shared/_empty.html.erb +16 -0
- data/lib/tasks/basecoat.rake +14 -9
- data/lib/templates/erb/scaffold/_form.html.erb.tt +3 -3
- data/lib/templates/erb/scaffold/index.html.erb.tt +1 -10
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30c46abb1310bf79995534b1fcd52074a67f327d42ea93a933065b46b02d8563
|
|
4
|
+
data.tar.gz: 509ac587a90f7be78362d5d92d0506de9528dc3e773d0c20b7bdfa2050eedc30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f01fd3115a85191fb41f999662adfda41666f022d54f53e46242987ba5b61fc4459322f41d48f238b1dc2537573a161b2514baf8faee83762fff80e2e7faa11d
|
|
7
|
+
data.tar.gz: c58e1ced83b1ad2b8083e0cbc7481476fe06ba8abe26cc95280f4047d1c0174596b129dcfcaf5f1bfa9b5d77c27689649dfb6334743251a6bf9c42607b1c5651
|
data/lib/basecoat/version.rb
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<div class="flex mt-10 flex-1 flex-col items-center justify-center gap-6">
|
|
2
|
+
<header class="flex max-w-sm flex-col items-center gap-2 text-center">
|
|
3
|
+
<div class="mb-2 bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg">
|
|
4
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 10.5 8 13l2 2.5" /><path d="m14 10.5 2 2.5-2 2.5" /><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z" /></svg>
|
|
5
|
+
</div>
|
|
6
|
+
<h3 class="text-lg font-medium tracking-tight">No <%= resource_name %> yet</h3>
|
|
7
|
+
<p class="text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4">
|
|
8
|
+
Get started by creating your first <%= resource_name.singularize %>.
|
|
9
|
+
</p>
|
|
10
|
+
</header>
|
|
11
|
+
<section class="flex w-full max-w-sm flex-col items-center gap-4 text-sm text-balance">
|
|
12
|
+
<div class="flex gap-2">
|
|
13
|
+
<%= link_to "New #{resource_name.singularize}", new_path, class: "btn", data: { turbo_action: "advance" } %>
|
|
14
|
+
</div>
|
|
15
|
+
</section>
|
|
16
|
+
</div>
|
data/lib/tasks/basecoat.rake
CHANGED
|
@@ -32,7 +32,7 @@ namespace :basecoat do
|
|
|
32
32
|
|
|
33
33
|
unless importmap_content.include?("basecoat-css")
|
|
34
34
|
File.open(importmap_path, "a") do |f|
|
|
35
|
-
f.puts "\npin \"basecoat-css/all\", to: \"https://cdn.jsdelivr.net/npm/basecoat-css@0.3.
|
|
35
|
+
f.puts "\npin \"basecoat-css/all\", to: \"https://cdn.jsdelivr.net/npm/basecoat-css@0.3.3/dist/js/all.js\""
|
|
36
36
|
end
|
|
37
37
|
puts " Added: basecoat-css to config/importmap.rb"
|
|
38
38
|
end
|
|
@@ -58,16 +58,10 @@ namespace :basecoat do
|
|
|
58
58
|
puts " Added: basecoat-css import to app/javascript/application.js"
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
# Add
|
|
61
|
+
# Add cool view transition to application.js
|
|
62
62
|
js_content = File.read(js_path)
|
|
63
63
|
unless js_content.include?("Re-initialize basecoat-css components")
|
|
64
64
|
basecoat_js = <<~JS
|
|
65
|
-
|
|
66
|
-
// Re-initialize basecoat-css components after Turbo navigation
|
|
67
|
-
document.addEventListener('turbo:load', () => {
|
|
68
|
-
document.dispatchEvent(new Event('DOMContentLoaded', { bubbles: true, cancelable: false }))
|
|
69
|
-
})
|
|
70
|
-
|
|
71
65
|
// View transitions for turbo frame navigation
|
|
72
66
|
addEventListener("turbo:before-frame-render", (event) => {
|
|
73
67
|
if (document.startViewTransition) {
|
|
@@ -80,7 +74,7 @@ namespace :basecoat do
|
|
|
80
74
|
})
|
|
81
75
|
JS
|
|
82
76
|
File.open(js_path, "a") { |f| f.write(basecoat_js) }
|
|
83
|
-
puts " Added:
|
|
77
|
+
puts " Added: cool view transition to app/javascript/application.js"
|
|
84
78
|
end
|
|
85
79
|
|
|
86
80
|
# Copy theme_controller.js
|
|
@@ -179,6 +173,17 @@ namespace :basecoat do
|
|
|
179
173
|
puts " Created: app/views/layouts/#{filename}"
|
|
180
174
|
end
|
|
181
175
|
|
|
176
|
+
# Copy shared partials
|
|
177
|
+
shared_source = File.expand_path("../generators/basecoat/templates/shared", __dir__)
|
|
178
|
+
shared_destination = Rails.root.join("app/views/shared")
|
|
179
|
+
|
|
180
|
+
FileUtils.mkdir_p(shared_destination)
|
|
181
|
+
Dir.glob("#{shared_source}/*").each do |file|
|
|
182
|
+
filename = File.basename(file)
|
|
183
|
+
FileUtils.cp(file, shared_destination.join(filename))
|
|
184
|
+
puts " Created: app/views/shared/#{filename}"
|
|
185
|
+
end
|
|
186
|
+
|
|
182
187
|
# Copy scaffold hook initializer
|
|
183
188
|
initializer_source = File.expand_path("../generators/basecoat/templates/scaffold_hook.rb", __dir__)
|
|
184
189
|
initializer_destination = Rails.root.join("config/initializers/scaffold_hook.rb")
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<%%= form_with(model: <%= model_resource_name %>, class: "space-y-
|
|
1
|
+
<%%= form_with(model: <%= model_resource_name %>, class: "space-y-4") do |form| %>
|
|
2
2
|
<%%= render "/layouts/form_errors", object: <%= singular_table_name %> if <%= singular_table_name %>.errors.any? %>
|
|
3
3
|
|
|
4
4
|
<% attributes.each do |attribute| -%>
|
|
5
5
|
<% required = attribute.to_s.include?('{null}') -%>
|
|
6
|
-
<div class="
|
|
6
|
+
<div class="field">
|
|
7
7
|
<% if attribute.password_digest? -%>
|
|
8
8
|
<%%= form.label :password, class: "label" %>
|
|
9
9
|
<%%= form.password_field :password, class: "input", required: true %>
|
|
10
10
|
</div>
|
|
11
11
|
|
|
12
|
-
<div class="
|
|
12
|
+
<div class="field">
|
|
13
13
|
<%%= form.label :password_confirmation, class: "label" %>
|
|
14
14
|
<%%= form.password_field :password_confirmation, class: "input", required: true %>
|
|
15
15
|
<% elsif attribute.attachments? -%>
|
|
@@ -45,15 +45,6 @@
|
|
|
45
45
|
</div>
|
|
46
46
|
|
|
47
47
|
<%% if @<%= plural_table_name %>.empty? %>
|
|
48
|
-
|
|
49
|
-
<div class="mb-4">
|
|
50
|
-
<svg class="mx-auto h-12 w-12" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
51
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2M4 13h2m13-8V4a1 1 0 00-1-1H7a1 1 0 00-1 1v1h10z" />
|
|
52
|
-
</svg>
|
|
53
|
-
</div>
|
|
54
|
-
<h3 class="text-lg font-medium mb-2">No <%= human_name.pluralize.downcase %> yet</h3>
|
|
55
|
-
<p class="mb-6">Get started by creating your first <%= human_name.downcase %>.</p>
|
|
56
|
-
<%%= link_to "New <%= human_name.downcase %>", <%= new_helper(type: :path) %>, class: "btn", data: { turbo_action: "advance" } %>
|
|
57
|
-
</div>
|
|
48
|
+
<%%= render "shared/empty", resource_name: "<%= human_name.pluralize.downcase %>", new_path: <%= new_helper(type: :path) %> %>
|
|
58
49
|
<%% end %>
|
|
59
50
|
<%% end %>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: basecoat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martijn Lafeber
|
|
@@ -75,6 +75,7 @@ files:
|
|
|
75
75
|
- lib/generators/basecoat/templates/scaffold_hook.rb
|
|
76
76
|
- lib/generators/basecoat/templates/sessions.html.erb
|
|
77
77
|
- lib/generators/basecoat/templates/sessions/new.html.erb
|
|
78
|
+
- lib/generators/basecoat/templates/shared/_empty.html.erb
|
|
78
79
|
- lib/generators/basecoat/templates/theme_controller.js
|
|
79
80
|
- lib/tasks/basecoat.rake
|
|
80
81
|
- lib/templates/erb/scaffold/_form.html.erb.tt
|