rivet_cms 0.1.2.pre → 0.3.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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -0
  3. data/COPYING +674 -0
  4. data/COPYING.LESSER +165 -0
  5. data/README.md +173 -10
  6. data/app/assets/builds/rivet_cms.css +2 -2
  7. data/app/assets/builds/rivet_cms.js +395 -9505
  8. data/app/assets/stylesheets/rivet_cms/application.tailwind.css +145 -22
  9. data/app/controllers/concerns/rivet_cms/inertia_props.rb +239 -0
  10. data/app/controllers/rivet_cms/api_docs_controller.rb +47 -0
  11. data/app/controllers/rivet_cms/api_tokens_controller.rb +43 -0
  12. data/app/controllers/rivet_cms/application_controller.rb +220 -2
  13. data/app/controllers/rivet_cms/auth_controller.rb +28 -0
  14. data/app/controllers/rivet_cms/components_controller.rb +93 -2
  15. data/app/controllers/rivet_cms/content_controller.rb +105 -0
  16. data/app/controllers/rivet_cms/content_manager_controller.rb +32 -0
  17. data/app/controllers/rivet_cms/content_types_controller.rb +118 -26
  18. data/app/controllers/rivet_cms/dashboard_controller.rb +55 -5
  19. data/app/controllers/rivet_cms/documents_controller.rb +204 -0
  20. data/app/controllers/rivet_cms/fields_controller.rb +77 -74
  21. data/app/controllers/rivet_cms/invitations_controller.rb +36 -0
  22. data/app/controllers/rivet_cms/media_assets_controller.rb +76 -0
  23. data/app/controllers/rivet_cms/sessions_controller.rb +122 -0
  24. data/app/controllers/rivet_cms/setup_controller.rb +60 -0
  25. data/app/controllers/rivet_cms/trash_controller.rb +68 -0
  26. data/app/controllers/rivet_cms/users_controller.rb +117 -0
  27. data/app/helpers/rivet_cms/application_helper.rb +13 -3
  28. data/app/helpers/rivet_cms/components_helper.rb +4 -0
  29. data/app/helpers/rivet_cms/content_types_helper.rb +4 -0
  30. data/app/helpers/rivet_cms/dashboard_helper.rb +4 -0
  31. data/app/jobs/rivet_cms/webhook_delivery_job.rb +35 -0
  32. data/app/models/concerns/rivet_cms/has_fields.rb +31 -0
  33. data/app/models/concerns/rivet_cms/organization_scoped.rb +17 -0
  34. data/app/models/concerns/rivet_cms/revision_owned.rb +36 -0
  35. data/app/models/concerns/rivet_cms/sluggable.rb +38 -0
  36. data/app/models/concerns/rivet_cms/soft_deletable.rb +42 -0
  37. data/app/models/concerns/rivet_cms/typed_value.rb +51 -0
  38. data/app/models/rivet_cms/api_token.rb +64 -0
  39. data/app/models/rivet_cms/category.rb +20 -0
  40. data/app/models/rivet_cms/component.rb +10 -0
  41. data/app/models/rivet_cms/component_instance.rb +27 -0
  42. data/app/models/rivet_cms/content_type.rb +36 -23
  43. data/app/models/rivet_cms/content_value.rb +19 -0
  44. data/app/models/rivet_cms/current.rb +6 -0
  45. data/app/models/rivet_cms/document.rb +71 -0
  46. data/app/models/rivet_cms/document_revision.rb +128 -0
  47. data/app/models/rivet_cms/entry.rb +73 -0
  48. data/app/models/rivet_cms/entry_collection.rb +41 -0
  49. data/app/models/rivet_cms/field.rb +203 -61
  50. data/app/models/rivet_cms/media_asset.rb +109 -0
  51. data/app/models/rivet_cms/organization.rb +46 -0
  52. data/app/models/rivet_cms/relation.rb +23 -0
  53. data/app/models/rivet_cms/user.rb +61 -0
  54. data/app/serializers/rivet_cms/revision_preloader.rb +146 -0
  55. data/app/serializers/rivet_cms/revision_serializer.rb +123 -0
  56. data/app/services/rivet_cms/content_query.rb +158 -0
  57. data/app/services/rivet_cms/content_validator.rb +150 -0
  58. data/app/services/rivet_cms/draft_writer.rb +74 -0
  59. data/app/services/rivet_cms/open_api_generator.rb +173 -221
  60. data/app/services/rivet_cms/revision_pruner.rb +64 -0
  61. data/app/services/rivet_cms/webhooks.rb +61 -0
  62. data/app/views/layouts/rivet_cms/application.html.erb +35 -42
  63. data/config/routes.rb +68 -45
  64. data/db/migrate/20251119193607_create_rivet_cms_organizations.rb +17 -0
  65. data/db/migrate/20251120050818_create_rivet_cms_content_types.rb +14 -0
  66. data/db/migrate/20251121020625_create_rivet_cms_components.rb +14 -0
  67. data/db/migrate/20251121040115_create_rivet_cms_categories.rb +14 -0
  68. data/db/migrate/20260119185946_create_content_system_tables.rb +95 -0
  69. data/db/migrate/20260722000001_create_rivet_cms_media_assets.rb +15 -0
  70. data/db/migrate/20260722000002_create_rivet_cms_api_tokens.rb +16 -0
  71. data/db/migrate/20260806000001_add_title_and_alt_to_rivet_cms_media_assets.rb +7 -0
  72. data/db/migrate/20260806000002_add_deleted_at_to_rivet_cms_content_types.rb +6 -0
  73. data/db/migrate/20260807000001_add_deleted_at_to_rivet_cms_documents.rb +6 -0
  74. data/db/migrate/20260808000001_create_rivet_cms_users.rb +15 -0
  75. data/db/seeds/README.md +70 -0
  76. data/db/seeds/templates/blog.rb +39 -0
  77. data/db/seeds/templates/events.rb +12 -0
  78. data/db/seeds/templates/faq.rb +9 -0
  79. data/db/seeds/templates/pages.rb +35 -0
  80. data/db/seeds/templates/site_settings.rb +22 -0
  81. data/db/seeds/templates/team.rb +11 -0
  82. data/db/seeds/templates/testimonials.rb +11 -0
  83. data/lib/generators/rivet_cms/install/install_generator.rb +13 -0
  84. data/lib/generators/rivet_cms/install/templates/initializer.rb +77 -0
  85. data/lib/rivet_cms/access_check.rb +12 -0
  86. data/lib/rivet_cms/audit.rb +43 -0
  87. data/lib/rivet_cms/engine.rb +28 -22
  88. data/lib/rivet_cms/hooks.rb +106 -0
  89. data/lib/rivet_cms/navigation.rb +111 -0
  90. data/lib/rivet_cms/safe_pattern.rb +40 -0
  91. data/lib/rivet_cms/seeds.rb +264 -0
  92. data/lib/rivet_cms/version.rb +1 -1
  93. data/lib/rivet_cms.rb +289 -32
  94. data/lib/tasks/rivet_cms_tasks.rake +18 -4
  95. metadata +138 -98
  96. data/MIT-LICENSE +0 -20
  97. data/app/assets/builds/rivet_cms.js.map +0 -7
  98. data/app/assets/stylesheets/rivet_cms/brand_colors.css +0 -168
  99. data/app/controllers/rivet_cms/api/docs_controller.rb +0 -38
  100. data/app/helpers/rivet_cms/brand_color_helper.rb +0 -71
  101. data/app/helpers/rivet_cms/flash_helper.rb +0 -37
  102. data/app/helpers/rivet_cms/sign_out_helper.rb +0 -11
  103. data/app/javascript/controllers/content_type_form_controller.js +0 -53
  104. data/app/javascript/controllers/field_layout_controller.js +0 -709
  105. data/app/javascript/rivet_cms.js +0 -29
  106. data/app/models/rivet_cms/content.rb +0 -4
  107. data/app/models/rivet_cms/field_values/base.rb +0 -11
  108. data/app/models/rivet_cms/field_values/boolean.rb +0 -4
  109. data/app/models/rivet_cms/field_values/integer.rb +0 -4
  110. data/app/models/rivet_cms/field_values/string.rb +0 -4
  111. data/app/models/rivet_cms/field_values/text.rb +0 -4
  112. data/app/views/rivet_cms/api/docs/show.html.erb +0 -47
  113. data/app/views/rivet_cms/content_types/_form.html.erb +0 -98
  114. data/app/views/rivet_cms/content_types/edit.html.erb +0 -27
  115. data/app/views/rivet_cms/content_types/index.html.erb +0 -151
  116. data/app/views/rivet_cms/content_types/new.html.erb +0 -19
  117. data/app/views/rivet_cms/content_types/show.html.erb +0 -147
  118. data/app/views/rivet_cms/dashboard/index.html.erb +0 -263
  119. data/app/views/rivet_cms/fields/_form.html.erb +0 -111
  120. data/app/views/rivet_cms/fields/edit.html.erb +0 -25
  121. data/app/views/rivet_cms/fields/index.html.erb +0 -126
  122. data/app/views/rivet_cms/fields/new.html.erb +0 -25
  123. data/app/views/rivet_cms/shared/_navigation.html.erb +0 -153
  124. data/config/i18n-tasks.yml +0 -178
  125. data/config/locales/en.yml +0 -14
  126. data/db/migrate/20250317194359_create_core_tables.rb +0 -90
  127. data/lib/rivet_cms/routes.rb +0 -49
