panda-core 0.2.3 → 0.4.1

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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +185 -0
  3. data/app/assets/tailwind/application.css +279 -0
  4. data/app/assets/tailwind/tailwind.config.js +21 -0
  5. data/app/components/panda/core/UI/badge.rb +107 -0
  6. data/app/components/panda/core/UI/button.rb +89 -0
  7. data/app/components/panda/core/UI/card.rb +88 -0
  8. data/app/components/panda/core/admin/button_component.rb +46 -28
  9. data/app/components/panda/core/admin/container_component.rb +52 -4
  10. data/app/components/panda/core/admin/flash_message_component.rb +74 -9
  11. data/app/components/panda/core/admin/form_error_component.rb +48 -0
  12. data/app/components/panda/core/admin/form_input_component.rb +50 -0
  13. data/app/components/panda/core/admin/form_select_component.rb +68 -0
  14. data/app/components/panda/core/admin/heading_component.rb +52 -24
  15. data/app/components/panda/core/admin/panel_component.rb +33 -4
  16. data/app/components/panda/core/admin/slideover_component.rb +8 -4
  17. data/app/components/panda/core/admin/statistics_component.rb +19 -0
  18. data/app/components/panda/core/admin/tab_bar_component.rb +101 -0
  19. data/app/components/panda/core/admin/table_component.rb +90 -9
  20. data/app/components/panda/core/admin/tag_component.rb +21 -16
  21. data/app/components/panda/core/admin/user_activity_component.rb +43 -0
  22. data/app/components/panda/core/admin/user_display_component.rb +78 -0
  23. data/app/components/panda/core/base.rb +122 -0
  24. data/app/controllers/panda/core/admin/base_controller.rb +68 -0
  25. data/app/controllers/panda/core/admin/dashboard_controller.rb +7 -6
  26. data/app/controllers/panda/core/admin/my_profile_controller.rb +3 -3
  27. data/app/controllers/panda/core/admin/sessions_controller.rb +26 -5
  28. data/app/helpers/panda/core/sessions_helper.rb +21 -0
  29. data/app/javascript/panda/core/application.js +1 -0
  30. data/app/javascript/panda/core/vendor/@hotwired--stimulus.js +4 -0
  31. data/app/javascript/panda/core/vendor/@hotwired--turbo.js +160 -0
  32. data/app/javascript/panda/core/vendor/@rails--actioncable--src.js +4 -0
  33. data/app/models/panda/core/user.rb +17 -13
  34. data/app/views/layouts/panda/core/admin.html.erb +40 -57
  35. data/app/views/layouts/panda/core/admin_simple.html.erb +5 -0
  36. data/app/views/panda/core/admin/dashboard/_default_content.html.erb +73 -0
  37. data/app/views/panda/core/admin/dashboard/show.html.erb +4 -10
  38. data/app/views/panda/core/admin/my_profile/edit.html.erb +13 -27
  39. data/app/views/panda/core/admin/sessions/new.html.erb +13 -12
  40. data/app/views/panda/core/admin/shared/_breadcrumbs.html.erb +27 -34
  41. data/app/views/panda/core/admin/shared/_flash.html.erb +4 -30
  42. data/app/views/panda/core/admin/shared/_sidebar.html.erb +36 -20
  43. data/app/views/panda/core/shared/_footer.html.erb +2 -0
  44. data/app/views/panda/core/shared/_header.html.erb +19 -0
  45. data/config/importmap.rb +15 -0
  46. data/config/initializers/panda_core.rb +37 -1
  47. data/config/routes.rb +7 -7
  48. data/db/migrate/20250810120000_add_current_theme_to_panda_core_users.rb +7 -0
  49. data/lib/generators/panda/core/install_generator.rb +3 -9
  50. data/lib/generators/panda/core/templates/README +25 -0
  51. data/lib/generators/panda/core/templates/initializer.rb +28 -0
  52. data/lib/panda/core/asset_loader.rb +23 -8
  53. data/lib/panda/core/configuration.rb +41 -9
  54. data/lib/panda/core/debug.rb +47 -0
  55. data/lib/panda/core/engine.rb +82 -8
  56. data/lib/panda/core/version.rb +1 -1
  57. data/lib/panda/core.rb +1 -0
  58. data/lib/tasks/assets.rake +58 -392
  59. data/lib/tasks/panda_core_tasks.rake +16 -0
  60. metadata +102 -14
  61. data/app/components/panda/core/admin/container_component.html.erb +0 -12
  62. data/app/components/panda/core/admin/flash_message_component.html.erb +0 -31
  63. data/app/components/panda/core/admin/panel_component.html.erb +0 -7
  64. data/app/components/panda/core/admin/slideover_component.html.erb +0 -9
  65. data/app/components/panda/core/admin/table_component.html.erb +0 -29
  66. data/app/controllers/panda/core/admin_controller.rb +0 -28
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
- - Tasty Bamboo
7
+ - Otaina Limited
8
8
  - James Inman
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2025-09-01 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: importmap-rails
@@ -165,6 +164,62 @@ dependencies:
165
164
  - - ">="
