maquina 0.2.5 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31ab94ae292dc94ebccc7ad33cd520b29a8bd945620f4d698239a6fec7a686a3
4
- data.tar.gz: ee06ac7e22a088a2386cf3ca2d6f83aa3d4cff47102c22efaa495b464ac2cf97
3
+ metadata.gz: ff7934937d226b48ad2b19332b6292ee45532039475cf4d7479f0f5500464239
4
+ data.tar.gz: d33cc955289dbb1336cdac3be95c9eea12f5e7f380c225f1503272766820e763
5
5
  SHA512:
6
- metadata.gz: 53eb9e8dee812c60f8c33c770dc8c0a6ad4543f55d29be3c3aa2613f166578392bab79b446e119e135f6a90f846d85ef84d39b23a820ae6cd80e3bcdf00939e7
7
- data.tar.gz: c62d7bec012895f8feca619c6c753e97e4cf27d4fcb3e1f58e79f1d14d403efd55ec4257fdda5d7f70cadc80b8c6acfef84f136fa3b93d902b1f56a5f6e2cb0e
6
+ metadata.gz: dd2f9053d11c84e30e64c62ccc48305449b66db8ccae4386c55d863734780f65e04490941e5fd25e805795472702543cc8624cb964f58d4ea027162d72371e58
7
+ data.tar.gz: 24035729ba026356996c0401e4e90f2ff99d3e5f4fd77f1731f393527b3558386872cbb82ac7aecb829ef37d8a5e8a06e573a16dca4d9ced50ddd45f94248f21
data/Gemfile.lock CHANGED
@@ -1,128 +1,143 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- maquina (0.2.5)
5
- action_policy (~> 0.6.3)
4
+ maquina (0.4.0)
5
+ action_policy (~> 0.6.0)
6
6
  bcrypt (~> 3.1.7)
7
7
  importmap-rails (~> 1.2.0)
8
8
  money-rails (~> 1.15.0)
9
- pagy (~> 5.10, >= 5.10.1)
9
+ pagy (~> 6.2)
10
10
  pg_search (~> 2.3.0)
11
- phlex-rails (~> 1.0.0)
11
+ phlex-rails (~> 1.1.0)
12
12
  rails (>= 7.0.4)
13
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)
14
+ stimulus-rails (~> 1.3.0)
15
+ tailwindcss-rails (~> 2.1.0)
16
+ turbo-rails (~> 1.5.0)
17
17
 
18
18
  GEM
19
19
  remote: https://rubygems.org/
20
20
  specs:
21
- action_policy (0.6.5)
21
+ action_policy (0.6.7)
22
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)
23
+ actioncable (7.1.2)
24
+ actionpack (= 7.1.2)
25
+ activesupport (= 7.1.2)
26
26
  nio4r (~> 2.0)
27
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)
28
+ zeitwerk (~> 2.6)
29
+ actionmailbox (7.1.2)
30
+ actionpack (= 7.1.2)
31
+ activejob (= 7.1.2)
32
+ activerecord (= 7.1.2)
33
+ activestorage (= 7.1.2)
34
+ activesupport (= 7.1.2)
34
35
  mail (>= 2.7.1)
35
36
  net-imap
36
37
  net-pop
37
38
  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)
39
+ actionmailer (7.1.2)
40
+ actionpack (= 7.1.2)
41
+ actionview (= 7.1.2)
42
+ activejob (= 7.1.2)
43
+ activesupport (= 7.1.2)
43
44
  mail (~> 2.5, >= 2.5.4)
44
45
  net-imap
45
46
  net-pop
46
47
  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)
48
+ rails-dom-testing (~> 2.2)
49
+ actionpack (7.1.2)
50
+ actionview (= 7.1.2)
51
+ activesupport (= 7.1.2)
52
+ nokogiri (>= 1.8.5)
53
+ racc
54
+ rack (>= 2.2.4)
55
+ rack-session (>= 1.0.1)
52
56
  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)
57
+ rails-dom-testing (~> 2.2)
58
+ rails-html-sanitizer (~> 1.6)
59
+ actiontext (7.1.2)
60
+ actionpack (= 7.1.2)
61
+ activerecord (= 7.1.2)
62
+ activestorage (= 7.1.2)
63
+ activesupport (= 7.1.2)
60
64
  globalid (>= 0.6.0)
61
65
  nokogiri (>= 1.8.5)
62
- actionview (7.0.7.2)
63
- activesupport (= 7.0.7.2)
66
+ actionview (7.1.2)
67
+ activesupport (= 7.1.2)
64
68
  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)
