kommandant 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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/kommandant.css +634 -0
  3. data/app/assets/stylesheets/kommandant/application.tailwind.css +3 -0
  4. data/app/controllers/concerns/kommandant/recent_commands.rb +21 -0
  5. data/app/controllers/kommandant/application_controller.rb +6 -1
  6. data/app/controllers/kommandant/commands/searches_controller.rb +40 -0
  7. data/app/controllers/kommandant/commands_controller.rb +17 -0
  8. data/app/controllers/kommandant/searches_controller.rb +14 -0
  9. data/app/models/kommandant/command.rb +88 -0
  10. data/app/models/kommandant/commands/search_result.rb +44 -0
  11. data/app/views/kommandant/commands/searches/show.html.erb +69 -0
  12. data/app/views/kommandant/commands/show.html.erb +20 -0
  13. data/app/views/kommandant/searches/index.html.erb +1 -0
  14. data/app/views/kommandant/searches/new.html.erb +1 -0
  15. data/app/views/kommandant/shared/_command_palette.html.erb +53 -0
  16. data/app/views/kommandant/shared/command_palette/_command.html.erb +14 -0
  17. data/app/views/kommandant/shared/command_palette/_default_state.html.erb +14 -0
  18. data/app/views/kommandant/shared/command_palette/_empty_state.html.erb +7 -0
  19. data/app/views/kommandant/shared/command_palette/_loading_message.html.erb +7 -0
  20. data/app/views/kommandant/shared/command_palette/_result.html.erb +6 -0
  21. data/app/views/kommandant/shared/icons/_chevron_right.html.erb +3 -0
  22. data/app/views/kommandant/shared/icons/_command.erb +7 -0
  23. data/app/views/kommandant/shared/icons/_search.erb +3 -0
  24. data/app/views/kommandant/shared/icons/_spinner.erb +4 -0
  25. data/config/locales/da.yml +19 -0
  26. data/config/locales/en.yml +19 -0
  27. data/config/routes.rb +4 -0
  28. data/lib/kommandant/engine.rb +7 -0
  29. data/lib/kommandant/version.rb +1 -1
  30. data/lib/kommandant.rb +21 -1
  31. metadata +89 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bf69d2014f01435b3baa892a9c694bca2f6ea5c21c0b07a403d96030cf3a3b9
4
- data.tar.gz: 88e0fd8a46666c0f513ee37ff355c74cd6aa01a44ec95614c7fa25a86e1f7609
3
+ metadata.gz: 8b3c12cb6c51778cd6575684e3c818960bc1db275aa4f2f5bc4bf1c39c0c57f6
4
+ data.tar.gz: 7cbc64969033ebf7170bce6e65fe414db2c2b9e4ccff31f645f6f385b20c27d5
5
5
  SHA512:
