maquina 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.overmind.env +1 -0
  3. data/Gemfile +20 -0
  4. data/Gemfile.lock +346 -0
  5. data/Procfile.dev +3 -0
  6. data/app/assets/images/maquina/.keep +0 -0
  7. data/app/assets/javascripts/maquina/controllers/file_controller.js +1 -1
  8. data/app/assets/stylesheets/maquina/application.tailwind.css +96 -97
  9. data/app/controllers/concerns/.keep +0 -0
  10. data/app/controllers/concerns/maquina/authenticate.rb +5 -1
  11. data/app/controllers/concerns/maquina/resourceful.rb +9 -9
  12. data/app/models/concerns/.keep +0 -0
  13. data/app/models/concerns/maquina/blockeable.rb +13 -3
  14. data/app/models/maquina/current.rb +2 -1
  15. data/app/models/maquina/membership.rb +10 -0
  16. data/app/models/maquina/organization.rb +7 -0
  17. data/app/models/maquina/plan.rb +2 -0
  18. data/app/models/maquina/user.rb +8 -0
  19. data/app/policies/maquina/application_policy.rb +3 -6
  20. data/app/policies/maquina/navigation_policy.rb +2 -2
  21. data/app/policies/maquina/user_policy.rb +7 -3
  22. data/app/views/layouts/maquina/application.html.erb +1 -2
  23. data/app/views/layouts/maquina/sessions.html.erb +1 -2
  24. data/app/views/maquina/application/components/file_component.rb +38 -5
  25. data/app/views/maquina/application/form.rb +3 -2
  26. data/config/importmap.rb +12 -0
  27. data/db/migrate/20230829183530_create_maquina_organizations.rb +11 -0
  28. data/db/migrate/20230829192656_create_maquina_memberships.rb +15 -0
  29. data/lib/generators/maquina/tailwind_config/USAGE +14 -0
  30. data/lib/generators/maquina/tailwind_config/tailwind_config_generator.rb +17 -3
  31. data/lib/generators/maquina/tailwind_config/templates/app/assets/stylesheets/maquina.css +96 -0
  32. data/lib/generators/maquina/tailwind_config/templates/lib/generators/tailwind_config/tailwind_config_generator.rb.tt +11 -0
  33. data/lib/generators/maquina/tailwind_config/templates/{app/assets/config/maquina → lib/generators/tailwind_config/templates/config}/tailwind.config.js.tt +4 -0
  34. data/lib/generators/maquina/tailwind_config/templates/lib/tasks/tailwind.rake.tt +11 -0
  35. data/lib/maquina/engine.rb +0 -4
  36. data/lib/maquina/version.rb +1 -1
  37. data/lib/maquina.rb +7 -4
  38. metadata +22 -9
  39. data/config/definitions.rb +0 -1
  40. data/config/initializers/importmap.rb +0 -17
  41. data/lib/tasks/tailwind.rake +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5dffb067d8cdaf6d56c9777275907b321ec48188950945521a44d4d48fd92a2
4
- data.tar.gz: 28a3e313221bd3f2e465ba565e5e493ba3ccc419512c7f5f59d80353a0d45168
3
+ metadata.gz: 9a7e451e89b0cc87b356302a33dd2bf6e0ee95f3435f7f8161697e49cedac9bd
4
+ data.tar.gz: 4f9502c3d4d0a5ff9bd41769c542e277ec255e217370fac3dd00fafdb8cf7bc6
5
5
  SHA512:
