Skip to content

Commit 89119e2

Browse files
committed
Refactor assets to use importmap and asset pipeline
1 parent 8253dbc commit 89119e2

File tree

20 files changed

+475
-86
lines changed

20 files changed

+475
-86
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ jobs:
1616
matrix:
1717
ruby: ['3.1', '3.2', '3.3']
1818
gemfile:
19+
- sprockets
1920
- rails_7
2021
- rails_7_1
2122
- rails_7_2
2223
- rails_main
24+
2325
env:
2426
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
2527
BUNDLE_PATH_RELATIVE_TO_CWD: true
@@ -51,8 +53,10 @@ jobs:
5153
matrix:
5254
ruby: ['3.1', '3.2', '3.3']
5355
gemfile:
56+
- sprockets
5457
- rails_7
5558
- rails_7_1
59+
- rails_7_2
5660
- rails_main
5761

5862
env:
@@ -95,8 +99,10 @@ jobs:
9599
matrix:
96100
ruby: ['3.1', '3.2', '3.3']
97101
gemfile:
102+
- sprockets
98103
- rails_7
99104
- rails_7_1
105+
- rails_7_2
100106
- rails_main
101107

102108
env:

Appraisals

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ appraise "rails-main" do
1919
gem "sqlite3", "~> 2.0"
2020
gem "propshaft"
2121
end
22+
23+
appraise "sprockets" do
24+
gem "sprockets-rails"
25+
end

Gemfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ gem "friendly_id", "~> 5.4"
1818
gem "name_of_person", "~> 1.1", ">= 1.1.1"
1919
gem "paper_trail", "~> 15.0"
2020
gem "puma"
21-
gem "sprockets-rails"
2221
gem "standardrb"
2322
gem "web-console", group: :development
2423

2524
# Databases to test against
2625
gem "pg"
2726
gem "mysql2"
2827
gem "sqlite3", "~> 1.4"
28+
29+
gem "propshaft"
30+
gem "turbo-rails"
31+
gem "stimulus-rails"

Gemfile.lock

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,6 @@ GEM
234234
rubocop-ast (>= 1.31.1, < 2.0)
235235
ruby-progressbar (1.13.0)
236236
securerandom (0.3.1)
237-
sprockets (4.2.1)
238-
concurrent-ruby (~> 1.0)
239-
rack (>= 2.2.4, < 4)
240-
sprockets-rails (3.5.2)
241-
actionpack (>= 6.1)
242-
activesupport (>= 6.1)
243-
sprockets (>= 3.0.0)
244237
sqlite3 (1.7.3)
245238
mini_portile2 (~> 2.8.0)
246239
sqlite3 (1.7.3-arm64-darwin)
@@ -260,10 +253,16 @@ GEM
260253
rubocop-performance (~> 1.21.0)
261254
standardrb (1.0.1)
262255
standard
256+
stimulus-rails (1.3.4)
257+
railties (>= 6.0.0)
263258
stringio (3.1.1)
264259
strscan (3.1.0)
265260
thor (1.3.1)
266261
timeout (0.4.1)
262+
turbo-rails (2.0.6)
263+
actionpack (>= 6.0.0)
264+
activejob (>= 6.0.0)
265+
railties (>= 6.0.0)
267266
tzinfo (2.0.6)
268267
concurrent-ruby (~> 1.0)
269268
unicode-display_width (2.5.0)
@@ -299,10 +298,12 @@ DEPENDENCIES
299298
name_of_person (~> 1.1, >= 1.1.1)
300299
paper_trail (~> 15.0)
301300
pg
301+
propshaft
302302
puma
303-
sprockets-rails
304303
sqlite3 (~> 1.4)
305304
standardrb
305+
stimulus-rails
306+
turbo-rails
306307
web-console
307308

308309
BUNDLED WITH

app/assets/config/madmin_manifest.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//= link_directory ../stylesheets/madmin .css
2+
//= link_directory ../../javascript/madmin .js
3+
//= link_tree ../../javascript/madmin/controllers .js
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,80 @@
1+
/*
2+
* Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and
3+
* the trix-editor content (whether displayed or under editing). Feel free to incorporate this
4+
* inclusion directly in any other asset bundle and remove this file.
5+
*
6+
*= require trix
7+
*/
8+
19
@import url("../trix.css");
210
@import url("./actiontext.css");
11+
12+
.form-input {
13+
width: 100%;
14+
}
15+
16+
.pagy {
17+
display: inline-flex;
18+
isolation: isolate;
19+
border-radius: 0.375rem;
20+
21+
a {
22+
display: inline-flex;
23+
position: relative;
24+
padding-top: 0.5rem;
25+
padding-bottom: 0.5rem;
26+
padding-left: 0.75rem;
27+
padding-right: 0.75rem;
28+
margin-left: -1px;
29+
align-items: center;
30+
box-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
31+
--tw-ring-inset: inset;
32+
--tw-ring-color: #D1D5DB;
33+
font-size: 0.875rem;
34+
line-height: 1.25rem;
35+
font-weight: 600;
36+
color: #111827;
37+
background-color: #ffffff;
38+
}
39+
40+
a:hover {
41+
background-color: #F3F4F6;
42+
}
43+
44+
a:not([href]) {
45+
color: #D1D5DB;
46+
cursor: default;
47+
}
48+
49+
a.current {
50+
--tw-ring-color: #3B82F6;
51+
color: #ffffff;
52+
background-color: #3B82F6;
53+
}
54+
55+
a:first-child {
56+
border-top-left-radius: 0.375rem;
57+
border-bottom-left-radius: 0.375rem;
58+
}
59+
a:last-child {
60+
border-top-right-radius: 0.375rem;
61+
border-bottom-right-radius: 0.375rem;
62+
}
63+
64+
label {
65+
display: inline-block;
66+
padding-top: 0.125rem;
67+
padding-bottom: 0.125rem;
68+
padding-left: 0.75rem;
69+
padding-right: 0.75rem;
70+
border-radius: 0.5rem;
71+
white-space: nowrap;
72+
background-color: #E5E7EB;
73+
}
74+
75+
label input {
76+
border-radius: 0.375rem;
77+
border-style: none;
78+
background-color: #F3F4F6;
79+
}
80+
}