69
+ erubi (~> 1.11)
70
+ rails-dom-testing (~> 2.2)
71
+ rails-html-sanitizer (~> 1.6)
72
+ activejob (7.1.2)
73
+ activesupport (= 7.1.2)
70
74
  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)
75
+ activemodel (7.1.2)
76
+ activesupport (= 7.1.2)
77
+ activerecord (7.1.2)
78
+ activemodel (= 7.1.2)
79
+ activesupport (= 7.1.2)
80
+ timeout (>= 0.4.0)
81
+ activestorage (7.1.2)
82
+ actionpack (= 7.1.2)
83
+ activejob (= 7.1.2)
84
+ activerecord (= 7.1.2)
85
+ activesupport (= 7.1.2)
81
86
  marcel (~> 1.0)
82
- mini_mime (>= 1.1.0)
83
- activesupport (7.0.7.2)
87
+ activesupport (7.1.2)
88
+ base64
89
+ bigdecimal
84
90
  concurrent-ruby (~> 1.0, >= 1.0.2)
91
+ connection_pool (>= 2.2.5)
92
+ drb
85
93
  i18n (>= 1.6, < 2)
86
94
  minitest (>= 5.1)
95
+ mutex_m
87
96
  tzinfo (~> 2.0)
88
- addressable (2.8.5)
97
+ addressable (2.8.6)
89
98
  public_suffix (>= 2.0.2, < 6.0)
90
99
  ast (2.4.2)
91
100
  backport (1.2.0)
92
- base64 (0.1.1)
93
- bcrypt (3.1.19)
94
- benchmark (0.2.1)
95
- brakeman (6.0.1)
101
+ base64 (0.2.0)
102
+ bcrypt (3.1.20)
103
+ benchmark (0.3.0)
104
+ bigdecimal (3.1.5)
105
+ brakeman (6.1.0)
96
106
  builder (3.2.4)
97
107
  bundle-audit (0.1.0)
98
108
  bundler-audit
99
109
  bundler-audit (0.9.1)
100
110
  bundler (>= 1.2.0, < 3)
101
111
  thor (~> 1.0)
102
- cgi (0.3.6)
112
+ cgi (0.4.1)
103
113
  concurrent-ruby (1.2.2)
114
+ connection_pool (2.4.1)
104
115
  crass (1.0.6)
105
- date (3.3.3)
106
- debug (1.8.0)
107
- irb (>= 1.5.0)
108
- reline (>= 0.3.1)
116
+ date (3.3.4)
117
+ debug (1.9.0)
118
+ irb (~> 1.10)
119
+ reline (>= 0.3.8)
109
120
  diff-lcs (1.5.0)
121
+ drb (2.2.0)
122
+ ruby2_keywords
110
123
  e2mmap (0.1.0)
111
124
  erb (4.0.3)
112
125
  cgi (>= 0.3.3)
113
126
  erubi (1.12.0)
114
- globalid (1.1.0)
115
- activesupport (>= 5.0)
127
+ globalid (1.2.1)
128
+ activesupport (>= 6.1)
116
129
  i18n (1.14.1)
117
130
  concurrent-ruby (~> 1.0)
118
- importmap-rails (1.2.1)
131
+ importmap-rails (1.2.3)
119
132
  actionpack (>= 6.0.0)
133
+ activesupport (>= 6.0.0)
120
134
  railties (>= 6.0.0)
121
- io-console (0.6.0)
122
- irb (1.7.4)
123
- reline (>= 0.3.6)
135
+ io-console (0.7.1)
136
+ irb (1.10.1)
137
+ rdoc
138
+ reline (>= 0.3.8)
124
139
  jaro_winkler (1.5.6)
125
- json (2.6.3)
140
+ json (2.7.1)
126
141
  kramdown (2.4.0)
127
142
  rexml
128
143
  kramdown-parser-gfm (1.1.0)
@@ -133,7 +148,7 @@ GEM
133
148
  letter_opener (1.8.1)
134
149
  launchy (>= 2.2, < 3)
135
150
  lint_roller (1.1.0)
136
- loofah (2.21.3)
151
+ loofah (2.22.0)
137
152
  crass (~> 1.0.2)
138
153
  nokogiri (>= 1.12.0)
139
154
  mail (2.8.1)
@@ -142,9 +157,8 @@ GEM
142
157
  net-pop
143
158
  net-smtp
144
159
  marcel (1.0.2)
145
- method_source (1.0.0)
146
160
  mini_mime (1.1.5)
147
- minitest (5.19.0)
161
+ minitest (5.20.0)
148
162
  monetize (1.12.0)