6
- metadata.gz: 93522bb9053b00126c0efdb6ecda19065a23a812267b2a06851764c9821529182534ef02e611d32dfa850e5b64c5a3030e4dbe4a9e4d28f43ede4f9e8a03cdb4
7
- data.tar.gz: 5738198edafbcd89717bbc59f02ec25b89340fc36e5a19924e61ec174ef1dd6687bc788ee11a6b9abb332226d1472b7ca7b5ef9f50610e96932597b99c77ffcb
6
+ metadata.gz: 4cf20342a6a8a5520652fa2949dea0aef98556c052db6c05ee59cb7203bd192dc7a60020af8e7193857efbbf3d545ad42f2dd1f8fe29d9cbf43b269f02bdf78b
7
+ data.tar.gz: 63115cdca2ea3fced0cb93466fd5a6941ed3bf3033fc82a0e03afa695b4be80c05b73ef13216d398a9e61bf606346dfbede225d233a3e30dd90f7213a5629ef9
@@ -0,0 +1,634 @@
1
+ .kommandant-pointer-events-none {
2
+ pointer-events: none;
3
+ }
4
+
5
+ .kommandant-fixed {
6
+ position: fixed;
7
+ }
8
+
9
+ .kommandant-absolute {
10
+ position: absolute;
11
+ }
12
+
13
+ .kommandant-relative {
14
+ position: relative;
15
+ }
16
+
17
+ .kommandant-inset-0 {
18
+ inset: 0px;
19
+ }
20
+
21
+ .kommandant-left-4 {
22
+ left: 1rem;
23
+ }
24
+
25
+ .kommandant-top-3 {
26
+ top: 0.75rem;
27
+ }
28
+
29
+ .kommandant-z-10 {
30
+ z-index: 10;
31
+ }
32
+
33
+ .kommandant-z-50 {
34
+ z-index: 50;
35
+ }
36
+
37
+ .kommandant-mx-auto {
38
+ margin-left: auto;
39
+ margin-right: auto;
40
+ }
41
+
42
+ .kommandant-mb-2 {
43
+ margin-bottom: 0.5rem;
44
+ }
45
+
46
+ .kommandant-ml-3 {
47
+ margin-left: 0.75rem;
48
+ }
49
+
50
+ .kommandant-mt-4 {
51
+ margin-top: 1rem;
52
+ }
53
+
54
+ .kommandant-flex {
55
+ display: flex;
56
+ }
57
+
58
+ .kommandant-inline-flex {
59
+ display: inline-flex;
60
+ }
61
+
62
+ .kommandant-hidden {
63
+ display: none;
64
+ }
65
+
66
+ .kommandant-h-10 {
67
+ height: 2.5rem;
68
+ }
69
+
70
+ .kommandant-h-12 {
71
+ height: 3rem;
72
+ }
73
+
74
+ .kommandant-h-5 {
75
+ height: 1.25rem;
76
+ }
77
+
78
+ .kommandant-h-6 {
79
+ height: 1.5rem;
80
+ }
81
+
82
+ .kommandant-max-h-80 {
83
+ max-height: 20rem;
84
+ }
85
+
86
+ .kommandant-max-h-96 {
87
+ max-height: 24rem;
88
+ }
89
+
90
+ .kommandant-w-10 {
91
+ width: 2.5rem;
92
+ }
93
+
94
+ .kommandant-w-5 {
95
+ width: 1.25rem;
96
+ }
97
+
98
+ .kommandant-w-6 {
99
+ width: 1.5rem;
100
+ }
101
+
102
+ .kommandant-w-full {
103
+ width: 100%;
104
+ }
105
+
106
+ .kommandant-max-w-2xl {
107
+ max-width: 42rem;
108
+ }
109
+
110
+ .kommandant-flex-auto {
111
+ flex: 1 1 auto;
112
+ }
113
+
114
+ .kommandant-flex-none {
115
+ flex: none;
116
+ }
117
+
118
+ .kommandant-flex-shrink-0 {
119
+ flex-shrink: 0;
120
+ }
121
+
122
+ .kommandant-flex-grow {
123
+ flex-grow: 1;
124
+ }
125
+
126
+ .kommandant-scale-100 {
127
+ --tw-scale-x: 1;
128
+ --tw-scale-y: 1;
129
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
130
+ }
131
+
132
+ .kommandant-scale-95 {
133
+ --tw-scale-x: .95;
134
+ --tw-scale-y: .95;
135
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
136
+ }
137
+
138
+ .kommandant-transform {
139
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
140
+ }
141
+
142
+ @keyframes kommandant-spin {
143
+ to {
144
+ transform: rotate(360deg);
145
+ }
146
+ }
147
+
148
+ .kommandant-animate-spin {
149
+ animation: kommandant-spin 1s linear infinite;
150
+ }
151
+
152
+ .kommandant-cursor-default {
153
+ cursor: default;
154
+ }
155
+
156
+ .kommandant-select-none {
157
+ -webkit-user-select: none;
158
+ -moz-user-select: none;
159
+ user-select: none;
160
+ }
161
+
162
+ .kommandant-scroll-py-2 {
163
+ scroll-padding-top: 0.5rem;
164
+ scroll-padding-bottom: 0.5rem;
165
+ }
166
+
167
+ .kommandant-flex-wrap {
168
+ flex-wrap: wrap;
169
+ }
170
+
171
+ .kommandant-items-center {
172
+ align-items: center;
173
+ }
174
+
175
+ .kommandant-items-baseline {
176
+ align-items: baseline;
177
+ }
178
+
179
+ .kommandant-justify-end {
180
+ justify-content: flex-end;
181
+ }
182
+
183
+ .kommandant-justify-center {
184
+ justify-content: center;
185
+ }
186
+
187
+ .kommandant-justify-between {
188
+ justify-content: space-between;
189
+ }
190
+
191
+ .kommandant-space-x-1> :not([hidden])~ :not([hidden]) {
192
+ --tw-space-x-reverse: 0;
193
+ margin-right: calc(0.25rem * var(--tw-space-x-reverse));
194
+ margin-left: calc(0.25rem * calc(1 - var(--tw-space-x-reverse)));
195
+ }
196
+
197
+ .kommandant-space-x-2> :not([hidden])~ :not([hidden]) {
198
+ --tw-space-x-reverse: 0;
199
+ margin-right: calc(0.5rem * var(--tw-space-x-reverse));
200
+ margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
201
+ }
202
+
203
+ .kommandant-space-x-4> :not([hidden])~ :not([hidden]) {
204
+ --tw-space-x-reverse: 0;
205
+ margin-right: calc(1rem * var(--tw-space-x-reverse));
206
+ margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse)));
207
+ }
208
+
209
+ .kommandant-divide-x> :not([hidden])~ :not([hidden]) {
210
+ --tw-divide-x-reverse: 0;
211
+ border-right-width: calc(1px * var(--tw-divide-x-reverse));
212
+ border-left-width: calc(1px * calc(1 - var(--tw-divide-x-reverse)));
213
+ }
214
+
215
+ .kommandant-divide-y> :not([hidden])~ :not([hidden]) {
216
+ --tw-divide-y-reverse: 0;
217
+ border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
218
+ border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
219
+ }
220
+
221
+ .kommandant-divide-gray-100> :not([hidden])~ :not([hidden]) {
222
+ --tw-divide-opacity: 1;
223
+ border-color: rgb(243 244 246 / var(--tw-divide-opacity));
224
+ }
225
+
226
+ .kommandant-overflow-hidden {
227
+ overflow: hidden;
228
+ }
229
+
230
+ .kommandant-overflow-y-auto {
231
+ overflow-y: auto;
232
+ }
233
+
234
+ .kommandant-truncate {
235
+ overflow: hidden;
236
+ text-overflow: ellipsis;
237
+ white-space: nowrap;
238
+ }
239
+
240
+ .kommandant-rounded {
241
+ border-radius: 0.25rem;
242
+ }
243
+
244
+ .kommandant-rounded-full {
245
+ border-radius: 9999px;
246
+ }
247
+
248
+ .kommandant-rounded-md {
249
+ border-radius: 0.375rem;
250
+ }
251
+
252
+ .kommandant-rounded-xl {
253
+ border-radius: 0.75rem;
254
+ }
255
+
256
+ .kommandant-border {
257
+ border-width: 1px;
258
+ }
259
+
260
+ .kommandant-border-0 {
261
+ border-width: 0px;
262
+ }
263
+
264
+ .kommandant-border-gray-300 {
265
+ --tw-border-opacity: 1;
266
+ border-color: rgb(209 213 219 / var(--tw-border-opacity));
267
+ }
268
+
269
+ .kommandant-border-gray-400 {
270
+ --tw-border-opacity: 1;
271
+ border-color: rgb(156 163 175 / var(--tw-border-opacity));
272
+ }
273
+
274
+ .kommandant-bg-gray-50 {
275
+ --tw-bg-opacity: 1;
276
+ background-color: rgb(249 250 251 / var(--tw-bg-opacity));
277
+ }
278
+
279
+ .kommandant-bg-gray-500 {
280
+ --tw-bg-opacity: 1;
281
+ background-color: rgb(107 114 128 / var(--tw-bg-opacity));
282
+ }
283
+
284
+ .kommandant-bg-slate-700 {
285
+ --tw-bg-opacity: 1;
286
+ background-color: rgb(51 65 85 / var(--tw-bg-opacity));
287
+ }
288
+
289
+ .kommandant-bg-transparent {
290
+ background-color: transparent;
291
+ }
292
+
293
+ .kommandant-bg-white {
294
+ --tw-bg-opacity: 1;
295
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
296
+ }
297
+
298
+ .kommandant-bg-opacity-25 {
299
+ --tw-bg-opacity: 0.25;
300
+ }
301
+
302
+ .kommandant-p-2 {
303
+ padding: 0.5rem;
304
+ }
305
+
306
+ .kommandant-p-4 {
307
+ padding: 1rem;
308
+ }
309
+
310
+ .kommandant-px-1 {
311
+ padding-left: 0.25rem;
312
+ padding-right: 0.25rem;
313
+ }
314
+
315
+ .kommandant-px-2 {
316
+ padding-left: 0.5rem;
317
+ padding-right: 0.5rem;
318
+ }
319
+
320
+ .kommandant-px-2\.5 {
321
+ padding-left: 0.625rem;
322
+ padding-right: 0.625rem;
323
+ }
324
+
325
+ .kommandant-px-3 {
326
+ padding-left: 0.75rem;
327
+ padding-right: 0.75rem;
328
+ }
329
+
330
+ .kommandant-px-4 {
331
+ padding-left: 1rem;
332
+ padding-right: 1rem;
333
+ }
334
+
335
+ .kommandant-px-6 {
336
+ padding-left: 1.5rem;
337
+ padding-right: 1.5rem;
338
+ }
339
+
340
+ .kommandant-py-0 {
341
+ padding-top: 0px;
342
+ padding-bottom: 0px;
343
+ }
344
+
345
+ .kommandant-py-0\.5 {
346
+ padding-top: 0.125rem;
347
+ padding-bottom: 0.125rem;
348
+ }
349
+
350
+ .kommandant-py-1 {
351
+ padding-top: 0.25rem;
352
+ padding-bottom: 0.25rem;
353
+ }
354
+
355
+ .kommandant-py-1\.5 {
356
+ padding-top: 0.375rem;
357
+ padding-bottom: 0.375rem;
358
+ }
359
+
360
+ .kommandant-py-14 {
361
+ padding-top: 3.5rem;
362
+ padding-bottom: 3.5rem;
363
+ }
364
+
365
+ .kommandant-py-2 {
366
+ padding-top: 0.5rem;
367
+ padding-bottom: 0.5rem;
368
+ }
369
+
370
+ .kommandant-py-2\.5 {
371
+ padding-top: 0.625rem;
372
+ padding-bottom: 0.625rem;
373
+ }
374
+
375
+ .kommandant-pl-1 {
376
+ padding-left: 0.25rem;
377
+ }
378
+
379
+ .kommandant-pl-11 {
380
+ padding-left: 2.75rem;
381
+ }
382
+
383
+ .kommandant-pl-2 {
384
+ padding-left: 0.5rem;
385
+ }
386
+
387
+ .kommandant-pr-2 {
388
+ padding-right: 0.5rem;
389
+ }
390
+
391
+ .kommandant-pr-4 {
392
+ padding-right: 1rem;
393
+ }
394
+
395
+ .kommandant-text-center {
396
+ text-align: center;
397
+ }
398
+
399
+ .kommandant-text-sm {
400
+ font-size: 0.875rem;
401
+ line-height: 1.25rem;
402
+ }
403
+
404
+ .kommandant-text-xs {
405
+ font-size: 0.75rem;
406
+ line-height: 1rem;
407
+ }
408
+
409
+ .kommandant-font-medium {
410
+ font-weight: 500;
411
+ }
412
+
413
+ .kommandant-font-semibold {
414
+ font-weight: 600;
415
+ }
416
+
417
+ .kommandant-leading-5 {
418
+ line-height: 1.25rem;
419
+ }
420
+
421
+ .kommandant-text-gray-400 {
422
+ --tw-text-opacity: 1;
423
+ color: rgb(156 163 175 / var(--tw-text-opacity));
424
+ }
425
+
426
+ .kommandant-text-gray-500 {
427
+ --tw-text-opacity: 1;
428
+ color: rgb(107 114 128 / var(--tw-text-opacity));
429
+ }
430
+
431
+ .kommandant-text-gray-600 {
432
+ --tw-text-opacity: 1;
433
+ color: rgb(75 85 99 / var(--tw-text-opacity));
434
+ }
435
+
436
+ .kommandant-text-gray-700 {
437
+ --tw-text-opacity: 1;
438
+ color: rgb(55 65 81 / var(--tw-text-opacity));
439
+ }
440
+
441
+ .kommandant-text-gray-800 {
442
+ --tw-text-opacity: 1;
443
+ color: rgb(31 41 55 / var(--tw-text-opacity));
444
+ }
445
+
446
+ .kommandant-text-gray-900 {
447
+ --tw-text-opacity: 1;
448
+ color: rgb(17 24 39 / var(--tw-text-opacity));
449
+ }
450
+
451
+ .kommandant-text-indigo-100 {
452
+ --tw-text-opacity: 1;
453
+ color: rgb(224 231 255 / var(--tw-text-opacity));
454
+ }
455
+
456
+ .kommandant-text-white {
457
+ --tw-text-opacity: 1;
458
+ color: rgb(255 255 255 / var(--tw-text-opacity));
459
+ }
460
+
461
+ .kommandant-placeholder-gray-400::-moz-placeholder {
462
+ --tw-placeholder-opacity: 1;
463
+ color: rgb(156 163 175 / var(--tw-placeholder-opacity));
464
+ }
465
+
466
+ .kommandant-placeholder-gray-400::placeholder {
467
+ --tw-placeholder-opacity: 1;
468
+ color: rgb(156 163 175 / var(--tw-placeholder-opacity));
469
+ }
470
+
471
+ .kommandant-opacity-0 {
472
+ opacity: 0;
473
+ }
474
+
475
+ .kommandant-opacity-100 {
476
+ opacity: 1;
477
+ }
478
+
479
+ .kommandant-opacity-25 {
480
+ opacity: 0.25;
481
+ }
482
+
483
+ .kommandant-opacity-75 {
484
+ opacity: 0.75;
485
+ }
486
+
487
+ .kommandant-shadow-2xl {
488
+ --tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
489
+ --tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
490
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
491
+ }
492
+
493
+ .kommandant-shadow-sm {
494
+ --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
495
+ --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
496
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
497
+ }
498
+
499
+ .kommandant-ring-1 {
500
+ --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
501
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
502
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
503
+ }
504
+
505
+ .kommandant-ring-black {
506
+ --tw-ring-opacity: 1;
507
+ --tw-ring-color: rgb(0 0 0 / var(--tw-ring-opacity));
508
+ }
509
+
510
+ .kommandant-ring-opacity-5 {
511
+ --tw-ring-opacity: 0.05;
512
+ }
513
+
514
+ .kommandant-transition-all {
515
+ transition-property: all;
516
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
517
+ transition-duration: 150ms;
518
+ }
519
+
520
+ .kommandant-transition-opacity {
521
+ transition-property: opacity;
522
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
523
+ transition-duration: 150ms;
524
+ }
525
+
526
+ .kommandant-duration-200 {
527
+ transition-duration: 200ms;
528
+ }
529
+
530
+ .kommandant-duration-300 {
531
+ transition-duration: 300ms;
532
+ }
533
+
534
+ .kommandant-ease-in {
535
+ transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
536
+ }
537
+
538
+ .kommandant-ease-out {
539
+ transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
540
+ }
541
+
542
+ .hover\:kommandant-cursor-pointer:hover {
543
+ cursor: pointer;
544
+ }
545
+
546
+ .hover\:kommandant-bg-gray-50:hover {
547
+ --tw-bg-opacity: 1;
548
+ background-color: rgb(249 250 251 / var(--tw-bg-opacity));
549
+ }
550
+
551
+ .hover\:kommandant-text-gray-800:hover {
552
+ --tw-text-opacity: 1;
553
+ color: rgb(31 41 55 / var(--tw-text-opacity));
554
+ }
555
+
556
+ .focus\:kommandant-outline-none:focus {
557
+ outline: 2px solid transparent;
558
+ outline-offset: 2px;
559
+ }
560
+
561
+ .focus\:kommandant-ring-0:focus {
562
+ --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
563
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
564
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
565
+ }
566
+
567
+ .focus\:kommandant-ring-2:focus {
568
+ --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
569
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
570
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
571
+ }
572
+
573
+ .focus\:kommandant-ring-gray-500:focus {
574
+ --tw-ring-opacity: 1;
575
+ --tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity));
576
+ }
577
+
578
+ .focus\:kommandant-ring-offset-2:focus {
579
+ --tw-ring-offset-width: 2px;
580
+ }
581
+
582
+ .disabled\:kommandant-cursor-not-allowed:disabled {
583
+ cursor: not-allowed;
584
+ }
585
+
586
+ .disabled\:kommandant-opacity-50:disabled {
587
+ opacity: 0.5;
588
+ }
589
+
590
+ .data-\[active\=true\]\:kommandant-bg-slate-600[data-active=true] {
591
+ --tw-bg-opacity: 1;
592
+ background-color: rgb(71 85 105 / var(--tw-bg-opacity));
593
+ }
594
+
595
+ .data-\[active\=true\]\:kommandant-text-white[data-active=true] {
596
+ --tw-text-opacity: 1;
597
+ color: rgb(255 255 255 / var(--tw-text-opacity));
598
+ }
599
+
600
+ .kommandant-group[data-active=true] .group-data-\[active\=true\]\:kommandant-inline {
601
+ display: inline;
602
+ }
603
+
604
+ .kommandant-group[data-active=true] .group-data-\[active\=true\]\:kommandant-text-white {
605
+ --tw-text-opacity: 1;
606
+ color: rgb(255 255 255 / var(--tw-text-opacity));
607
+ }
608
+
609
+ .kommandant-group[data-active=true] .group-data-\[active\=true\]\:kommandant-outline-none {
610
+ outline: 2px solid transparent;
611
+ outline-offset: 2px;
612
+ }
613
+
614
+ @media (min-width: 640px) {
615
+ .sm\:kommandant-p-6 {
616
+ padding: 1.5rem;
617
+ }
618
+
619
+ .sm\:kommandant-px-14 {
620
+ padding-left: 3.5rem;
621
+ padding-right: 3.5rem;
622
+ }
623
+
624
+ .sm\:kommandant-text-sm {
625
+ font-size: 0.875rem;
626
+ line-height: 1.25rem;
627
+ }
628
+ }
629
+
630
+ @media (min-width: 768px) {
631
+ .md\:kommandant-p-20 {
632
+ padding: 5rem;
633
+ }
634
+ }
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,21 @@
1
+ module Kommandant::RecentCommands
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ before_action :set_recent_commands
6
+ end
7
+
8
+ def set_recent_commands
9
+ return unless current_user.present?
10
+
11
+ if current_user.recent_commands.elements.any?
12
+ @recent_commands ||= current_user.recent_commands.elements.map do |command_id|
13
+ Kommandant::Command.find(command_id)
14
+ end
15
+ else
16
+ Kommandant::Command.all.each do |command|
17
+ current_user.recent_commands << command.id
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,4 +1,9 @@
1
1
  module Kommandant