app/views/madmin/application/_javascript.html.erb

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,3 @@
55
<%= stylesheet_link_tag "https://unpkg.com/tom-select/dist/css/tom-select.min.css", "data-turbo-track": "reload" %>
66

77
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"></script>
8-
<style type="text/tailwindcss">
9-
.pagy {
10-
@apply isolate inline-flex rounded-md;
11-
12-
a:first-child {
13-
@apply rounded-l-md;
14-
}
15-
a:last-child {
16-
@apply rounded-r-md;
17-
}
18-
19-
a {
20-
@apply relative -ml-px inline-flex items-center bg-white px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-100 focus:z-10;
21-
22-
&:not([href]) {
23-
@apply text-gray-300 cursor-default;
24-
}
25-
26-
&.current {
27-
@apply text-white bg-blue-500 ring-blue-500;
28-
}
29-
}
30-
31-
label {
32-
@apply inline-block whitespace-nowrap bg-gray-200 rounded-lg px-3 py-0.5;
33-
input {
34-
@apply bg-gray-100 border-none rounded-md;
35-
}
36-
}
37-
}
38-
</style>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<%= form.select field.attribute_name, field.options_for_select(record), { prompt: true }, { class: "form-select", data: { controller: "select" } } %>
1+
<%= form.select field.attribute_name, field.options_for_select(record), { prompt: true }, { data: { controller: "select" } } %>

gemfiles/rails_7.gemfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ gem "friendly_id", "~> 5.4"
99
gem "name_of_person", "~> 1.1", ">= 1.1.1"
1010
gem "paper_trail", "~> 15.0"
1111
gem "puma"
12-
gem "sprockets-rails"
1312
gem "standardrb"
1413
gem "web-console", group: :development
1514
gem "pg"
1615
gem "mysql2"
1716
gem "sqlite3", "~> 1.4"
18-
gem "rails", "~> 7.0.0"
1917
gem "propshaft"
18+
gem "turbo-rails"
19+
gem "stimulus-rails"
20+
gem "rails", "~> 7.0.0"
2021

2122
gemspec path: "../"

gemfiles/rails_7.gemfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,6 @@ GEM
208208
rubocop (>= 1.48.1, < 2.0)
209209
rubocop-ast (>= 1.31.1, < 2.0)
210210
ruby-progressbar (1.13.0)
211-
sprockets (4.2.1)
212-
concurrent-ruby (~> 1.0)
213-
rack (>= 2.2.4, < 4)
214-
sprockets-rails (3.5.2)
215-
actionpack (>= 6.1)
216-
activesupport (>= 6.1)
217-
sprockets (>= 3.0.0)
218211
sqlite3 (1.7.3)
219212
mini_portile2 (~> 2.8.0)
220213
sqlite3 (1.7.3-arm64-darwin)
@@ -234,9 +227,15 @@ GEM
234227
rubocop-performance (~> 1.21.0)
235228
standardrb (1.0.1)
236229
standard
230+
stimulus-rails (1.3.4)
231+
railties (>= 6.0.0)
237232
strscan (3.1.0)
238233
thor (1.3.1)
239234
timeout (0.4.1)
235+
turbo-rails (2.0.6)
236+
actionpack (>= 6.0.0)
237+
activejob (>= 6.0.0)
238+
railties (>= 6.0.0)
240239
tzinfo (2.0.6)
241240
concurrent-ruby (~> 1.0)
242241
unicode-display_width (2.5.0)
@@ -273,9 +272,10 @@ DEPENDENCIES
273272
propshaft
274273
puma
275274
rails (~> 7.0.0)
276-
sprockets-rails
277275
sqlite3 (~> 1.4)
278276
standardrb
277+
stimulus-rails
278+
turbo-rails
279279
web-console
280280

281281
BUNDLED WITH

0 commit comments

Comments
 (0)