166
165
  - !ruby/object:Gem::Version
167
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: phlex
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '2.3'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '2.3'
181
+ - !ruby/object:Gem::Dependency
182
+ name: phlex-rails
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '2.3'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '2.3'
195
+ - !ruby/object:Gem::Dependency
196
+ name: literal
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '1.8'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '1.8'
209
+ - !ruby/object:Gem::Dependency
210
+ name: tailwind_merge
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '1.3'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '1.3'
168
223
  - !ruby/object:Gem::Dependency
169
224
  name: pg
170
225
  requirement: !ruby/object:Gem::Requirement
@@ -193,6 +248,20 @@ dependencies:
193
248
  - - ">="
194
249
  - !ruby/object:Gem::Version
195
250
  version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: rails-controller-testing
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: '0'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
196
265
  - !ruby/object:Gem::Dependency
197
266
  name: capybara
198
267
  requirement: !ruby/object:Gem::Requirement
@@ -364,7 +433,7 @@ dependencies:
364
433
  description: Shared development tools, configurations, and utilities for Panda CMS
365
434
  and its related projects
366
435
  email:
367
- - bamboo@pandacms.io
436
+ - james@otaina.co.uk
368
437
  executables: []
369
438
  extensions: []
370
439
  extra_rdoc_files: []
@@ -372,36 +441,50 @@ files:
372
441
  - LICENSE
373
442
  - README.md
374
443
  - Rakefile
444
+ - app/assets/tailwind/application.css
445
+ - app/assets/tailwind/tailwind.config.js
375
446
  - app/builders/panda/core/form_builder.rb
447
+ - app/components/panda/core/UI/badge.rb
448
+ - app/components/panda/core/UI/button.rb
449
+ - app/components/panda/core/UI/card.rb
376
450
  - app/components/panda/core/admin/button_component.rb
377
- - app/components/panda/core/admin/container_component.html.erb
378
451
  - app/components/panda/core/admin/container_component.rb
379
- - app/components/panda/core/admin/flash_message_component.html.erb
380
452
  - app/components/panda/core/admin/flash_message_component.rb
453
+ - app/components/panda/core/admin/form_error_component.rb
454
+ - app/components/panda/core/admin/form_input_component.rb
455
+ - app/components/panda/core/admin/form_select_component.rb
381
456
  - app/components/panda/core/admin/heading_component.rb
382
- - app/components/panda/core/admin/panel_component.html.erb
383
457
  - app/components/panda/core/admin/panel_component.rb
384
- - app/components/panda/core/admin/slideover_component.html.erb
385
458
  - app/components/panda/core/admin/slideover_component.rb
386
- - app/components/panda/core/admin/table_component.html.erb
459
+ - app/components/panda/core/admin/statistics_component.rb
460
+ - app/components/panda/core/admin/tab_bar_component.rb
387
461
  - app/components/panda/core/admin/table_component.rb
388
462
  - app/components/panda/core/admin/tag_component.rb
463
+ - app/components/panda/core/admin/user_activity_component.rb
464
+ - app/components/panda/core/admin/user_display_component.rb
465
+ - app/components/panda/core/base.rb
389
466
  - app/constraints/panda/core/admin_constraint.rb
467
+ - app/controllers/panda/core/admin/base_controller.rb
390
468
  - app/controllers/panda/core/admin/dashboard_controller.rb
391
469
  - app/controllers/panda/core/admin/my_profile_controller.rb
392
470
  - app/controllers/panda/core/admin/sessions_controller.rb
393
- - app/controllers/panda/core/admin_controller.rb
394
471
  - app/controllers/panda/core/application_controller.rb
395
472
  - app/helpers/panda/core/asset_helper.rb
473
+ - app/helpers/panda/core/sessions_helper.rb
396
474
  - app/javascript/panda/core/application.js
397
475
  - app/javascript/panda/core/controllers/index.js
398
476
  - app/javascript/panda/core/controllers/theme_form_controller.js
399
477
  - app/javascript/panda/core/tailwindcss-stimulus-components.js
478
+ - app/javascript/panda/core/vendor/@hotwired--stimulus.js
479
+ - app/javascript/panda/core/vendor/@hotwired--turbo.js
480
+ - app/javascript/panda/core/vendor/@rails--actioncable--src.js
400
481
  - app/models/panda/core/application_record.rb