6
- metadata.gz: 2b4517a5605cd8245948afec893c75b60fdc522d56982d76928726fdcf797e2552a026321f2e24d2ab8a7387e8de01158a10065300d4914f5d07cf4b1df0c3d7
7
- data.tar.gz: cb442f6712c58691771d8b01f99d22038c9491b92c5cf324860d5e250b692d749c67254184194de8d2b0132fb9339d32f17ebe6976c9eacd30a903a87bf098a7
6
+ metadata.gz: 0ecf0e0e1fead4ee3594ccb5d9991f7490ad6b8bad8cc6a76def65ccd4ad0ccea18f7b267d7d9dba11aaeb4ffa27463185cf57ade1fdd97e43f53261c55e5f71
7
+ data.tar.gz: dfb73cdf21f2d9761c0ff263c12015a11a9be2fc0a1c19e48ceaf17372356de6a877df4aeafe7bb75d60306d053e71c570ee22c3959a9c64e695b0b156274e5a
data/.overmind.env ADDED
@@ -0,0 +1 @@
1
+ OVERMIND_PROCFILE=Procfile.dev
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Specify your gem's dependencies in maquina.gemspec.
5
+ gemspec
6
+
7
+ gem "irb"
8
+ gem "pg"
9
+ gem "puma"
10
+ gem "propshaft"
11
+ gem "tailwindcss-rails"
12
+ gem "turbo-rails"
13
+
14
+ # Start debugger with binding.b [https://github.com/ruby/debug]
15
+ #
16
+ group :development do
17
+ gem "debug", ">= 1.0.0"
18
+ gem "letter_opener"
19
+ # gem "ruby-lsp", require: false
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,346 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ maquina (0.2.0)
5
+ action_policy (~> 0.6.3)
6
+ bcrypt (~> 3.1.7)
7
+ importmap-rails (~> 1.2.0)
8
+ money-rails (~> 1.15.0)
9
+ pagy (~> 5.10, >= 5.10.1)
10
+ pg_search (~> 2.3.0)
11
+ phlex-rails (~> 1.0.0)
12
+ rails (>= 7.0.4)
13
+ rotp (~> 6.2, >= 6.2.1)
14
+ stimulus-rails (~> 1.2.0)
15
+ tailwindcss-rails (~> 2.0.0)
16
+ turbo-rails (~> 1.3.0)
17
+
18
+ GEM
19
+ remote: https://rubygems.org/
20
+ specs:
21
+ action_policy (0.6.5)
22
+ ruby-next-core (>= 0.14.0)
23
+ actioncable (7.0.7.2)
24
+ actionpack (= 7.0.7.2)
25
+ activesupport (= 7.0.7.2)
26
+ nio4r (~> 2.0)
27
+ websocket-driver (>= 0.6.1)
28
+ actionmailbox (7.0.7.2)
29
+ actionpack (= 7.0.7.2)
30
+ activejob (= 7.0.7.2)
31
+ activerecord (= 7.0.7.2)
32
+ activestorage (= 7.0.7.2)
33
+ activesupport (= 7.0.7.2)
34
+ mail (>= 2.7.1)
35
+ net-imap
36
+ net-pop
37
+ net-smtp
38
+ actionmailer (7.0.7.2)
39
+ actionpack (= 7.0.7.2)
40
+ actionview (= 7.0.7.2)
41
+ activejob (= 7.0.7.2)
42
+ activesupport (= 7.0.7.2)
43
+ mail (~> 2.5, >= 2.5.4)
44
+ net-imap
45
+ net-pop
46
+ net-smtp
47
+ rails-dom-testing (~> 2.0)
48
+ actionpack (7.0.7.2)
49
+ actionview (= 7.0.7.2)
50
+ activesupport (= 7.0.7.2)
51
+ rack (~> 2.0, >= 2.2.4)
52
+ rack-test (>= 0.6.3)
53
+ rails-dom-testing (~> 2.0)
54
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
55
+ actiontext (7.0.7.2)
56
+ actionpack (= 7.0.7.2)
57
+ activerecord (= 7.0.7.2)
58
+ activestorage (= 7.0.7.2)
59
+ activesupport (= 7.0.7.2)
60
+ globalid (>= 0.6.0)
61
+ nokogiri (>= 1.8.5)
62
+ actionview (7.0.7.2)
63
+ activesupport (= 7.0.7.2)
64
+ builder (~> 3.1)
65
+ erubi (~> 1.4)
66
+ rails-dom-testing (~> 2.0)
67
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
68
+ activejob (7.0.7.2)
69
+ activesupport (= 7.0.7.2)
70
+ globalid (>= 0.3.6)
71
+ activemodel (7.0.7.2)
72
+ activesupport (= 7.0.7.2)
73
+ activerecord (7.0.7.2)
74
+ activemodel (= 7.0.7.2)
75
+ activesupport (= 7.0.7.2)
76
+ activestorage (7.0.7.2)
77
+ actionpack (= 7.0.7.2)
78
+ activejob (= 7.0.7.2)
79
+ activerecord (= 7.0.7.2)
80
+ activesupport (= 7.0.7.2)
81
+ marcel (~> 1.0)
82
+ mini_mime (>= 1.1.0)
83
+ activesupport (7.0.7.2)
84
+ concurrent-ruby (~> 1.0, >= 1.0.2)
85
+ i18n (>= 1.6, < 2)
86
+ minitest (>= 5.1)
87
+ tzinfo (~> 2.0)
88
+ addressable (2.8.5)
89
+ public_suffix (>= 2.0.2, < 6.0)
90
+ ast (2.4.2)
91
+ backport (1.2.0)
92
+ base64 (0.1.1)
93
+ bcrypt (3.1.19)
94
+ benchmark (0.2.1)
95
+ brakeman (6.0.1)
96
+ builder (3.2.4)
97
+ bundle-audit (0.1.0)
98
+ bundler-audit
99
+ bundler-audit (0.9.1)
100
+ bundler (>= 1.2.0, < 3)
101
+ thor (~> 1.0)
102
+ cgi (0.3.6)
103
+ concurrent-ruby (1.2.2)
104
+ crass (1.0.6)
105
+ date (3.3.3)
106
+ debug (1.8.0)
107
+ irb (>= 1.5.0)
108
+ reline (>= 0.3.1)
109
+ diff-lcs (1.5.0)
110
+ e2mmap (0.1.0)
111
+ erb (4.0.3)
112
+ cgi (>= 0.3.3)
113
+ erubi (1.12.0)
114
+ globalid (1.1.0)
115
+ activesupport (>= 5.0)
116
+ i18n (1.14.1)
117
+ concurrent-ruby (~> 1.0)
118
+ importmap-rails (1.2.1)
119
+ actionpack (>= 6.0.0)
120
+ railties (>= 6.0.0)
121
+ io-console (0.6.0)
122
+ irb (1.7.4)
123
+ reline (>= 0.3.6)
124
+ jaro_winkler (1.5.6)
125
+ json (2.6.3)
126
+ kramdown (2.4.0)
127
+ rexml
128
+ kramdown-parser-gfm (1.1.0)
129
+ kramdown (~> 2.0)
130
+ language_server-protocol (3.17.0.3)
131
+ launchy (2.5.2)
132
+ addressable (~> 2.8)
133
+ letter_opener (1.8.1)
134
+ launchy (>= 2.2, < 3)
135
+ lint_roller (1.1.0)
136
+ loofah (2.21.3)
137
+ crass (~> 1.0.2)
138
+ nokogiri (>= 1.12.0)
139
+ mail (2.8.1)
140
+ mini_mime (>= 0.1.1)
141
+ net-imap
142
+ net-pop
143
+ net-smtp
144
+ marcel (1.0.2)
145
+ method_source (1.0.0)
146
+ mini_mime (1.1.5)
147
+ minitest (5.19.0)
148
+ monetize (1.12.0)
149
+ money (~> 6.12)
150
+ money (6.16.0)
151
+ i18n (>= 0.6.4, <= 2)
152
+ money-rails (1.15.0)
153
+ activesupport (>= 3.0)
154
+ monetize (~> 1.9)
155
+ money (~> 6.13)
156
+ railties (>= 3.0)
157
+ net-imap (0.3.7)
158
+ date
159
+ net-protocol
160
+ net-pop (0.1.2)
161
+ net-protocol
162
+ net-protocol (0.2.1)
163
+ timeout
164
+ net-smtp (0.3.3)
165
+ net-protocol
166
+ nio4r (2.5.9)
167
+ nokogiri (1.15.4-arm64-darwin)
168
+ racc (~> 1.4)
169
+ pagy (5.10.1)
170
+ activesupport
171
+ parallel (1.23.0)
172
+ parser (3.2.2.3)
173
+ ast (~> 2.4.1)
174
+ racc
175
+ pg (1.5.3)
176
+ pg_search (2.3.6)
177
+ activerecord (>= 5.2)
178
+ activesupport (>= 5.2)
179
+ phlex (1.8.1)
180
+ concurrent-ruby (~> 1.2)
181
+ erb (>= 4)
182
+ zeitwerk (~> 2.6)
183
+ phlex-rails (1.0.0)
184
+ phlex (~> 1.7)
185
+ rails (>= 6.1, < 8)
186
+ zeitwerk (~> 2.6)
187
+ prettier_print (1.2.1)
188
+ propshaft (0.7.0)
189
+ actionpack (>= 7.0.0)
190
+ activesupport (>= 7.0.0)
191
+ rack
192
+ railties (>= 7.0.0)
193
+ public_suffix (5.0.3)
194
+ puma (6.3.1)
195
+ nio4r (~> 2.0)
196
+ racc (1.7.1)
197
+ rack (2.2.8)
198
+ rack-test (2.1.0)
199
+ rack (>= 1.3)
200
+ rails (7.0.7.2)
201
+ actioncable (= 7.0.7.2)
202
+ actionmailbox (= 7.0.7.2)
203
+ actionmailer (= 7.0.7.2)
204
+ actionpack (= 7.0.7.2)
205
+ actiontext (= 7.0.7.2)
206
+ actionview (= 7.0.7.2)
207
+ activejob (= 7.0.7.2)
208
+ activemodel (= 7.0.7.2)
209
+ activerecord (= 7.0.7.2)
210
+ activestorage (= 7.0.7.2)
211
+ activesupport (= 7.0.7.2)
212
+ bundler (>= 1.15.0)
213
+ railties (= 7.0.7.2)
214
+ rails-dom-testing (2.2.0)
215
+ activesupport (>= 5.0.0)
216
+ minitest
217
+ nokogiri (>= 1.6)
218
+ rails-html-sanitizer (1.6.0)
219
+ loofah (~> 2.21)
220
+ nokogiri (~> 1.14)
221
+ railties (7.0.7.2)
222
+ actionpack (= 7.0.7.2)
223
+ activesupport (= 7.0.7.2)
224
+ method_source
225
+ rake (>= 12.2)
226
+ thor (~> 1.0)
227
+ zeitwerk (~> 2.5)
228
+ rainbow (3.1.1)
229
+ rake (13.0.6)
230
+ rbs (2.8.4)
231
+ regexp_parser (2.8.1)
232
+ reline (0.3.8)
233
+ io-console (~> 0.5)
234
+ reverse_markdown (2.1.1)
235
+ nokogiri
236
+ rexml (3.2.6)
237
+ rotp (6.2.2)
238
+ rubocop (1.56.2)
239
+ base64 (~> 0.1.1)
240
+ json (~> 2.3)
241
+ language_server-protocol (>= 3.17.0)
242
+ parallel (~> 1.10)
243
+ parser (>= 3.2.2.3)
244
+ rainbow (>= 2.2.2, < 4.0)
245
+ regexp_parser (>= 1.8, < 3.0)
246
+ rexml (>= 3.2.5, < 4.0)
247
+ rubocop-ast (>= 1.28.1, < 2.0)
248
+ ruby-progressbar (~> 1.7)
249
+ unicode-display_width (>= 2.4.0, < 3.0)
250
+ rubocop-ast (1.29.0)
251
+ parser (>= 3.2.1.0)
252
+ rubocop-performance (1.19.0)
253
+ rubocop (>= 1.7.0, < 2.0)
254
+ rubocop-ast (>= 0.4.0)
255
+ rubocop-rails (2.19.1)
256
+ activesupport (>= 4.2.0)
257
+ rack (>= 1.1)
258
+ rubocop (>= 1.33.0, < 2.0)
259
+ ruby-lsp (0.9.2)
260
+ language_server-protocol (~> 3.17.0)
261
+ sorbet-runtime
262
+ syntax_tree (>= 6.1.1, < 7)
263
+ yarp (>= 0.9, < 0.10)
264
+ ruby-next-core (0.15.3)
265
+ ruby-progressbar (1.13.0)
266
+ solargraph (0.49.0)
267
+ backport (~> 1.2)
268
+ benchmark
269
+ bundler (~> 2.0)
270
+ diff-lcs (~> 1.4)
271
+ e2mmap
272
+ jaro_winkler (~> 1.5)
273
+ kramdown (~> 2.3)
274
+ kramdown-parser-gfm (~> 1.1)
275
+ parser (~> 3.0)
276
+ rbs (~> 2.0)
277
+ reverse_markdown (~> 2.0)
278
+ rubocop (~> 1.38)
279
+ thor (~> 1.0)
280
+ tilt (~> 2.0)
281
+ yard (~> 0.9, >= 0.9.24)
282
+ solargraph-rails (1.1.0)
283
+ activesupport
284
+ solargraph
285
+ sorbet-runtime (0.5.10990)
286
+ standard (1.31.0)
287
+ language_server-protocol (~> 3.17.0.2)
288
+ lint_roller (~> 1.0)
289
+ rubocop (~> 1.56.0)
290
+ standard-custom (~> 1.0.0)
291
+ standard-performance (~> 1.2)
292
+ standard-custom (1.0.2)
293
+ lint_roller (~> 1.0)
294
+ rubocop (~> 1.50)
295
+ standard-performance (1.2.0)
296
+ lint_roller (~> 1.1)
297
+ rubocop-performance (~> 1.19.0)
298
+ standard-rails (0.1.0)
299
+ lint_roller (~> 1.0)
300
+ rubocop-rails (~> 2.19.0)
301
+ stimulus-rails (1.2.2)
302
+ railties (>= 6.0.0)
303
+ syntax_tree (6.1.1)
304
+ prettier_print (>= 1.2.0)
305
+ tailwindcss-rails (2.0.30-arm64-darwin)
306
+ railties (>= 6.0.0)
307
+ thor (1.2.2)
308
+ tilt (2.2.0)
309
+ timeout (0.4.0)
310
+ turbo-rails (1.3.3)
311
+ actionpack (>= 6.0.0)
312
+ activejob (>= 6.0.0)
313
+ railties (>= 6.0.0)
314
+ tzinfo (2.0.6)
315
+ concurrent-ruby (~> 1.0)
316
+ unicode-display_width (2.4.2)
317
+ websocket-driver (0.7.6)
318
+ websocket-extensions (>= 0.1.0)
319
+ websocket-extensions (0.1.5)
320
+ yard (0.9.34)
321
+ yarp (0.9.0)
322
+ zeitwerk (2.6.11)
323
+
324
+ PLATFORMS
325
+ arm64-darwin-22
326
+
327
+ DEPENDENCIES
328
+ brakeman
329
+ bundle-audit
330
+ debug (>= 1.0.0)
331
+ irb
332
+ letter_opener
333
+ maquina!
334
+ pg
335
+ propshaft
336
+ puma
337
+ ruby-lsp
338
+ solargraph
339
+ solargraph-rails
340
+ standard
341
+ standard-rails
342
+ tailwindcss-rails
343
+ turbo-rails
344
+
345
+ BUNDLED WITH
346
+ 2.4.18
data/Procfile.dev ADDED
@@ -0,0 +1,3 @@
1
+ web: rails server -p 3100
2
+ # maquina_css: bin/rails app:maquina:tailwindcss:watch
3
+ css: bin/rails app:tailwindcss:watch
File without changes
@@ -2,7 +2,7 @@ import { Controller } from "@hotwired/stimulus"
2
2
 