149
163
  money (~> 6.12)
150
164
  money (6.16.0)
@@ -154,63 +168,70 @@ GEM
154
168
  monetize (~> 1.9)
155
169
  money (~> 6.13)
156
170
  railties (>= 3.0)
157
- net-imap (0.3.7)
171
+ mutex_m (0.2.0)
172
+ net-imap (0.4.8)
158
173
  date
159
174
  net-protocol
160
175
  net-pop (0.1.2)
161
176
  net-protocol
162
- net-protocol (0.2.1)
177
+ net-protocol (0.2.2)
163
178
  timeout
164
- net-smtp (0.3.3)
179
+ net-smtp (0.4.0)
165
180
  net-protocol
166
- nio4r (2.5.9)
167
- nokogiri (1.15.4-arm64-darwin)
181
+ nio4r (2.7.0)
182
+ nokogiri (1.15.5-arm64-darwin)
168
183
  racc (~> 1.4)
169
- pagy (5.10.1)
170
- activesupport
171
- parallel (1.23.0)
172
- parser (3.2.2.3)
184
+ pagy (6.2.0)
185
+ parallel (1.24.0)
186
+ parser (3.2.2.4)
173
187
  ast (~> 2.4.1)
174
188
  racc
175
- pg (1.5.3)
189
+ pg (1.5.4)
176
190
  pg_search (2.3.6)
177
191
  activerecord (>= 5.2)
178
192
  activesupport (>= 5.2)
179
- phlex (1.8.1)
193
+ phlex (1.9.0)
180
194
  concurrent-ruby (~> 1.2)
181
195
  erb (>= 4)
182
196
  zeitwerk (~> 2.6)
183
- phlex-rails (1.0.0)
184
- phlex (~> 1.7)
185
- rails (>= 6.1, < 8)
197
+ phlex-rails (1.1.1)
198
+ phlex (~> 1.9)
199
+ railties (>= 6.1, < 8)
186
200
  zeitwerk (~> 2.6)
187
- prettier_print (1.2.1)
188
- propshaft (0.7.0)
201
+ prism (0.19.0)
202
+ propshaft (0.8.0)
189
203
  actionpack (>= 7.0.0)
190
204
  activesupport (>= 7.0.0)
191
205
  rack
192
206
  railties (>= 7.0.0)
193
- public_suffix (5.0.3)
194
- puma (6.3.1)
207
+ psych (5.1.2)
208
+ stringio
209
+ public_suffix (5.0.4)
210
+ puma (6.4.0)
195
211
  nio4r (~> 2.0)
196
- racc (1.7.1)
197
- rack (2.2.8)
212
+ racc (1.7.3)
213
+ rack (3.0.8)
214
+ rack-session (2.0.0)
215
+ rack (>= 3.0.0)
198
216
  rack-test (2.1.0)
199
217
  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)
218
+ rackup (2.1.0)
219
+ rack (>= 3)
220
+ webrick (~> 1.8)
221
+ rails (7.1.2)
222
+ actioncable (= 7.1.2)
223
+ actionmailbox (= 7.1.2)
224
+ actionmailer (= 7.1.2)
225
+ actionpack (= 7.1.2)
226
+ actiontext (= 7.1.2)
227
+ actionview (= 7.1.2)
228
+ activejob (= 7.1.2)
229
+ activemodel (= 7.1.2)
230
+ activerecord (= 7.1.2)
231
+ activestorage (= 7.1.2)
232
+ activesupport (= 7.1.2)
212
233
  bundler (>= 1.15.0)
213
- railties (= 7.0.7.2)
234
+ railties (= 7.1.2)
214
235
  rails-dom-testing (2.2.0)
215
236
  activesupport (>= 5.0.0)
216
237
  minitest
@@ -218,52 +239,54 @@ GEM
218
239
  rails-html-sanitizer (1.6.0)
219
240
  loofah (~> 2.21)
220
241
  nokogiri (~> 1.14)
221
- railties (7.0.7.2)
222
- actionpack (= 7.0.7.2)
223
- activesupport (= 7.0.7.2)
224
- method_source
242
+ railties (7.1.2)
243
+ actionpack (= 7.1.2)
244
+ activesupport (= 7.1.2)
245
+ irb
246
+ rackup (>= 1.0.0)
225
247
  rake (>= 12.2)
226
- thor (~> 1.0)
227
- zeitwerk (~> 2.5)
248
+ thor (~> 1.0, >= 1.2.2)
249
+ zeitwerk (~> 2.6)
228
250
  rainbow (3.1.1)