401
482
  - app/models/panda/core/breadcrumb.rb
402
483
  - app/models/panda/core/current.rb
403
484
  - app/models/panda/core/user.rb
404
485
  - app/views/layouts/panda/core/admin.html.erb
486
+ - app/views/layouts/panda/core/admin_simple.html.erb
487
+ - app/views/panda/core/admin/dashboard/_default_content.html.erb
405
488
  - app/views/panda/core/admin/dashboard/show.html.erb
406
489
  - app/views/panda/core/admin/my_profile/edit.html.erb
407
490
  - app/views/panda/core/admin/sessions/new.html.erb
@@ -409,15 +492,20 @@ files:
409
492
  - app/views/panda/core/admin/shared/_flash.html.erb
410
493
  - app/views/panda/core/admin/shared/_sidebar.html.erb
411
494
  - app/views/panda/core/admin/shared/_slideover.html.erb
495
+ - app/views/panda/core/shared/_footer.html.erb
496
+ - app/views/panda/core/shared/_header.html.erb
497
+ - config/importmap.rb
412
498
  - config/initializers/panda_core.rb
413
499
  - config/routes.rb
414
500
  - db/migrate/20250809000001_create_panda_core_users.rb
501
+ - db/migrate/20250810120000_add_current_theme_to_panda_core_users.rb
415
502
  - lib/generators/panda/core/authentication/templates/reek_spec.rb
416
503
  - lib/generators/panda/core/dev_tools/USAGE
417
504
  - lib/generators/panda/core/dev_tools/templates/lefthook.yml
418
505
  - lib/generators/panda/core/dev_tools/templates/spec_support_panda_core_helpers.rb
419
506
  - lib/generators/panda/core/dev_tools_generator.rb
420
507
  - lib/generators/panda/core/install_generator.rb
508
+ - lib/generators/panda/core/templates/README
421
509
  - lib/generators/panda/core/templates/initializer.rb
422
510
  - lib/generators/panda/core/templates_generator.rb
423
511
  - lib/panda/core.rb
@@ -425,6 +513,7 @@ files:
425
513
  - lib/panda/core/authentication.rb
426
514
  - lib/panda/core/component_registry.rb
427
515
  - lib/panda/core/configuration.rb
516
+ - lib/panda/core/debug.rb
428
517
  - lib/panda/core/engine.rb
429
518
  - lib/panda/core/media.rb
430
519
  - lib/panda/core/notifications.rb
@@ -442,6 +531,7 @@ files:
442
531
  - lib/tasks/assets.rake
443
532
  - lib/tasks/panda/core/migrations.rake
444
533
  - lib/tasks/panda_core.rake
534
+ - lib/tasks/panda_core_tasks.rake
445
535
  homepage: https://github.com/tastybamboo/panda-core
446
536
  licenses:
447
537
  - BSD-3-Clause
@@ -449,7 +539,6 @@ metadata:
449
539
  homepage_uri: https://github.com/tastybamboo/panda-core
450
540
  source_code_uri: https://github.com/tastybamboo/panda-core
451
541
  changelog_uri: https://github.com/tastybamboo/panda-core/blob/main/CHANGELOG.md
452
- post_install_message:
453
542
  rdoc_options: []
454
543
  require_paths:
455
544
  - lib
@@ -464,8 +553,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
464
553
  - !ruby/object:Gem::Version
465
554
  version: '0'
466
555
  requirements: []
467
- rubygems_version: 3.5.22
468
- signing_key:
556
+ rubygems_version: 3.6.9
469
557
  specification_version: 4
470
558
  summary: Core libraries and development tools for Tasty Bamboo projects
471
559
  test_files: []