@@ -1,153 +0,0 @@
1
- <nav class="bg-white shadow-sm border-b border-gray-200 py-2">
2
- <div class="w-full px-4 sm:px-6 lg:px-8">
3
- <div class="flex h-16 justify-between items-center">
4
- <div class="flex-shrink-0 flex items-center">
5
- <%= link_to dashboard_path do %>
6
- <h1 class="text-xl font-bold text-gray-900 flex items-center">
7
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-boxes mr-2 text-brand-600">
8
- <path d="M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z"/>
9
- <path d="m7 16.5-4.74-2.85"/>
10
- <path d="m7 16.5 5-3"/>
11
- <path d="M7 16.5v5.17"/>
12
- <path d="M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z"/>
13
- <path d="m17 16.5-5-3"/>
14
- <path d="m17 16.5 4.74-2.85"/>
15
- <path d="M17 16.5v5.17"/>
16
- <path d="M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z"/>
17
- <path d="M12 8 7.26 5.15"/>
18
- <path d="m12 8 4.74-2.85"/>
19
- <path d="M12 13.5V8"/>
20
- </svg>
21
- <span class="font-passion-one text-3xl">RivetCMS</span>
22
- </h1>
23
- <% end %>
24
- </div>
25
-
26
- <div class="hidden lg:flex lg:justify-center lg:flex-1 lg:items-center">
27
- <div class="flex space-x-3 xl:space-x-4 2xl:space-x-6">
28
- <%= link_to dashboard_path, class: current_page?(dashboard_path) ? "inline-flex items-center border-b-2 border-brand-600 px-1 pt-1 text-sm font-medium text-brand-700" : "inline-flex items-center border-b-2 border-transparent px-1 pt-1 text-sm font-medium text-gray-600 hover:border-gray-300 hover:text-gray-800" do %>
29
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-home mr-1"><path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
30
- <span><%= t(".dashboard") %></span>
31
- <% end %>
32
- <%= link_to "#", class: controller_name == 'contents' ? "inline-flex items-center border-b-2 border-brand-600 px-1 pt-1 text-sm font-medium text-brand-700" : "inline-flex items-center border-b-2 border-transparent px-1 pt-1 text-sm font-medium text-gray-600 hover:border-gray-300 hover:text-gray-800" do %>
33
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-text mr-1"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>
34
- <span><%= t(".content") %></span>
35
- <% end %>
36
- <%= link_to content_types_path, class: controller_name == 'content_types' ? "inline-flex items-center border-b-2 border-brand-600 px-1 pt-1 text-sm font-medium text-brand-700" : "inline-flex items-center border-b-2 border-transparent px-1 pt-1 text-sm font-medium text-gray-600 hover:border-gray-300 hover:text-gray-800" do %>
37
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layers mr-1"><polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/></svg>
38
- <span class="xl:inline hidden"><%= t(".content_types") %></span>
39
- <span class="xl:hidden"><%= t(".content_types_short") %></span>
40
- <% end %>
41
- <%= link_to components_path, class: controller_name == 'components' ? "inline-flex items-center border-b-2 border-brand-600 px-1 pt-1 text-sm font-medium text-brand-700" : "inline-flex items-center border-b-2 border-transparent px-1 pt-1 text-sm font-medium text-gray-600 hover:border-gray-300 hover:text-gray-800" do %>
42
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layout-grid mr-1"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg>
43
- <span class="xl:inline hidden"><%= t(".components") %></span>
44
- <span class="xl:hidden"><%= t(".components_short") %></span>
45
- <% end %>
46
- <%= link_to "#", class: "inline-flex items-center border-b-2 border-transparent px-1 pt-1 text-sm font-medium text-gray-600 hover:border-gray-300 hover:text-gray-800" do %>
47
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image mr-1"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>
48
- <span><%= t(".media") %></span>
49
- <% end %>
50
- <%= link_to "#", class: controller_name == 'users' ? "inline-flex items-center border-b-2 border-brand-600 px-1 pt-1 text-sm font-medium text-brand-700" : "inline-flex items-center border-b-2 border-transparent px-1 pt-1 text-sm font-medium text-gray-600 hover:border-gray-300 hover:text-gray-800" do %>
51
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-users mr-1"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>
52
- <span><%= t(".users") %></span>
53
- <% end %>
54
- <%= link_to api_docs_path, class: "inline-flex items-center border-b-2 border-transparent px-1 pt-1 text-sm font-medium text-gray-600 hover:border-gray-300 hover:text-gray-800", target: "_blank" do %>
55
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-open mr-1"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/></svg>
56
- <span class="xl:inline hidden"><%= t(".api_docs") %></span>
57
- <% end %>
58
- </div>
59
- </div>
60
-
61
- <!-- Right side icons -->
62
- <div class="flex items-center space-x-4">
63
- <!-- Pro version link -->
64
- <a href="#" class="inline-flex items-center rounded-md bg-gray-800 px-3 py-1.5 text-sm font-medium text-white shadow-sm hover:bg-gray-700 transition-colors">
65
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sparkles mr-1"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/><path d="M5 3v4"/><path d="M19 17v4"/><path d="M3 5h4"/><path d="M17 19h4"/></svg>
66
- <span class="md:hidden">Upgrade</span><span class="hidden md:inline">Upgrade to Pro</span>
67
- </a>
68
-
69
- <!-- Help button -->
70
- <button type="button" class="rounded-full bg-brand-50 p-1 text-brand-600 hover:bg-brand-100 focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2">
71
- <span class="sr-only">View help</span>
72
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-badge-help"><path d="M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" x2="12.01" y1="17" y2="17"/></svg>
73
- </button>
74
- <div class="relative">
75
- <button type="button" class="flex rounded-full bg-brand-50 text-sm focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2" id="user-menu-button" aria-expanded="false" aria-haspopup="true">
76
- <span class="sr-only">Open user menu</span>
77
- <span class="inline-flex h-8 w-8 items-center justify-center rounded-full bg-white border border-brand-100">
78
- <span class="text-sm font-medium leading-none text-brand-700">
79
-
80
- </span>
81
- </span>
82
- </button>
83
- </div>
84
-
85
- <!-- Mobile menu button -->
86
- <div class="lg:hidden">
87
- <button type="button" class="inline-flex items-center justify-center rounded-md p-2 text-gray-500 hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-brand-500" aria-controls="mobile-menu" aria-expanded="false">
88
- <span class="sr-only">Open main menu</span>
89
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-menu block h-6 w-6">
90
- <line x1="4" x2="20" y1="12" y2="12" />
91
- <line x1="4" x2="20" y1="6" y2="6" />
92
- <line x1="4" x2="20" y1="18" y2="18" />
93
- </svg>
94
- </button>
95
- </div>
96
- </div>
97
- </div>
98
- </div>
99
-
100
- <!-- Mobile menu, show/hide based on menu state. -->
101
- <div class="hidden lg:hidden" id="mobile-menu">
102
- <div class="space-y-1 pb-3 pt-2">
103
- <%= link_to dashboard_path, class: current_page?(dashboard_path) ? "block border-l-4 border-brand-600 bg-brand-50 py-2 pl-3 pr-4 text-base font-medium text-brand-700" : "block border-l-4 border-transparent py-2 pl-3 pr-4 text-base font-medium text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800" do %>
104
- <div class="flex items-center">
105
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-home mr-2"><path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
106
- Dashboard
107
- </div>
108
- <% end %>
109
- <%= link_to "#", class: controller_name == 'contents' ? "block border-l-4 border-brand-600 bg-brand-50 py-2 pl-3 pr-4 text-base font-medium text-brand-700" : "block border-l-4 border-transparent py-2 pl-3 pr-4 text-base font-medium text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800" do %>
110
- <div class="flex items-center">
111
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-text mr-2"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>
112
- Content
113
- </div>
114
- <% end %>
115
- <%= link_to content_types_path, class: controller_name == 'content_types' ? "block border-l-4 border-brand-600 bg-brand-50 py-2 pl-3 pr-4 text-base font-medium text-brand-700" : "block border-l-4 border-transparent py-2 pl-3 pr-4 text-base font-medium text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800" do %>
116
- <div class="flex items-center">
117
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layers mr-2"><polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/></svg>
118
- Content Types
119
- </div>
120
- <% end %>
121
- <%= link_to components_path, class: controller_name == 'components' ? "block border-l-4 border-brand-600 bg-brand-50 py-2 pl-3 pr-4 text-base font-medium text-brand-700" : "block border-l-4 border-transparent py-2 pl-3 pr-4 text-base font-medium text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800" do %>
122
- <div class="flex items-center">
123
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layout-grid mr-2"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg>
124
- Components
125
- </div>
126
- <% end %>
127
- <%= link_to "#", class: "block border-l-4 border-transparent py-2 pl-3 pr-4 text-base font-medium text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800" do %>
128
- <div class="flex items-center">
129
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image mr-2"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>
130
- Media Library
131
- </div>
132
- <% end %>
133
- <%= link_to "#", class: controller_name == 'users' ? "block border-l-4 border-brand-600 bg-brand-50 py-2 pl-3 pr-4 text-base font-medium text-brand-700" : "block border-l-4 border-transparent py-2 pl-3 pr-4 text-base font-medium text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800" do %>
134
- <div class="flex items-center">
135
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-users mr-2"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>
136
- Users
137
- </div>
138
- <% end %>
139
- <%= link_to api_docs_path, class: "block border-l-4 border-transparent py-2 pl-3 pr-4 text-base font-medium text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800", target: "_blank" do %>
140
- <div class="flex items-center">
141
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-open mr-2"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/></svg>
142
- API Docs
143
- </div>
144
- <% end %>
145
- <div class="mt-4 border-t border-gray-200 pt-4 px-3">
146
- <a href="#" class="flex items-center justify-center rounded-md bg-gray-800 !bg-gray-800 px-3 py-2 text-base font-medium text-white shadow-sm hover:bg-gray-700 !hover:bg-gray-700 transition-colors">
147
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sparkles mr-2"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/><path d="M5 3v4"/><path d="M19 17v4"/><path d="M3 5h4"/><path d="M17 19h4"/></svg>
148
- Upgrade to Pro
149
- </a>
150
- </div>
151
- </div>
152
- </div>
153
- </nav>
@@ -1,178 +0,0 @@
1
- # i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
2
-
3
- # The "main" locale.
4
- base_locale: en
5
- ## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
6
- # locales: [es, fr]
7
- ## Reporting locale, default: en. Available: en, ru.
8
- # internal_locale: en
9
-
10
- # Read and write translations.
11
- data:
12
- ## Translations are read from the file system. Supported format: YAML, JSON.
13
- ## Provide a custom adapter:
14
- # adapter: I18n::Tasks::Data::FileSystem
15
-
16
- # Locale files or `Dir.glob` patterns where translations are read from:
17
- read:
18
- ## Default:
19
- # - config/locales/%{locale}.yml
20
- ## More files:
21
- # - config/locales/**/*.%{locale}.yml
22
-
23
- # Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
24
- # `i18n-tasks normalize -p` will force move the keys according to these rules
25
- write:
26
- ## For example, write devise and simple form keys to their respective files:
27
- # - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
28
- ## Catch-all default:
29
- # - config/locales/%{locale}.yml
30
-
31
- # External locale data (e.g. gems).
32
- # This data is not considered unused and is never written to.
33
- external:
34
- ## Example (replace %#= with %=):
35
- # - "<%#= %x[bundle info vagrant --path].chomp %>/templates/locales/%{locale}.yml"
36
-
37
- ## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, isolating_router, or a custom class.
38
- # router: conservative_router
39
-
40
- yaml:
41
- write:
42
- # do not wrap lines at 80 characters
43
- line_width: -1
44
-
45
- ## Pretty-print JSON:
46
- # json:
47
- # write:
48
- # indent: ' '
49
- # space: ' '
50
- # object_nl: "\n"
51
- # array_nl: "\n"
52
-
53
- # Find translate calls
54
- search:
55
- ## Paths or `Find.find` patterns to search in:
56
- # paths:
57
- # - app/
58
-
59
- ## Root directories for relative keys resolution.
60
- # relative_roots:
61
- # - app/controllers
62
- # - app/helpers
63
- # - app/mailers
64
- # - app/presenters
65
- # - app/views
66
-
67
- ## Directories where method names which should not be part of a relative key resolution.
68
- # By default, if a relative translation is used inside a method, the name of the method will be considered part of the resolved key.
69
- # Directories listed here will not consider the name of the method part of the resolved key
70
- #
71
- # relative_exclude_method_name_paths:
72
- # -
73
-
74
- ## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
75
- ## *.jpg *.jpeg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less
76
- ## *.yml *.json *.zip *.tar.gz *.swf *.flv *.mp3 *.wav *.flac *.webm *.mp4 *.ogg *.opus *.webp *.map *.xlsx
77
- exclude:
78
- - app/assets/images
79
- - app/assets/fonts
80
- - app/assets/videos
81
- - app/assets/builds
82
-
83
- ## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
84
- ## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
85
- # only: ["*.rb", "*.html.slim"]
86
-
87
- ## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`.
88
- # strict: true
89
-
90
- ## Allows adding ast_matchers for finding translations using the AST-scanners
91
- ## The available matchers are:
92
- ## - RailsModelMatcher
93
- ## Matches ActiveRecord translations like
94
- ## User.human_attribute_name(:email) and User.model_name.human
95
- ## - DefaultI18nSubjectMatcher
96
- ## Matches ActionMailer's default_i18n_subject method
97
- ##
98
- ## To implement your own, please see `I18n::Tasks::Scanners::AstMatchers::BaseMatcher`.
99
- # ast_matchers:
100
- # - 'I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher'
101
- # - 'I18n::Tasks::Scanners::AstMatchers::DefaultI18nSubjectMatcher'
102
-
103
- ## Multiple scanners can be used. Their results are merged.
104
- ## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
105
- ## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example
106
-
107
- ## Translation Services
108
- # translation:
109
- # # Google Translate
110
- # # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
111
- # google_translate_api_key: "AbC-dEf5"
112
- # # DeepL Pro Translate
113
- # # Get an API key and subscription at https://www.deepl.com/pro to use DeepL Pro
114
- # deepl_api_key: "48E92789-57A3-466A-9959-1A1A1A1A1A1A"
115
- # # deepl_host: "https://api.deepl.com"
116
- # # deepl_version: "v2"
117
- # # deepl_glossary_ids:
118
- # # - f28106eb-0e06-489e-82c6-8215d6f95089
119
- # # - 2c6415be-1852-4f54-9e1b-d800463496b4
120
- # # add additional options to the DeepL.translate call: https://www.deepl.com/docs-api/translate-text/translate-text/
121
- # deepl_options:
122
- # formality: prefer_less
123
- # # OpenAI
124
- # openai_api_key: "sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
125
- # # openai_model: "gpt-4o-mini" # see https://platform.openai.com/docs/models
126
- # # may contain `%{from}` and `%{to}`, which will be replaced by source and target locale codes, respectively (using `Kernel.format`)
127
- # # openai_system_prompt: >-
128
- # # You are a professional translator that translates content from the %{from} locale
129
- # # to the %{to} locale in an i18n locale array.
130
- # #
131
- # # The array has a structured format and contains multiple strings. Your task is to translate
132
- # # each of these strings and create a new array with the translated strings.
133
- # #
134
- # # HTML markups (enclosed in < and > characters) must not be changed under any circumstance.
135
- # # Variables (starting with %%{ and ending with }) must not be changed under any circumstance.
136
- # #
137
- # # Keep in mind the context of all the strings for a more accurate translation.
138
-
139
- ## Do not consider these keys missing:
140
- # ignore_missing:
141
- # - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
142
- # - '{devise,simple_form}.*'
143
-
144
- ## Consider these keys used:
145
- # ignore_unused:
146
- # - 'activerecord.attributes.*'
147
- # - '{devise,kaminari,will_paginate}.*'
148
- # - 'simple_form.{yes,no}'
149
- # - 'simple_form.{placeholders,hints,labels}.*'
150
- # - 'simple_form.{error_notification,required}.:'
151
-
152
- ## Exclude these keys from the `i18n-tasks eq-base' report:
153
- # ignore_eq_base:
154
- # all:
155
- # - common.ok
156
- # fr,es:
157
- # - common.brand
158
-
159
- ## Exclude these keys from the `i18n-tasks check-consistent-interpolations` report:
160
- # ignore_inconsistent_interpolations:
161
- # - 'activerecord.attributes.*'
162
-
163
- ## Ignore these keys completely:
164
- # ignore:
165
- # - kaminari.*
166
-
167
- ## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
168
- ## e.g. in case of a relative key defined in a helper method.
169
- ## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
170
- #
171
- # <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
172
- # only: %w(*.html.haml *.html.slim),
173
- # patterns: [['= title\b', '.page_title']] %>
174
- #
175
- # The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
176
- #
177
- # <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
178
- # patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
@@ -1,14 +0,0 @@
1
- ---
2
- en:
3
- rivet_cms:
4
- shared:
5
- navigation:
6
- api_docs: Api Docs
7
- components: Components
8
- components_short: Comp
9
- content: Content
10
- content_types: Content Types
11
- content_types_short: Types
12
- dashboard: Dashboard
13
- media: Media
14
- users: Users
@@ -1,90 +0,0 @@
1
- class CreateCoreTables < ActiveRecord::Migration[7.2]
2
- def change
3
- def json_or_text
4
- if connection.adapter_name.downcase == "mysql2"
5
- mysql_version = connection.select_value("SELECT VERSION()")
6
- Gem::Version.new(mysql_version) >= Gem::Version.new("5.7.8") ? :json : :text
7
- else
8
- :jsonb
9
- end
10
- end
11
-
12
- create_table :rivet_cms_content_types do |t|
13
- t.string :name, null: false
14
- t.string :slug, null: false
15
- t.text :description
16
- t.boolean :is_single, default: false
17
- t.timestamps
18
-
19
- t.index :slug, unique: true
20
- end
21
-
22
- create_table :rivet_cms_components do |t|
23
- t.string :name, null: false
24
- t.string :slug, null: false
25
- t.text :description
26
- t.boolean :repeatable, default: false
27
- t.timestamps
28
-
29
- t.index :slug, unique: true
30
- end
31
-
32
- create_table :rivet_cms_fields do |t|
33
- t.references :component, null: true, foreign_key: { to_table: :rivet_cms_components }
34
- t.references :content_type, null: true, foreign_key: { to_table: :rivet_cms_content_types }
35
- t.string :name, null: false
36
- t.string :field_type, null: false
37
- t.text :description
38
- t.boolean :required, default: false
39
- t.column :options, json_or_text, default: {}
40
- t.integer :position
41
- t.string :width, default: "full"
42
- t.integer :row_group
43
- t.timestamps
44
-
45
- t.index [:content_type_id, :name], unique: true, name: "index_fields_on_content_type_id_and_name"
46
- t.index [:component_id, :name], unique: true, name: "index_fields_on_component_id_and_name"
47
- t.index :position
48
- t.check_constraint "(component_id IS NOT NULL AND content_type_id IS NULL) OR (component_id IS NULL AND content_type_id IS NOT NULL)", name: "field_owner_check"
49
- end
50
-
51
- create_table :rivet_cms_contents do |t|
52
- t.references :content_type, null: false, foreign_key: { to_table: :rivet_cms_content_types }
53
- t.string :slug, null: false
54
- t.string :status, null: false, default: "draft"
55
- t.datetime :published_at
56
- t.datetime :unpublished_at
57
- t.timestamps
58
-
59
- t.index :slug, unique: true
60
- t.index :status
61
- end
62
-
63
- create_table :rivet_cms_content_values do |t|
64
- t.references :content, null: false, foreign_key: { to_table: :rivet_cms_contents }
65
- t.references :field, null: false, foreign_key: { to_table: :rivet_cms_fields }
66
- t.references :value, polymorphic: true, null: false
67
- t.timestamps
68
- end
69
-
70
- create_table :rivet_cms_field_values_strings do |t|
71
- t.string :value, null: false
72
- t.timestamps
73
- end
74
-
75
- create_table :rivet_cms_field_values_texts do |t|
76
- t.text :value, null: false
77
- t.timestamps
78
- end
79
-
80
- create_table :rivet_cms_field_values_booleans do |t|
81
- t.boolean :value, null: false
82
- t.timestamps
83
- end
84
-
85
- create_table :rivet_cms_field_values_integers do |t|
86
- t.integer :value, null: false
87
- t.timestamps
88
- end
89
- end
90
- end
@@ -1,49 +0,0 @@
1
- # Route handling pattern adapted from Spree Commerce
2
- # https://github.com/spree/spree/blob/839866a32845009d8a1fdf21cb7201e99f6ff49c/core/lib/spree/core/routes.rb
3
- # License: MIT - https://github.com/spree/spree/blob/main/LICENSE.md
4
-
5
- module RivetCms
6
- module Routes
7
- def self.draw_routes(&block)
8
- @rivet_routes ||= []
9
- @append_routes ||= []
10
-
11
- # Evaluate an immediate block if given
12
- eval_block(block) if block_given?
13
-
14
- # Evaluate stored main routes
15
- @rivet_routes.each { |route_block| eval_block(&route_block) }
16
-
17
- # Evaluate appended routes
18
- @append_routes.each { |route_block| eval_block(&route_block) }
19
-
20
- # Clear routes to avoid duplication on subsequent calls
21
- @rivet_routes = []
22
- @append_routes = []
23
- end
24
-
25
- def self.add_routes(&block)
26
- @rivet_routes ||= []
27
- store_route(@rivet_routes, &block)
28
- end
29
-
30
- def self.append_routes(&block)
31
- @append_routes ||= []
32
- store_route(@append_routes, &block)
33
- end
34
-
35
- private
36
-
37
- # Helper method for safely storing a route block in the given collection.
38
- def self.store_route(collection, &block)
39
- collection << block unless collection.include?(block)
40
- end
41
-
42
- # Evaluate a block within the context of the engine's routes.
43
- def self.eval_block(&block)
44
- RivetCms::Engine.routes.draw do
45
- instance_exec(&block)
46
- end
47
- end
48
- end
49
- end