2
- class ApplicationController < ActionController::Base
2
+ class ApplicationController < Kommandant.config.parent_controller.constantize
3
+ layout false
4
+
5
+ private
6
+
7
+ alias_method :current_user, Kommandant.config.current_user_method
3
8
  end
4
9
  end
@@ -0,0 +1,40 @@
1
+ class Kommandant::Commands::SearchesController < ApplicationController
2
+ include Kommandant.config.pagination.module.constantize if Kommandant.config.pagination.enabled
3
+
4
+ before_action :set_command
5
+
6
+ helper_method :partial_exists_for_result?
7
+
8
+ def show
9
+ @results = filtered_resources.map do |resource|
10
+ Kommandant::Commands::SearchResult.new(command: @command, resource: resource)
11
+ end
12
+
13
+ if Kommandant.config.pagination.enabled
14
+ @pagination, @results = Kommandant.config.pagination.pagination_lambda.call(@results, Kommandant.config.pagination.items_per_page, self)
15
+ @pagination_info_label = Kommandant.config.pagination.info_label_lambda.call(@pagination, self)
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def set_command
22
+ @command = Kommandant::Command.find(params[:command_id])
23
+ end
24
+
25
+ def filtered_resources
26
+ # Pagy would be most efficiently used on the output of the search method - but we need to check, that the user is
27
+ # actually allowed to view the resource
28
+ @resources ||= @command.resource_class.constantize.search(params[:query])
29
+
30
+ return @resources if Kommandant.config.search_result_filter_lambda.nil?
31
+
32
+ @resources.filter do |resource|
33
+ Kommandant.config.search_result_filter_lambda.call(current_ability, resource)
34
+ end
35
+ end
36
+
37
+ def partial_exists_for_result?(result)
38
+ lookup_context.exists?("kommandant/commands/#{result.resource.to_partial_path}", [], true)
39
+ end
40
+ end