@@ -1,12 +0,0 @@
1
- <main class="overflow-auto flex-1 h-full min-h-full max-h-full">
2
- <div class="overflow-auto px-2 pt-4 mx-auto sm:px-6 lg:px-6">
3
- <%= heading %>
4
- <%= tab_bar %>
5
- <section class="flex-auto h-[calc(100vh-10rem)]">
6
- <div class="flex-1 mt-4 w-full h-full">
7
- <%= content %>
8
- </div>
9
- <%= slideover %>
10
- </section>
11
- </div>
12
- </main>
@@ -1,31 +0,0 @@
1
- <div class="fixed top-2 right-2 z-[9999] p-2 space-y-4 w-full max-w-sm sm:items-end"
2
- data-controller="alert"
3
- <% if @temporary %> data-alert-dismiss-after-value="3000"<% end %>
4
- data-transition-enter="ease-in-out duration-500"
5
- data-transition-enter-from="translate-x-full opacity-0"
6
- data-transition-enter-to="translate-x-0 opacity-100"
7
- data-transition-leave="ease-in-out duration-500"
8
- data-transition-leave-from="translate-x-0 opacity-100"
9
- data-transition-leave-to="translate-x-full opacity-0">
10
- <div class="overflow-hidden w-full max-w-sm bg-white rounded-lg ring-1 ring-black ring-opacity-5 shadow-lg">
11
- <div class="p-4">
12
- <div class="flex items-start">
13
- <div class="flex-shrink-0">
14
- <i class="fa-regular text-xl <%= icon_css %> <%= text_colour_css %>"></i>
15
- </div>
16
- <div class="flex-1 pt-0.5 ml-3 w-0">
17
- <p class="mb-1 text-sm font-medium flash-message-title <%= text_colour_css %>"><%= kind.to_s.titleize %></p>
18
- <p class="mt-1 mb-0 text-sm text-gray-500 flash-message-text"><%= message %></p>
19
- </div>
20
- <div class="flex flex-shrink-0 ml-4">
21
- <button data-action="alert#close" type="button" class="inline-flex text-gray-400 bg-white rounded-md transition duration-150 ease-in-out hover:text-gray-500 focus:ring-2 focus:ring-offset-2 focus:outline-none focus:ring-sky-500">
22
- <span class="sr-only">Close</span>
23
- <svg class="w-5 h-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
24
- <path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" />
25
- </svg>
26
- </button>
27
- </div>
28
- </div>
29
- </div>
30
- </div>
31
- </div>
@@ -1,7 +0,0 @@
1
- <div class="col-span-3 mt-5 rounded-lg shadow-md bg-gray-500 shadow-inherit/20">
2
- <%= heading %>
3
-
4
- <div class="p-4 text-black bg-white rounded-b-lg">
5
- <%= content %>
6
- </div>
7
- </div>
@@ -1,9 +0,0 @@
1
- <% content_for :sidebar do %>
2
- <aside class="hidden overflow-y-auto w-96 h-full bg-white lg:block">
3
- <%= content %>
4
- </aside>
5
- <% end %>
6
-
7
- <% content_for :sidebar_title do %>
8
- <%= title %>
9
- <% end %>
@@ -1,29 +0,0 @@
1
- <div class="table overflow-x-auto mb-12 w-full rounded-lg border border-gray-500">
2
- <div class="table-header-group">
3
- <div class="table-row text-base font-medium text-white bg-gray-500">
4
- <% columns.each_with_index do |column, i| %>
5
- <div class="table-cell sticky top-0 z-10 p-4 <% if i.zero? %>rounded-tl-md<% elsif i == columns.size - 1 %>rounded-tr-md<% end %>"><%= column.label %></div>
6
- <% end %>
7
- </div>
8
- </div>
9
-
10
- <% if @rows.any? %>
11
- <div class="table-row-group">
12
- <% @rows.each do |row| %>
13
- <div class="table-row relative bg-gray-500/5 hover:bg-gray-500/20" data-post-id="<%= row.id %>">
14
- <% @columns.each do |column| %>
15
- <div class="table-cell py-5 px-3 h-20 text-sm align-middle whitespace-nowrap border-b border-gray-500/20">
16
- <%= view_context.capture(row, &column.cell) %>
17
- </div>
18
- <% end %>
19
- </div>
20
- <% end %>
21
- </div>
22
- </div>
23
- <% else %>
24
- </div>
25
- <div class="text-center mx-12 block border border-dashed py-12 rounded-lg">
26
- <h3 class="py-1 text-xl font-semibold text-gray-900">No <%= @term.pluralize %></h3>
27
- <p class="py-1 text-base text-gray-500">Get started by creating a new <%= @term %>.</p>
28
- </div>
29
- <% end %>
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Panda
4
- module Core
5
- class AdminController < ApplicationController
6
- # Automatically require admin authentication for all admin controllers
7
- before_action :authenticate_admin_user!
8
- before_action :set_initial_breadcrumb
9
-
10
- private
11
-
12
- def set_initial_breadcrumb
13
- # Use configured breadcrumb or default
14
- if Core.configuration.initial_admin_breadcrumb
15
- label, path = Core.configuration.initial_admin_breadcrumb.call(self)
16
- add_breadcrumb label, path
17
- else
18
- add_breadcrumb "Admin", admin_root_path
19
- end
20
- end
21
-
22
- # Legacy method for compatibility
23
- def set_admin_breadcrumb
24
- set_initial_breadcrumb
25
- end
26
- end
27
- end
28
- end