229
- rake (13.0.6)
251
+ rake (13.1.0)
230
252
  rbs (2.8.4)
231
- regexp_parser (2.8.1)
232
- reline (0.3.8)
253
+ rdoc (6.6.2)
254
+ psych (>= 4.0.0)
255
+ regexp_parser (2.8.3)
256
+ reline (0.4.1)
233
257
  io-console (~> 0.5)
234
258
  reverse_markdown (2.1.1)
235
259
  nokogiri
236
260
  rexml (3.2.6)
237
- rotp (6.2.2)
238
- rubocop (1.56.2)
239
- base64 (~> 0.1.1)
261
+ rotp (6.3.0)
262
+ rubocop (1.57.2)
240
263
  json (~> 2.3)
241
264
  language_server-protocol (>= 3.17.0)
242
265
  parallel (~> 1.10)
243
- parser (>= 3.2.2.3)
266
+ parser (>= 3.2.2.4)
244
267
  rainbow (>= 2.2.2, < 4.0)
245
268
  regexp_parser (>= 1.8, < 3.0)
246
269
  rexml (>= 3.2.5, < 4.0)
247
270
  rubocop-ast (>= 1.28.1, < 2.0)
248
271
  ruby-progressbar (~> 1.7)
249
272
  unicode-display_width (>= 2.4.0, < 3.0)
250
- rubocop-ast (1.29.0)
273
+ rubocop-ast (1.30.0)
251
274
  parser (>= 3.2.1.0)
252
- rubocop-performance (1.19.0)
275
+ rubocop-performance (1.19.1)
253
276
  rubocop (>= 1.7.0, < 2.0)
254
277
  rubocop-ast (>= 0.4.0)
255
- rubocop-rails (2.19.1)
278
+ rubocop-rails (2.20.2)
256
279
  activesupport (>= 4.2.0)
257
280
  rack (>= 1.1)
258
281
  rubocop (>= 1.33.0, < 2.0)
259
- ruby-lsp (0.9.2)
282
+ ruby-lsp (0.13.2)
260
283
  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)
284
+ prism (>= 0.19.0, < 0.20)
285
+ sorbet-runtime (>= 0.5.5685)
286
+ ruby-next-core (1.0.0)
265
287
  ruby-progressbar (1.13.0)
266
- solargraph (0.49.0)
288
+ ruby2_keywords (0.0.5)
289
+ solargraph (0.50.0)
267
290
  backport (~> 1.2)
268
291
  benchmark
269
292
  bundler (~> 2.0)
@@ -282,44 +305,43 @@ GEM
282
305
  solargraph-rails (1.1.0)
283
306
  activesupport
284
307
  solargraph
285
- sorbet-runtime (0.5.10990)
286
- standard (1.31.0)
308
+ sorbet-runtime (0.5.11158)
309
+ standard (1.32.1)
287
310
  language_server-protocol (~> 3.17.0.2)
288
311
  lint_roller (~> 1.0)
289
- rubocop (~> 1.56.0)
312
+ rubocop (~> 1.57.2)
290
313
  standard-custom (~> 1.0.0)
291
314
  standard-performance (~> 1.2)
292
315
  standard-custom (1.0.2)
293
316
  lint_roller (~> 1.0)
294
317
  rubocop (~> 1.50)
295
- standard-performance (1.2.0)
318
+ standard-performance (1.2.1)
296
319
  lint_roller (~> 1.1)
297
- rubocop-performance (~> 1.19.0)
298
- standard-rails (0.1.0)
320
+ rubocop-performance (~> 1.19.1)
321
+ standard-rails (0.2.0)
299
322
  lint_roller (~> 1.0)
300
- rubocop-rails (~> 2.19.0)
301
- stimulus-rails (1.2.2)
323
+ rubocop-rails (~> 2.20.2)
324
+ stimulus-rails (1.3.0)
302
325
  railties (>= 6.0.0)
303
- syntax_tree (6.1.1)
304
- prettier_print (>= 1.2.0)
305
- tailwindcss-rails (2.0.30-arm64-darwin)
326
+ stringio (3.1.0)
327
+ tailwindcss-rails (2.1.0-arm64-darwin)
306
328
  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)
329
+ thor (1.3.0)
330
+ tilt (2.3.0)
331
+ timeout (0.4.1)
332
+ turbo-rails (1.5.0)
311
333
  actionpack (>= 6.0.0)
312
334
  activejob (>= 6.0.0)
313
335
  railties (>= 6.0.0)
314
336
  tzinfo (2.0.6)
315
337
  concurrent-ruby (~> 1.0)