3
3
  export default class extends Controller {
4
4
  static targets = ["fileInput", "container", "preview", "placeholder"]
5
- static values = { maxSize: Number, image: String, validationMessage: String }
5
+ static values = { maxSize: Number, image: String, validationMessage: String, url: String }
6
6
 
7
7
  connect() {
8
8
  if (this.hasFileInputTarget) {
@@ -3,100 +3,99 @@
3
3
  @tailwind utilities;
4
4
 
5
5
  /* @layer base { */
6
- :root {
7
- --color-base: 31 27 54;
8
- --color-accented: 37 99 235;
9
- --color-inverted: 255 255 255;
10
- --color-accented-hover: 59 130 246;
11
- --color-muted: 55 65 81;
12
- --color-dimmed: 75 85 99;
13
- --color-error: 220 38 38;
14
-
15
- --color-border-base: 209 213 219;
16
- --color-border-accented: 37 99 235;
17
- }
18
-
19
- .label {
20
- @apply text-sm font-medium text-skin-muted;
21
- }
22
-
23
- .input {
24
- @apply appearance-none rounded-md border border-skin-base px-3 py-2 placeholder-gray-400 shadow-sm focus:border-skin-accented focus:outline-none focus:ring-skin-accented sm:text-sm;
25
- }
26
-
27
- .link {
28
- @apply font-medium text-skin-accented hover:text-skin-accented-hover;
29
- }
30
-
31
- .check {
32
- @apply border-skin-base h-4 w-4 text-skin-accented focus:ring-skin-accented rounded;
33
- }
34
-
35
- .button {
36
- @apply inline-flex justify-center py-2 px-4 border border-skin-base rounded-md shadow-sm text-sm font-medium text-skin-muted bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-skin-accented;
37
- }
38
-
39
- .control-error .label {
40
- @apply text-skin-error;
41
- }
42
-
43
- .control-error .input {
44
- @apply border-skin-error focus:border-skin-error focus:ring-skin-error;
45
- }
46
-
47
- .help {
48
- @apply mt-2 text-sm text-skin-dimmed;
49
- }
50
-
51
- .help-error {
52
- @apply text-skin-error;
53
- }
54
-
55
- .button[disabled] {
56
- @apply bg-gray-50 text-skin-dimmed cursor-default;
57
- }
58
-
59
- .button-accented {
60
- @apply rounded-md border border-transparent bg-skin-accented py-2 px-4 text-sm font-medium text-skin-inverted shadow-sm hover:bg-skin-accented-hover focus:outline-none focus:ring-2 focus:ring-skin-accented focus:ring-offset-2;
61
- }
62
-
63
- input[type="search"] {
64
- @apply block w-full rounded-md border border-skin-base pl-10 leading-5 placeholder-gray-400 focus:placeholder-gray-300 focus:outline-none focus:ring-1 focus:ring-skin-accented focus:border-skin-accented sm:text-sm;
65
- }
66
-
67
- .desktop-menu {
68
- @apply hidden lg:ml-6 lg:flex lg:space-x-8;
69
- }
70
-
71
- .desktop-menu-item {
72
- @apply font-sans uppercase border-transparent text-skin-dimmed underline-offset-4 decoration-2 hover:underline hover:decoration-skin-accented hover:text-skin-muted inline-flex items-center px-1 pt-1 text-sm font-medium;
73
- }
74
-
75
- .desktop-menu-item__active {
76
- @apply decoration-skin-accented underline text-skin-base;
77
- }
78
-
79
- .mobile-menu {
80
- @apply pt-2 pb-3 space-y-1;
81
- }
82
-
83
- .mobile-menu-item {
84
- @apply font-sans border-transparent text-skin-dimmed hover:bg-gray-200 hover:border-gray-300 hover:text-skin-muted block pl-3 pr-4 py-2 border-l-4 text-base font-medium;
85
- }
86
-
87
- .mobile-menu-item__active {
88
- @apply bg-skin-accented-hover border-skin-accented text-skin-accented hover:text-skin-accented hover:bg-skin-accented-hover hover:border-skin-accented;
89
- }
90
-
91
- .desktop-profile-menu-item {
92
- @apply block w-full text-left font-sans px-4 py-2 text-sm text-skin-dimmed hover:bg-gray-200 hover:text-skin-muted;
93
- }
94
-
95
- .mobile-profile-menu-item {
96
- @apply block font-sans px-4 py-2 text-base font-medium text-skin-dimmed hover:text-skin-muted hover:bg-gray-200;
97
- }
98
-
99
- .mobile-button {
100
- @apply inline-flex items-center justify-center p-2 rounded-md text-skin-dimmed hover:text-skin-muted hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-skin-accented;
101
- }
102
- /* } */
6
+ :root {
7
+ --color-base: 31 27 54;
8
+ --color-accented: 37 99 235;
9
+ --color-inverted: 255 255 255;
10
+ --color-accented-hover: 59 130 246;
11
+ --color-muted: 55 65 81;
12
+ --color-dimmed: 75 85 99;
13
+ --color-error: 220 38 38;
14
+
15
+ --color-border-base: 209 213 219;
16
+ --color-border-accented: 37 99 235;
17
+ }
18
+
19
+ .label {
20
+ @apply text-sm font-medium text-skin-muted;
21
+ }
22
+
23
+ .input {
24
+ @apply appearance-none rounded-md border border-skin-base px-3 py-2 placeholder-gray-400 shadow-sm focus:border-skin-accented focus:outline-none focus:ring-skin-accented sm:text-sm;
25
+ }
26
+
27
+ .link {
28
+ @apply font-medium text-skin-accented hover:text-skin-accented-hover;
29
+ }
30
+
31
+ .check {
32
+ @apply border-skin-base h-4 w-4 text-skin-accented focus:ring-skin-accented rounded;
33
+ }
34
+
35
+ .button {
36
+ @apply inline-flex justify-center py-2 px-4 border border-skin-base rounded-md shadow-sm text-sm font-medium text-skin-muted bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-skin-accented;
37
+ }
38
+
39
+ .control-error .label {
40
+ @apply text-skin-error;
41
+ }
42
+
43
+ .control-error .input {
44
+ @apply border-skin-error focus:border-skin-error focus:ring-skin-error;
45
+ }
46
+
47
+ .help {
48
+ @apply mt-2 text-sm text-skin-dimmed;
49
+ }
50
+
51
+ .help-error {
52
+ @apply text-skin-error;
53
+ }
54
+
55
+ .button[disabled] {
56
+ @apply bg-gray-50 text-skin-dimmed cursor-default;
57
+ }
58
+
59
+ .button-accented {
60
+ @apply rounded-md border border-transparent bg-skin-accented py-2 px-4 text-sm font-medium text-skin-inverted shadow-sm hover:bg-skin-accented-hover focus:outline-none focus:ring-2 focus:ring-skin-accented focus:ring-offset-2;
61
+ }
62
+
63
+ input[type="search"] {
64
+ @apply block w-full rounded-md border border-skin-base pl-10 leading-5 placeholder-gray-400 focus:placeholder-gray-300 focus:outline-none focus:ring-1 focus:ring-skin-accented focus:border-skin-accented sm:text-sm;
65
+ }
66
+
67
+ .desktop-menu {
68
+ @apply hidden lg:ml-6 lg:flex lg:space-x-8;
69
+ }
70
+
71
+ .desktop-menu-item {
72
+ @apply font-sans uppercase border-transparent text-skin-dimmed underline-offset-4 decoration-2 hover:underline hover:decoration-skin-accented hover:text-skin-muted inline-flex items-center px-1 pt-1 text-sm font-medium;
73
+ }
74
+
75
+ .desktop-menu-item__active {
76
+ @apply decoration-skin-accented underline text-skin-base;
77
+ }
78
+
79
+ .mobile-menu {
80
+ @apply pt-2 pb-3 space-y-1;
81
+ }
82
+
83
+ .mobile-menu-item {
84
+ @apply font-sans border-transparent text-skin-dimmed hover:bg-gray-200 hover:border-gray-300 hover:text-skin-muted block pl-3 pr-4 py-2 border-l-4 text-base font-medium;
85
+ }
86
+
87
+ .mobile-menu-item__active {
88
+ @apply bg-skin-accented-hover border-skin-accented text-skin-accented hover:text-skin-accented hover:bg-skin-accented-hover hover:border-skin-accented;
89
+ }
90
+
91
+ .desktop-profile-menu-item {
92
+ @apply block w-full text-left font-sans px-4 py-2 text-sm text-skin-dimmed hover:bg-gray-200 hover:text-skin-muted;
93
+ }
94
+
95
+ .mobile-profile-menu-item {
96
+ @apply block font-sans px-4 py-2 text-base font-medium text-skin-dimmed hover:text-skin-muted hover:bg-gray-200;
97
+ }
98
+
99
+ .mobile-button {
100
+ @apply inline-flex items-center justify-center p-2 rounded-md text-skin-dimmed hover:text-skin-muted hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-skin-accented;
101
+ }
File without changes
@@ -32,7 +32,11 @@ module Maquina
32
32
  active_session_id = session["--active_session"]
33
33
  return if active_session_id.blank?
34
34
 
35
- active_session = ActiveSession.eager_load(:user).find_by(id: active_session_id)
35
+ active_session = ActiveSession.eager_load(user: {memberships: :organization})
36
+ .where(maquina_memberships: {blocked_at: nil})
37
+ .where(maquina_organizations: {active: true})
38
+ .find_by(id: active_session_id)
39
+
36
40
  return if active_session.blank?
37
41
 
38
42
  Maquina::Current.active_session = active_session
@@ -16,6 +16,7 @@ module Maquina
16
16
 
17
17
  included do
18
18
  class_attribute :resource_class, instance_writer: false
19
+ class_attribute :namespace, instance_writer: false
19
20
  class_attribute :find_by_param, instance_writer: false
20
21
  class_attribute :list_attributes, instance_writer: false
21
22
  class_attribute :form_attributes, instance_writer: false
@@ -28,18 +29,16 @@ module Maquina
28
29
 
29
30
  # Route proxies
30
31
 
32
+ def namespace_path
33
+ @namespace_path ||= namespace.present? ? "#{namespace&.to_s&.underscore}_" : ""
34
+ end
35
+
31
36
  def base_singular_path_name
32
- @base_path_name ||= begin
33
- namespace_path = ""
34
- "#{namespace_path}#{resource_class.model_name.singular_route_key}_path"
35
- end
37
+ @base_path_name ||= "#{namespace_path}#{resource_class.model_name.singular_route_key}_path"
36
38
  end
37
39
 
38
40
  def base_plural_path_name
39
- @base_plural_path_name ||= begin
40
- namespace_path = ""
41
- "#{namespace_path}#{resource_class.model_name.route_key}_path"
42
- end
41
+ @base_plural_path_name ||= "#{namespace_path}#{resource_class.model_name.route_key}_path"
43
42
  end
44
43
 
45
44
  def new_resource_path(options = {})
@@ -142,13 +141,14 @@ module Maquina
142
141
  end
143
142
 
144
143
  class_methods do
145
- def resourceful(resource_class: nil, find_by_param: :id, only: [], except: [], list_attributes: [], form_attributes: [], show_attributes: [], policy_class: nil)
144
+ def resourceful(resource_class: nil, namespace: nil, find_by_param: :id, only: [], except: [], list_attributes: [], form_attributes: [], show_attributes: [], policy_class: nil)
146
145
  self.resource_class = resource_class || controller_path.classify.safe_constantize
147
146
  self.find_by_param = find_by_param || :id
148
147
  self.list_attributes = Array(list_attributes).compact
149
148
  self.form_attributes = Array(form_attributes).compact
150
149
  self.show_attributes = Array(show_attributes).compact
151
150
  self.policy_class = policy_class
151
+ self.namespace = namespace
152
152
 
153
153
  valid_rest_actions = {
154
154
  index: Maquina::Index,
File without changes