316
- unicode-display_width (2.4.2)
338
+ unicode-display_width (2.5.0)
339
+ webrick (1.8.1)
317
340
  websocket-driver (0.7.6)
318
341
  websocket-extensions (>= 0.1.0)
319
342
  websocket-extensions (0.1.5)
320
343
  yard (0.9.34)
321
- yarp (0.9.0)
322
- zeitwerk (2.6.11)
344
+ zeitwerk (2.6.12)
323
345
 
324
346
  PLATFORMS
325
347
  arm64-darwin-22
@@ -343,4 +365,4 @@ DEPENDENCIES
343
365
  turbo-rails
344
366
 
345
367
  BUNDLED WITH
346
- 2.4.18
368
+ 2.5.1
@@ -14,6 +14,10 @@ module Maquina
14
14
  redirect_to maquina.new_sessions_path if !signed_in?
15
15
  end
16
16
 
17
+ def authenticate
18
+ load_session if Maquina::Current.active_session.blank?
19
+ end
20
+
17
21
  def signed_in?
18
22
  load_session if Maquina::Current.active_session.blank?
19
23
 
@@ -22,6 +22,7 @@ module Maquina
22
22
  class_attribute :form_attributes, instance_writer: false
23
23
  class_attribute :show_attributes, instance_writer: false
24
24
  class_attribute :policy_class, instance_writer: false
25
+ class_attribute :show_link, instance_writer: false
25
26
 
26
27
  attr_reader :resource, :collection
27
28
 
@@ -137,17 +138,18 @@ module Maquina
137
138
  end
138
139
 
139
140
  helper_method :resource_class, :policy_class, :resource, :list_attributes, :form_attributes, :collection,
140
- :collection_path, :resource_path, :new_resource_path, :edit_resource_path, :submit_path
141
+ :collection_path, :resource_path, :new_resource_path, :edit_resource_path, :submit_path, :show_link
141
142
  end
142
143
 
143
144
  class_methods do
144
- def resourceful(resource_class: nil, namespace: nil, find_by_param: :id, only: [], except: [], list_attributes: [], form_attributes: [], show_attributes: [], policy_class: nil)
145
+ def resourceful(resource_class: nil, namespace: nil, find_by_param: :id, only: [], except: [], list_attributes: [], form_attributes: [], show_attributes: [], policy_class: nil, show_link: nil)
145
146
  self.resource_class = resource_class || controller_path.classify.safe_constantize
146
147
  self.find_by_param = find_by_param || :id
147
148
  self.list_attributes = Array(list_attributes).compact
148
149
  self.form_attributes = Array(form_attributes).compact
149
150
  self.show_attributes = Array(show_attributes).compact
150
151
  self.policy_class = policy_class
152
+ self.show_link = show_link
151
153
  self.namespace = namespace
152
154
 
153
155
  valid_rest_actions = {
@@ -17,11 +17,11 @@ module Maquina
17
17
  def profile_menu_options
18
18
  if Maquina::Current.signed_in?
19
19
  {
20
- signout: {method: :delete, path: sessions_path}
20
+ signout: {method: :delete, path: maquina.sessions_path}
21
21
  }
22
22
  else
23
23
  {
24
- signin: new_sessions_path
24
+ signin: maquina.new_sessions_path
25
25
  }
26
26
  end
27
27
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Maquina
4
+ module OrganizationScoped
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ belongs_to :organization, class_name: "Maquina::Organization", foreign_key: :maquina_organization_id
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Maquina
4
+ module UserScoped
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ belongs_to :user, class_name: "Maquina::User", foreign_key: :maquina_user_id
9
+ end
10
+ end
11
+ end
@@ -43,5 +43,10 @@ module Maquina
43
43
  def admin?
44
44
  (Maquina::Current.membership.present? && Maquina::Current.membership.admin?)
45
45
  end
46
+
47
+ relation_scope do |scope|
48
+ Rails.logger.warn("This policy scope at #{self} is not scoping by User or Organization")
49
+ scope
50
+ end
46
51
  end
47
52
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Maquina
4
+ module Application
5
+ module Components
6
+ class DateComponent < ComponentBase
7
+ def template
8
+ div(**control_html) do
9
+ @form.label attribute_name, class: "label #{label_css_class}"
10
+ div(class: "mt-1") do
11
+ css_class = {
12
+ class: input_html.delete(:class) || ""
13
+ }
14
+ @form.date_select attribute_name, input_html, css_class
15
+ help_template
16
+ error_template
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Maquina
4
+ module Application
5
+ module Components
6
+ class TextAreaComponent < ComponentBase
7
+ def template
8
+ div(**control_html) do
9
+ @form.label attribute_name, class: "label #{label_css_class}"
10
+ div(class: "mt-1") do
11
+ @form.text_area attribute_name, **input_html
12
+ help_template
13
+ error_template
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -69,6 +69,12 @@ module Maquina
69
69
  render Maquina::Application::Components::ActionTextComponent.new(resource: @resource, form: form, options: attribute_values)
70
70
  when :select
71
71
  render Maquina::Application::Components::SelectComponent.new(resource: @resource, form: form, options: attribute_values)
72
+ when :date
73
+ render Maquina::Application::Components::DateComponent.new(resource: @resource, form: form, options: attribute_values)
74
+ when :text_area
75
+ render Maquina::Application::Components::TextAreaComponent.new(resource: @resource, form: form, options: attribute_values)
76
+ when :input
77
+ render Maquina::Application::Components::InputComponent.new(resource: @resource, form: form, options: attribute_values)
72
78
  else
73
79
  render Maquina::Application::Components::InputComponent.new(resource: @resource, form: form, options: attribute_values)
74
80
  end
@@ -5,7 +5,7 @@ module Maquina
5
5
  class IndexTable < Phlex::HTML
6
6
  include ApplicationView
7
7
 
8
- delegate :humanized_money_with_symbol, :edit_resource_path, to: :helpers
8
+ delegate :humanized_money_with_symbol, :edit_resource_path, :resource_path, to: :helpers
9
9
 
10
10
  def initialize(collection: nil, pagination: nil, list_attributes: nil)
11
11
  @collection = collection
@@ -69,7 +69,7 @@ module Maquina
69
69
 
70
70
  tr do
71
71
  @list_attributes.each_with_index do |attribute, index|
72
- td(class: (index == 0) ? first_css : base_css, scope: "col") { attribute_value(item, attribute) }
72
+ td(class: (index == 0) ? first_css : base_css, scope: "col") { attribute_to_link(item, attribute, attribute_value(item, attribute)) }
73
73
  end
74
74
  td(class: "relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6", scope: "col") do
75
75
  a(href: edit_resource_path(item), class: "text-skin-accented hover:text-skin-accented-hover") { t("index.edit") } if policy_class.blank? || allowed_to?(:edit?, item, with: policy_class)
@@ -116,6 +116,12 @@ module Maquina
116
116
  value
117
117
  end
118
118
  end
119
+
120
+ def attribute_to_link(item, attribute, value)
121
+ return value if show_link.nil? || show_link != attribute
122
+
123
+ link_to(value, resource_path(item), class: "link", data: {"turbo-frame": "_top"})
124
+ end
119
125
  end
120
126
  end
121
127
  end
@@ -5,7 +5,7 @@ module Maquina
5
5
  include Maquina::Engine.routes.url_helpers
6
6
  include Phlex::Rails::Helpers::T
7
7
 
8
- delegate :resource_class, :l, :default_url_options, :policy_class, :allowed_to?, to: :helpers
8
+ delegate :resource_class, :l, :default_url_options, :policy_class, :show_link, :allowed_to?, to: :helpers
9
9
 
10
10
  # TODO: Revisit this later
11
11
  def image_tag(source, options = {})
data/config/importmap.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
5
5
  pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
6
6
  pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
7
- pin "stimulus-use", to: "https://ga.jspm.io/npm:stimulus-use@0.52.0/dist/index.js"
7
+ pin "stimulus-use", to: "https://ga.jspm.io/npm:stimulus-use@0.52.2/dist/index.js"
8
8
 
9
9
  # Maquina entrypoint
10
10
  pin "application", to: "maquina/application.js", preload: true
@@ -0,0 +1,44 @@
1
+ es:
2
+ flash:
3
+ create:
4
+ notice:
5
+ title: Se creó con éxito
6
+ description: Tú registro fue creado
7
+ alert:
8
+ title: No se pudo crear
9
+ description: Revisa los mensajes del formulario para resolver el problema
10
+
11
+ update:
12
+ notice:
13
+ title: Se actualizó con éxito
14
+ description: Tú registros fue actualizado
15
+ alert:
16
+ title: No se pudo actualizar
17
+ description: Revisa los mensajes del formulario para resolver el problema
18
+
19
+ destroy:
20
+ notice:
21
+ title: Se eliminó con éxito
22
+ description: Tú registro fue eliminado
23
+ alert:
24
+ title: No se puedo eliminar
25
+ description: Revisa los mensajes del formulario para resolver el problema
26
+
27
+ maquina/invitation:
28
+ create:
29
+ notice:
30
+ title: Invitación enviada
31
+ description: La inivitación para %{email} expira en 3 días
32
+
33
+ sessions:
34
+ create:
35
+ notice:
36
+ title: Bievenido a la sesión
37
+ description: Tu sesión ha iniciado
38
+ alert:
39
+ title: No fue posible iniciar la sesión
40
+ description: El correo electrónico o la contraseña son inválidos
41
+ destroy:
42
+ notice:
43
+ title: Sesión terminada
44
+ description: Para continuar debes iniciar sesión
@@ -0,0 +1,58 @@
1
+ es:
2
+ new:
3
+ maquina/plan:
4
+ title: Configura el plan para los clientes
5
+ maquina/invitation:
6
+ title: Invitar a un usuario a colaborar
7
+ description: El usuario va a recibir la invitación para unirse a colaborar vía correo electrónico.
8
+
9
+ form:
10
+ sessions:
11
+ email: Correo electrónico
12
+ password: Contraseña
13
+ forgot_password: Olvidé mi contraseña
14
+ submit: Iniciar sesión
15
+
16
+ accept_invitations:
17
+ submit: Aceptar invitación
18
+
19
+ placeholder:
20
+ sessions:
21
+ email: user@mail.com
22
+ password: Contraseña actual
23
+
24
+ maquina/plan:
25
+ name: Plan básico
26
+
27
+ maquina/invitation:
28
+ email: Correo electrónico del usuario
29
+
30
+ help:
31
+ maquina/plan:
32
+ name: Nombre del plan
33
+ trial: Número de días de prueba
34
+ price: Precio del plan
35
+ free: Indica si el plan es gratuito
36
+ active: Activar plan para clientes
37
+
38
+ helpers:
39
+ cancel: Cancelar
40
+ submit:
41
+ maquina/plan:
42
+ create: Crear %{model}
43
+ update: Actualizar %{model}
44
+
45
+ maquina/invitation:
46
+ create: Enviar invitación
47
+
48
+ maxlength:
49
+ default: 30
50
+
51
+ maquina/plan:
52
+ name: 60
53
+ trial: 3
54
+ price: 9
55
+
56
+ sessions:
57
+ email: 60
58
+ password: 60
@@ -0,0 +1,38 @@
1
+ es:
2
+ activerecord:
3
+ models:
4
+ maquina/plan:
5
+ one: Plan
6
+ other: Planes
7
+ maquina/user:
8
+ one: Usuario
9
+ other: Usuarios
10
+ maquina/invitation:
11
+ one: Invitación
12
+ other: Invitaciones
13
+
14
+ attributes:
15
+ maquina/plan:
16
+ name: Nombre
17
+ trial: Prueba
18
+ price: Precio
19
+ free: Gratuito
20
+ active: Activo
21
+ maquina/user:
22
+ email: Correo electrónico
23
+ blocked_at: Bloqueado desde
24
+ created_at: Creado el
25
+ maquina/invitation:
26
+ email: Correo electrónico
27
+
28
+ errors:
29
+ models:
30
+ maquina/active_session:
31
+ attributes:
32
+ user:
33
+ blocked: cuenta bloqueada
34
+ maquina/invitation:
35
+ attributes:
36
+ email:
37
+ blank: se necesita el correo electrónico a enviar invitación
38
+ invalid: invitación ya aceptada
@@ -0,0 +1,7 @@
1
+ es:
2
+ routes:
3
+ plans: planes
4
+ users: usuarios
5
+ invitations: invitaciones
6
+ accept_invitation: aceptar_invitacion
7
+ sessions: sesiones
@@ -0,0 +1,44 @@
1
+ es:
2
+ application_name: maquina
3
+ yes_value: "Sí"
4
+ no_value: "No"
5
+
6
+ index:
7
+ add_new: Nuevo %{model}
8
+ no_items: No hay %{model} registrados
9
+ edit: Modificar
10
+
11
+ maquina/plan:
12
+ description: Listado de planes.
13
+ maquina/user:
14
+ add_new: Invitar %{model}
15
+ description: Listado de usuarios.
16
+
17
+ pagination:
18
+ next: Siguiente
19
+ previous: Previo
20
+ information: Mostrando %{count} registro(s). Desde %{from} hasta %{to}.
21
+
22
+ menu:
23
+ main:
24
+ plans: Planes
25
+ users: Usuarios
26
+ profile:
27
+ signout: Cerrar sesión
28
+ signin: Iniciar sesión
29
+
30
+ search:
31
+ search: Buscar
32
+
33
+ maquina:
34
+ sessions:
35
+ new:
36
+ title: Iniciar sesión a tu cuenta
37
+ or: O
38
+ trial: iniciar tu prueba
39
+
40
+ accept_invitations:
41
+ new:
42
+ title: Aceptar invitación
43
+ description: Aquí puedes aceptar la inivitación para colaborar con %{org}
44
+ expired: La invitación es inválida, expiró, o ya fue aceptada. Si crees que esto es incorrecto, por favor contacta a la persona que envió la invitación y solicita una nueva invitación.
@@ -1,3 +1,3 @@
1
1
  module Maquina
2
- VERSION = "0.2.5"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maquina
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Alberto Chávez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-06 00:00:00.000000000 Z
11
+ date: 2023-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.3.0
61
+ version: 1.5.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.3.0
68
+ version: 1.5.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: stimulus-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.2.0
75
+ version: 1.3.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.2.0
82
+ version: 1.3.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: importmap-rails
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 2.0.0
103
+ version: 2.1.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 2.0.0
110
+ version: 2.1.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pg_search
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.0.0
131
+ version: 1.1.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.0.0
138
+ version: 1.1.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: action_policy
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.6.3
145
+ version: 0.6.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.6.3
152
+ version: 0.6.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rotp
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -176,20 +176,14 @@ dependencies:
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '5.10'
180
- - - ">="
181
- - !ruby/object:Gem::Version
182
- version: 5.10.1
179
+ version: '6.2'
183
180
  type: :runtime
184
181
  prerelease: false
185
182
  version_requirements: !ruby/object:Gem::Requirement
186
183
  requirements:
187
184
  - - "~>"
188
185
  - !ruby/object:Gem::Version
189
- version: '5.10'
190
- - - ">="
191
- - !ruby/object:Gem::Version
192
- version: 5.10.1
186
+ version: '6.2'
193
187
  - !ruby/object:Gem::Dependency
194
188
  name: standard
195
189
  requirement: !ruby/object:Gem::Requirement
@@ -345,8 +339,10 @@ files:
345
339
  - app/models/concerns/maquina/authenticate_by.rb
346
340
  - app/models/concerns/maquina/blockeable.rb
347
341
  - app/models/concerns/maquina/multifactor.rb
342
+ - app/models/concerns/maquina/organization_scoped.rb
348
343
  - app/models/concerns/maquina/retain_passwords.rb
349
344
  - app/models/concerns/maquina/searchable.rb
345
+ - app/models/concerns/maquina/user_scoped.rb
350
346
  - app/models/maquina/active_session.rb
351
347
  - app/models/maquina/application_record.rb
352
348
  - app/models/maquina/current.rb
@@ -372,9 +368,11 @@ files:
372
368
  - app/views/maquina/application/components/action_text_component.rb
373
369
  - app/views/maquina/application/components/checkbox_component.rb
374
370
  - app/views/maquina/application/components/component_base.rb
371
+ - app/views/maquina/application/components/date_component.rb
375
372
  - app/views/maquina/application/components/file_component.rb
376
373
  - app/views/maquina/application/components/input_component.rb
377
374
  - app/views/maquina/application/components/select_component.rb
375
+ - app/views/maquina/application/components/text_area_component.rb
378
376
  - app/views/maquina/application/create.turbo_stream.erb
379
377
  - app/views/maquina/application/edit.html.erb
380
378
  - app/views/maquina/application/edit.rb
@@ -413,11 +411,16 @@ files:
413
411
  - config/initializers/money.rb
414
412
  - config/initializers/pagy.rb
415
413
  - config/locales/flash.en.yml
414
+ - config/locales/flash.es.yml
416
415
  - config/locales/forms.en.yml
416
+ - config/locales/forms.es.yml
417
417
  - config/locales/mailers.en.yml
418
418
  - config/locales/models.en.yml
419
+ - config/locales/models.es.yml
419
420
  - config/locales/routes.en.yml
421
+ - config/locales/routes.es.yml
420
422
  - config/locales/views.en.yml
423
+ - config/locales/views.es.yml
421
424
  - config/routes.rb
422
425
  - db/migrate/20221109010726_create_maquina_plans.rb
423
426
  - db/migrate/20221113000409_create_maquina_users.rb
@@ -463,7 +466,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
463
466
  - !ruby/object:Gem::Version
464
467
  version: '0'
465
468
  requirements: []
466
- rubygems_version: 3.4.19
469
+ rubygems_version: 3.5.1
467
470
  signing_key:
468
471
  specification_version: 4
469
472
  summary: Rails engine for building Rails applications.