maglevcms 3.0.0.beta2 → 3.0.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 (171) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -53
  3. data/Rakefile +3 -1
  4. data/app/assets/builds/maglev/tailwind.css +681 -11670
  5. data/app/assets/config/maglev_manifest.js +3 -2
  6. data/app/assets/javascripts/maglev/client/dom-operations.js +5 -5
  7. data/app/assets/javascripts/maglev/client/iframe-decorator.js +24 -0
  8. data/app/assets/javascripts/maglev/client/incoming-messages.js +13 -3
  9. data/app/assets/javascripts/maglev/client/index.js +3 -2
  10. data/app/assets/javascripts/maglev/client/utils.js +22 -0
  11. data/app/assets/javascripts/maglev/editor/controllers/app/forms/section_form_controller.js +4 -3
  12. data/app/assets/javascripts/maglev/editor/controllers/app/forms/style_form_controller.js +2 -1
  13. data/app/assets/javascripts/maglev/editor/controllers/app/page_preview_controller.js +96 -5
  14. data/app/assets/javascripts/maglev/editor/controllers/app/preview_notification_center_controller.js +105 -23
  15. data/app/assets/javascripts/maglev/editor/controllers/app/setting_controller.js +3 -2
  16. data/app/assets/javascripts/maglev/editor/controllers/shared/copy_to_clipboard_controller.js +2 -1
  17. data/app/assets/javascripts/maglev/editor/controllers/shared/submit_button_controller.js +29 -5
  18. data/app/assets/javascripts/maglev/editor/controllers/utils.js +38 -0
  19. data/app/assets/javascripts/maglev/editor/index.js +5 -44
  20. data/app/assets/javascripts/maglev/editor/patches/page_renderer_patch.js +47 -0
  21. data/app/assets/javascripts/maglev/editor/patches/turbo_delayed_streams.js +35 -0
  22. data/app/assets/javascripts/maglev/editor/patches/turbo_stream_patch.js +50 -0
  23. data/app/assets/stylesheets/maglev/application.css +0 -2
  24. data/app/assets/stylesheets/maglev/tailwind.css.erb +11 -2
  25. data/app/components/maglev/content/link.rb +1 -1
  26. data/app/components/maglev/editor/settings/link/link_component.rb +7 -1
  27. data/app/components/maglev/section_component.rb +11 -1
  28. data/app/components/maglev/uikit/app_layout/sidebar/link_component.html.erb +1 -1
  29. data/app/components/maglev/uikit/app_layout/sidebar/link_component.rb +35 -5
  30. data/app/components/maglev/uikit/app_layout/sidebar_component.html.erb +3 -4
  31. data/app/components/maglev/uikit/app_layout/topbar/logo_component.html.erb +1 -1
  32. data/app/components/maglev/uikit/app_layout/topbar/page_info_component.html.erb +1 -1
  33. data/app/components/maglev/uikit/app_layout/topbar_component.html.erb +1 -1
  34. data/app/components/maglev/uikit/app_layout/topbar_component.rb +1 -1
  35. data/app/components/maglev/uikit/button_group_component/button_group_component.html.erb +5 -0
  36. data/app/components/maglev/uikit/button_group_component.rb +70 -0
  37. data/app/components/maglev/uikit/device_toggler_component.rb +10 -1
  38. data/app/components/maglev/uikit/dropdown_component/dropdown_component.html.erb +2 -2
  39. data/app/components/maglev/uikit/dropdown_component/dropdown_controller.js +6 -1
  40. data/app/components/maglev/uikit/dropdown_component.rb +6 -1
  41. data/app/components/maglev/uikit/form/color_field_component.html.erb +1 -1
  42. data/app/components/maglev/uikit/form/combobox_component.html.erb +1 -0
  43. data/app/components/maglev/uikit/form/link_component.rb +5 -1
  44. data/app/components/maglev/uikit/form/richtext_controller.js +5 -4
  45. data/app/components/maglev/uikit/form/search_form_component.html.erb +1 -0
  46. data/app/components/maglev/uikit/icon_component.rb +3 -0
  47. data/app/components/maglev/uikit/image_library/uploader_controller.js +3 -2
  48. data/app/components/maglev/uikit/list/list_item_component.html.erb +36 -19
  49. data/app/components/maglev/uikit/list/list_item_component.rb +19 -5
  50. data/app/components/maglev/uikit/locale_switcher_component/locale_switcher_component.html.erb +6 -10
  51. data/app/components/maglev/uikit/menu_dropdown_component/menu_dropdown_component.html.erb +6 -2
  52. data/app/components/maglev/uikit/menu_dropdown_component.rb +244 -7
  53. data/app/components/maglev/uikit/page_actions_dropdown_component/page_actions_dropdown_component.html.erb +39 -46
  54. data/app/components/maglev/uikit/pagination_component/pagination_component.html.erb +9 -12
  55. data/app/components/maglev/uikit/pagination_component.rb +6 -1
  56. data/app/components/maglev/uikit/section_toolbar/bottom_component.html.erb +1 -1
  57. data/app/components/maglev/uikit/tabs_component/tabs_component.html.erb +7 -4
  58. data/app/components/maglev/uikit/tabs_component.rb +23 -4
  59. data/app/components/maglev/uikit/well/simple_well_component.html.erb +15 -0
  60. data/app/components/maglev/uikit/well/simple_well_component.rb +13 -0
  61. data/app/controllers/concerns/maglev/editor/errors_concern.rb +9 -9
  62. data/app/controllers/concerns/maglev/editor/preview_urls_concern.rb +32 -0
  63. data/app/controllers/concerns/maglev/editor/turbo_concern.rb +29 -0
  64. data/app/controllers/concerns/maglev/errors_concern.rb +17 -0
  65. data/app/controllers/concerns/maglev/flash_i18n_concern.rb +1 -0
  66. data/app/controllers/maglev/application_controller.rb +2 -1
  67. data/app/controllers/maglev/assets/active_storage_proxy_controller.rb +2 -1
  68. data/app/controllers/maglev/editor/assets_controller.rb +1 -1
  69. data/app/controllers/maglev/editor/base_controller.rb +6 -32
  70. data/app/controllers/maglev/editor/pages/clone_controller.rb +22 -0
  71. data/app/controllers/maglev/editor/pages/discard_draft_controller.rb +17 -0
  72. data/app/controllers/maglev/editor/pages_controller.rb +26 -7
  73. data/app/controllers/maglev/editor/section_blocks_controller.rb +13 -9
  74. data/app/controllers/maglev/editor/sections_controller.rb +26 -7
  75. data/app/controllers/maglev/published_page_preview_controller.rb +4 -0
  76. data/app/controllers/maglev/site_controller.rb +15 -0
  77. data/app/helpers/maglev/application_helper.rb +26 -8
  78. data/app/helpers/maglev/editor/section_blocks_helper.rb +2 -2
  79. data/app/models/maglev/page/publishable_concern.rb +69 -0
  80. data/app/models/maglev/page.rb +3 -0
  81. data/app/models/maglev/section/block.rb +4 -0
  82. data/app/models/maglev/section/content_concern.rb +3 -1
  83. data/app/models/maglev/section.rb +21 -1
  84. data/app/models/maglev/sections_content_store.rb +1 -3
  85. data/app/models/maglev/site.rb +5 -0
  86. data/app/services/concerns/maglev/content/helpers_concern.rb +5 -8
  87. data/app/services/maglev/app_container.rb +4 -2
  88. data/app/services/maglev/discard_page_draft_service.rb +45 -0
  89. data/app/services/maglev/fetch_section_screenshot_url.rb +12 -1
  90. data/app/services/maglev/fetch_site.rb +3 -1
  91. data/app/services/maglev/get_published_page_sections_service.rb +1 -1
  92. data/app/services/maglev/has_unpublished_changes.rb +21 -0
  93. data/app/services/maglev/publish_service.rb +18 -2
  94. data/app/views/layouts/maglev/editor/_sidebar.html.erb +8 -2
  95. data/app/views/layouts/maglev/editor/_topbar.html.erb +6 -23
  96. data/app/views/layouts/maglev/editor/application.html.erb +6 -0
  97. data/app/views/layouts/maglev/editor/topbar/_page_info.html.erb +11 -0
  98. data/app/views/layouts/maglev/editor/topbar/_publish_button.html.erb +35 -0
  99. data/app/views/maglev/editor/assets/index.html.erb +1 -0
  100. data/app/views/maglev/editor/home/index.html.erb +1 -1
  101. data/app/views/maglev/editor/links/edit/_email.html.erb +1 -1
  102. data/app/views/maglev/editor/links/edit/_url.html.erb +1 -1
  103. data/app/views/maglev/editor/pages/_list.html.erb +25 -21
  104. data/app/views/maglev/editor/pages/_preview.html.erb +6 -6
  105. data/app/views/maglev/editor/pages/_preview_empty_message.html.erb +13 -10
  106. data/app/views/maglev/editor/pages/discard_draft/create.turbo_stream.erb +16 -0
  107. data/app/views/maglev/editor/pages/index.html.erb +8 -1
  108. data/app/views/maglev/editor/publication/create.turbo_stream.erb +3 -1
  109. data/app/views/maglev/editor/section_blocks/_form.html.erb +5 -13
  110. data/app/views/maglev/editor/section_blocks/_form_with_tabs.html.erb +15 -0
  111. data/app/views/maglev/editor/section_blocks/_new.html.erb +1 -1
  112. data/app/views/maglev/editor/section_blocks/edit.html.erb +2 -2
  113. data/app/views/maglev/editor/section_blocks/index/_list.html.erb +2 -2
  114. data/app/views/maglev/editor/section_blocks/index/_tree.html.erb +1 -1
  115. data/app/views/maglev/editor/section_blocks/update.turbo_stream.erb +9 -1
  116. data/app/views/maglev/editor/sections/_form.html.erb +6 -20
  117. data/app/views/maglev/editor/sections/_form_with_tabs.html.erb +21 -0
  118. data/app/views/maglev/editor/sections/_list.html.erb +1 -1
  119. data/app/views/maglev/editor/sections/edit.html.erb +3 -3
  120. data/app/views/maglev/editor/sections/index.html.erb +1 -1
  121. data/app/views/maglev/editor/sections/new.html.erb +18 -1
  122. data/app/views/maglev/editor/sections/theme/_empty_list.html.erb +3 -0
  123. data/app/views/maglev/editor/sections/theme/_list.html.erb +35 -0
  124. data/app/views/maglev/editor/sections/theme/_screenshot_placeholder.html.erb +6 -0
  125. data/app/views/maglev/editor/sections/theme/_search.html.erb +22 -0
  126. data/app/views/maglev/editor/sections/update.turbo_stream.erb +9 -1
  127. data/app/views/maglev/editor/shared/_button_label.html.erb +4 -4
  128. data/app/views/maglev/editor/style/edit.html.erb +1 -0
  129. data/app/views/maglev/errors/site_not_found.html.erb +33 -0
  130. data/config/editor_importmap.rb +16 -13
  131. data/config/locales/editor.ar.yml +12 -4
  132. data/config/locales/editor.en.yml +31 -23
  133. data/config/locales/editor.es.yml +12 -4
  134. data/config/locales/editor.fr.yml +12 -4
  135. data/config/locales/editor.pt-BR.yml +12 -4
  136. data/config/routes/maglev/assets.rb +4 -0
  137. data/config/routes/maglev/editor.rb +38 -0
  138. data/config/routes/maglev/preview.rb +8 -0
  139. data/config/routes/maglev/public_preview.rb +6 -0
  140. data/config/routes.rb +8 -44
  141. data/db/migrate/20211013210954_translate_section_content.rb +1 -0
  142. data/db/migrate/20251116171603_add_published_at_to_sites_and_pages.rb +6 -0
  143. data/db/migrate/20260114112058_add_published_payload_to_pages.rb +14 -0
  144. data/exe/tailwind-cli +1 -1
  145. data/lib/generators/maglev/install_generator.rb +9 -7
  146. data/lib/generators/maglev/templates/install/config/initializers/maglev.rb +10 -3
  147. data/lib/maglev/active_storage/serving_blob.rb +29 -0
  148. data/lib/maglev/active_storage.rb +2 -0
  149. data/lib/maglev/config.rb +22 -3
  150. data/lib/maglev/engine.rb +15 -10
  151. data/lib/maglev/errors.rb +1 -0
  152. data/lib/maglev/version.rb +1 -1
  153. data/lib/maglev.rb +18 -3
  154. data/lib/tasks/db_test_all.rake +290 -0
  155. data/lib/tasks/maglev/tailwindcss.rake +1 -0
  156. metadata +55 -19
  157. data/app/controllers/maglev/editor/page_clone_controller.rb +0 -20
  158. data/app/views/maglev/editor/sections/_theme_list.html.erb +0 -32
  159. /data/vendor/javascript/{@floating-ui--core.js → maglev/@floating-ui--core.js} +0 -0
  160. /data/vendor/javascript/{@floating-ui--dom.js → maglev/@floating-ui--dom.js} +0 -0
  161. /data/vendor/javascript/{@floating-ui--utils--dom.js → maglev/@floating-ui--utils--dom.js} +0 -0
  162. /data/vendor/javascript/{@floating-ui--utils.js → maglev/@floating-ui--utils.js} +0 -0
  163. /data/vendor/javascript/{@hotwired--stimulus.js → maglev/@hotwired--stimulus.js} +0 -0
  164. /data/vendor/javascript/{@hotwired--turbo-rails.js → maglev/@hotwired--turbo-rails.js} +0 -0
  165. /data/vendor/javascript/{@hotwired--turbo.js → maglev/@hotwired--turbo.js} +0 -0
  166. /data/vendor/javascript/{@rails--actioncable--src.js → maglev/@rails--actioncable--src.js} +0 -0
  167. /data/vendor/javascript/{@rails--request.js.js → maglev/@rails--request.js.js} +0 -0
  168. /data/vendor/javascript/{@shopify--draggable.js → maglev/@shopify--draggable.js} +0 -0
  169. /data/vendor/javascript/{el-transition.js → maglev/el-transition.js} +0 -0
  170. /data/vendor/javascript/{stimulus-use.js → maglev/stimulus-use.js} +0 -0
  171. /data/vendor/javascript/{tiptap.bundle.js → maglev/tiptap.bundle.js} +0 -0
@@ -2,6 +2,7 @@
2
2
  path: editor_pages_path(maglev_editing_route_context),
3
3
  icon: 'file_copy',
4
4
  active: controller_name == 'pages',
5
+ label: t('maglev.editor.sidebar_nav.list_pages_tooltip'),
5
6
  options: {
6
7
  data: { controller: 'prevent-same-path' }
7
8
  }
@@ -10,21 +11,25 @@
10
11
  <% sidebar.with_link(
11
12
  path: editor_sections_path(maglev_editing_route_context),
12
13
  icon: 'stack',
13
- active: controller_name == 'sections'
14
+ active: controller_name == 'sections',
15
+ label: t('maglev.editor.sidebar_nav.manage_page_sections_tooltip')
14
16
  ) %>
15
17
 
16
18
  <% sidebar.with_link(
17
19
  path: edit_editor_style_path(maglev_editing_route_context),
18
20
  icon: 'drop',
19
21
  active: controller_name == 'style',
22
+ label: t('maglev.editor.sidebar_nav.edit_style_tooltip'),
20
23
  options: {
21
- icon_size: '1.25rem'
24
+ icon_size: '1.25rem',
25
+ data: { controller: 'prevent-same-path' }
22
26
  }
23
27
  ) if maglev_theme.style? %>
24
28
 
25
29
  <% sidebar.with_link(
26
30
  path: editor_assets_path,
27
31
  icon: 'image',
32
+ label: t('maglev.editor.sidebar_nav.open_image_library_tooltip'),
28
33
  options: {
29
34
  data: { turbo_frame: 'modal' }
30
35
  }
@@ -33,6 +38,7 @@
33
38
  <% sidebar.with_link(
34
39
  path: editor_leave_path,
35
40
  icon: 'logout',
41
+ label: t('maglev.editor.sidebar_nav.leave_editor_tooltip'),
36
42
  options: {
37
43
  position: :bottom
38
44
  }
@@ -4,17 +4,9 @@
4
4
  %>
5
5
 
6
6
  <% topbar.with_page_info do %>
7
- <%= render Maglev::Uikit::AppLayout::Topbar::PageInfoComponent.new(
8
- page: current_maglev_page,
9
- paths: {
10
- edit: edit_editor_page_path(current_maglev_page, maglev_editing_route_context),
11
- preview: current_maglev_page_urls[:preview],
12
- clone: editor_page_clone_path(current_maglev_page, maglev_editing_route_context),
13
- delete: editor_page_path(current_maglev_page, maglev_editing_route_context)
14
- },
15
- live_page_url: current_maglev_page_urls[:live],
16
- prefix_page_path: default_content_locale? ? '' : "#{content_locale}/"
17
- ) %>
7
+ <%= turbo_frame_tag dom_id(current_maglev_page, 'topbar-page-info'), data: { turbo_sync: true } do %>
8
+ <%= render 'layouts/maglev/editor/topbar/page_info' %>
9
+ <% end %>
18
10
  <% end %>
19
11
 
20
12
  <% topbar.with_actions do %>
@@ -30,16 +22,7 @@
30
22
  current_locale: Maglev::I18n.current_locale,
31
23
  ) if maglev_site.many_locales? %>
32
24
 
33
- <div class="flex items-center h-full px-4">
34
- <%= button_to editor_publication_path(maglev_editing_route_context),
35
- method: :post,
36
- class: maglev_button_classes(color: :primary, size: :medium),
37
- form_class: 'group/form is-default',
38
- data: { controller: 'submit-button' } do %>
39
- <%= maglev_button_label(
40
- t('maglev.editor.header_nav.publish_button.default'),
41
- pending: t('maglev.editor.header_nav.publish_button.in_progress'),
42
- )%>
43
- <% end %>
44
- </div>
25
+ <%= turbo_frame_tag dom_id(current_maglev_page, 'topbar-publish-button'), data: { turbo_sync: true } do %>
26
+ <%= render 'layouts/maglev/editor/topbar/publish_button' %>
27
+ <% end %>
45
28
  <% end %>
@@ -3,6 +3,7 @@
3
3
  <title><%= maglev_editor_title %></title>
4
4
  <meta name="view-transition" content="same-origin" />
5
5
  <meta name="turbo-refresh-method" content="morph">
6
+ <meta name="turbo-body" content="root">
6
7
 
7
8
  <meta name="content-locale" content="<%= content_locale %>">
8
9
  <meta name="page-preview-url" content="<%= current_maglev_page_urls[:preview] %>">
@@ -38,6 +39,8 @@
38
39
  client:sectionBlock:clicked@window->editor-preview-notification-center#editSectionBlock
39
40
  client:section:setting:clicked@window->editor-preview-notification-center#editSection
40
41
  client:sectionBlock:setting:clicked@window->editor-preview-notification-center#editSection
42
+ client:section:setting:hovered@window->editor-preview-notification-center#prefetchEditSectionOrBlock
43
+ client:sectionBlock:setting:hovered@window->editor-preview-notification-center#prefetchEditSectionOrBlock
41
44
  "
42
45
  >
43
46
  <div id="root">
@@ -56,6 +59,9 @@
56
59
  <% end %>
57
60
 
58
61
  <%= render 'maglev/editor/sections/toolbar_list' %>
62
+
63
+ <%# Inside #root so Turbo morph refreshes the new-section URL; visibility uses editor-preview-empty variant (see tailwind.css.erb). %>
64
+ <%= render 'maglev/editor/pages/preview_empty_message' %>
59
65
  </div>
60
66
 
61
67
  <%= render 'maglev/editor/pages/preview' %>
@@ -0,0 +1,11 @@
1
+ <%= render Maglev::Uikit::AppLayout::Topbar::PageInfoComponent.new(
2
+ page: current_maglev_page,
3
+ paths: {
4
+ edit: edit_editor_page_path(current_maglev_page, maglev_editing_route_context),
5
+ preview: current_maglev_page_urls[:preview],
6
+ clone: clone_editor_page_path(current_maglev_page, maglev_editing_route_context),
7
+ delete: editor_page_path(current_maglev_page, maglev_editing_route_context)
8
+ },
9
+ live_page_url: current_maglev_page_urls[:live],
10
+ prefix_page_path: default_content_locale? ? '' : "#{content_locale}/"
11
+ ) %>
@@ -0,0 +1,35 @@
1
+ <div class="flex items-center h-full px-4">
2
+ <%= render Maglev::Uikit::ButtonGroupComponent.new do |button_group| %>
3
+ <% button_group.with_button do %>
4
+ <%= button_to editor_publication_path(maglev_editing_route_context),
5
+ method: :post,
6
+ class: button_group.wrapped_button_classes,
7
+ form_class: button_group.wrapper_classes(class: 'group/form is-default'),
8
+ disabled: !unpublished_changes?,
9
+ data: {
10
+ controller: 'submit-button',
11
+ turbo_confirm: t('maglev.editor.header_nav.publish_button.publish_confirm')
12
+ } do %>
13
+ <%= maglev_button_label(t('maglev.editor.header_nav.publish_button.default'), pending: t('maglev.editor.header_nav.publish_button.in_progress'),) %>
14
+ <% end %>
15
+ <% end %>
16
+
17
+ <% button_group.with_button do %>
18
+ <%= render Maglev::Uikit::MenuDropdownComponent.new(
19
+ icon_name: 'arrow_down',
20
+ wrapper_classes: button_group.wrapper_classes,
21
+ trigger_classes: button_group.wrapped_button_classes(class: 'px-2!')
22
+ ) do |dropdown| %>
23
+ <% dropdown.with_item_button_to(discard_draft_editor_page_path(current_maglev_page.id, **maglev_editing_route_context),
24
+ method: :post,
25
+ data: {
26
+ turbo_confirm: t('maglev.editor.header_nav.publish_button.discard_draft_confirm')
27
+ }) do |menu_item| %>
28
+ <% menu_item.with_icon_content('history') %>
29
+ <% menu_item.with_label_content(t('maglev.editor.header_nav.publish_button.discard_draft')) %>
30
+ <% menu_item.with_sub_label_content(l(current_maglev_page.published_at, format: :long)) %>
31
+ <% end %>
32
+ <% end %>
33
+ <% end if current_maglev_page.discard_draft? %>
34
+ <% end %>
35
+ </div>
@@ -25,5 +25,6 @@
25
25
  </div>
26
26
 
27
27
  <%= render 'list', assets: @assets, pagy: @pagy %>
28
+ </div>
28
29
  <% end %>
29
30
  <% end %>
@@ -1 +1 @@
1
- <p class="text-green-500">Hello world!!!!</p>
1
+ <!-- this is the home page for the editor -->
@@ -1,5 +1,5 @@
1
1
  <div class="mt-2 grid grid-cols-1 gap-4">
2
2
  <%= f.hidden_field :link_type, value: 'email' %>
3
3
 
4
- <%= f.text_field :email %>
4
+ <%= f.text_field :email, autocomplete: 'off' %>
5
5
  </div>
@@ -1,7 +1,7 @@
1
1
  <div class="mt-2 grid grid-cols-1 gap-4">
2
2
  <%= f.hidden_field :link_type, value: 'url' %>
3
3
 
4
- <%= f.text_field :url_href %>
4
+ <%= f.text_field :url_href, autocomplete: 'off' %>
5
5
 
6
6
  <%= f.check_box :open_new_window %>
7
7
  </div>
@@ -2,27 +2,31 @@
2
2
  <% if @pages.empty? %>
3
3
  <p class="text-center mt-8"><%= t('maglev.editor.pages.list.empty') %></p>
4
4
  <% else %>
5
- <% @pages.each do |page| %>
6
- <div class="flex items-center pl-4 pr-2 hover:bg-gray-50 transition-colors duration-200">
7
- <%= link_to editor_real_root_path(maglev_editing_route_context(page: page)), class: 'flex items-center text-gray-800 overflow-hidden w-full py-3.5 gap-2', data: { turbo_frame: '_top', **maglev_page_preview_reload_data } do %>
8
- <%= maglev_page_icon(page) %>
9
- <span class="truncate">
10
- <%= page.title.presence || page.default_title %>
11
- </span>
5
+ <%= render Maglev::Uikit::List::ListComponent.new do |component| %>
6
+ <% @pages.each do |page| %>
7
+ <%# Omit maglev_page_preview_reload_data: it runs before Turbo visits the row URL and reloads the iframe, then syncPreview loads the new preview again (double fetch). %>
8
+ <% component.with_item_content(id: page.id, link: { url: editor_real_root_path(maglev_editing_route_context(page: page)), data: { turbo_frame: '_top' } }, options: { variant: :ghost }) do |item| %>
9
+ <% item.with_icon do %>
10
+ <%= maglev_page_icon(page) %>
11
+ <% end %>
12
+
13
+ <% item.with_title_content(page.title.presence || page.default_title) %>
14
+ <% item.with_sub_title_content("/" + page.path) %>
15
+
16
+ <% item.with_action do %>
17
+ <%= render Maglev::Uikit::PageActionsDropdownComponent.new(
18
+ paths: {
19
+ edit: edit_editor_page_path(page.id, **query_params(from_list: true), **maglev_editing_route_context),
20
+ preview: maglev_page_preview_url(page),
21
+ clone: clone_editor_page_path(page.id, maglev_editing_route_context),
22
+ delete: editor_page_path(page.id, **query_params, **maglev_editing_route_context)
23
+ },
24
+ live_url: maglev_page_live_url(page),
25
+ without_actions: page.index? ? [:delete] : []
26
+ ) %>
27
+ <% end %>
12
28
  <% end %>
13
- <div class="ml-auto pr-2 relative">
14
- <%= render Maglev::Uikit::PageActionsDropdownComponent.new(
15
- paths: {
16
- edit: edit_editor_page_path(page.id, **query_params(from_list: true), **maglev_editing_route_context),
17
- preview: maglev_page_preview_url(page),
18
- clone: editor_page_clone_path(page.id, maglev_editing_route_context),
19
- delete: editor_page_path(page.id, **query_params, **maglev_editing_route_context)
20
- },
21
- live_url: maglev_page_live_url(page),
22
- without_actions: page.index? ? [:delete] : []
23
- ) %>
24
- </div>
25
- </div>
26
- <% end %>
29
+ <% end %>
30
+ <% end %>
27
31
  <% end %>
28
32
  </div>
@@ -1,12 +1,14 @@
1
1
  <div
2
- class="absolute top-16 left-16 right-0 bottom-0 overflow-hidden group"
2
+ class="absolute top-16 left-16 right-0 bottom-0 z-0 overflow-hidden group"
3
3
  data-controller="editor-page-preview"
4
4
  data-action="
5
5
  uikit-device-toggler:change@window->editor-page-preview#changeDevice
6
6
  client:ready@window->editor-page-preview#clientReady
7
7
  client:ready@window->editor-preview-notification-center#clientReady
8
8
  turbo:load@window->editor-page-preview#detectUrlChange
9
- dispatcher:page-preview:reload@window->editor-page-preview#startLoading
9
+ turbo:render@window->editor-page-preview#detectUrlChange
10
+ pageshow@window->editor-page-preview#detectUrlChange
11
+ dispatcher:page-preview:reload@window->editor-page-preview#reload
10
12
  dispatcher:page-preview:remove-empty-message@window->editor-page-preview#removeEmptyMessage
11
13
  "
12
14
  >
@@ -20,8 +22,8 @@
20
22
  class="bg-white w-full h-full mx-auto transition-discrete transition-all duration-100 ease-in-out group-data-[device=mobile]/device:w-[375px] group-data-[device=tablet]/device:w-[1024px]"
21
23
  data-editor-page-preview-target="iframe"
22
24
  data-editor-preview-notification-center-target="iframe"
23
- data-editor-preview-notification-center-primary-color-param="<%= maglev_primary_hex_color %>"
24
- data-editor-preview-notification-center-sticky-section-ids-param="<%=current_maglev_sections.select(&:sticky?).map(&:id).to_json %>"
25
+ data-editor-preview-notification-center-primary-color-value="<%= maglev_primary_hex_color %>"
26
+ data-editor-preview-notification-center-sticky-section-ids-value="<%= current_maglev_sections.select(&:sticky?).map(&:id).to_json %>"
25
27
  data-action="load->editor-preview-notification-center#sendConfig"></iframe>
26
28
  </div>
27
29
 
@@ -30,6 +32,4 @@
30
32
  <%= t('maglev.editor.page_preview.loading') %>
31
33
  </p>
32
34
  </div>
33
-
34
- <%= render 'maglev/editor/pages/preview_empty_message' %>
35
35
  </div>
@@ -1,14 +1,17 @@
1
- <div class="absolute inset-0 flex-col justify-center items-center hidden group-[.is-empty]:flex bg-gray-50">
2
- <h2 class="text-center text-2xl font-bold">
3
- <%= t('maglev.editor.page_preview.empty.title') %>
4
- </h2>
5
- <div class="mt-4 text-gray-600 max-w-md mx-auto leading-9">
6
- <% new_section_link = capture do %>
7
- <%= link_to new_editor_section_path(**maglev_editing_route_context), class: 'text-editor-primary inline-block relative top-1.5' do %>
8
- <%= render Maglev::Uikit::IconComponent.new(name: 'stack', size: '1.5rem') %>
1
+ <%# z-[5]: below PageLayoutComponent (z-10 / z-40), above preview shell (z-0). editor-preview-empty: tailwind.css.erb @custom-variant on [data-controller~="editor-page-preview"].is-empty %>
2
+ <div class="fixed top-16 left-16 right-0 bottom-0 z-[5] bg-gray-50 hidden editor-preview-empty:block">
3
+ <div class="flex min-h-full flex-col items-center justify-center px-4">
4
+ <h2 class="text-center text-2xl font-bold">
5
+ <%= t('maglev.editor.page_preview.empty.title') %>
6
+ </h2>
7
+ <div class="mt-4 max-w-md mx-auto leading-9 text-gray-600">
8
+ <% new_section_link = capture do %>
9
+ <%= link_to new_editor_section_path(**maglev_editing_route_context), class: 'text-editor-primary inline-block relative top-1.5', data: { turbo_frame: 'modal' } do %>
10
+ <%= render Maglev::Uikit::IconComponent.new(name: 'stack', size: '1.5rem') %>
11
+ <% end %>
9
12
  <% end %>
10
- <% end %>
11
13
 
12
- <%= t('maglev.editor.page_preview.empty.message', button: new_section_link).html_safe %>
14
+ <%= t('maglev.editor.page_preview.empty.message', button: new_section_link).html_safe %>
15
+ </div>
13
16
  </div>
14
17
  </div>
@@ -0,0 +1,16 @@
1
+ <%= turbo_stream.console_log 'Discard page draft' %>
2
+
3
+ <%= turbo_stream.dispatch_event "page-preview:reload", payload: {}.to_json %>
4
+
5
+ <%= turbo_stream.update dom_id(current_maglev_page, 'topbar-page-info'), method: 'morph' do %>
6
+ <%= render 'layouts/maglev/editor/topbar/page_info' %>
7
+ <% end %>
8
+
9
+ <%= turbo_stream.update dom_id(current_maglev_page, 'topbar-publish-button'), method: 'morph' do %>
10
+ <%= render 'layouts/maglev/editor/topbar/publish_button' %>
11
+ <% end %>
12
+
13
+ <%= turbo_stream.refresh %>
14
+
15
+ <%#= turbo_stream.refresh delayed: true %>
16
+
@@ -18,6 +18,13 @@
18
18
  </div>
19
19
 
20
20
  <% page_layout.with_footer do %>
21
- <%= link_to t('maglev.editor.pages.list.new_button'), new_editor_page_path(**maglev_editing_route_context, **query_params), class: maglev_button_classes(size: :big), data: { turbo_frame: '_top' } %>
21
+ <div>
22
+ <% if defined?(@pagy) && @pagy.present? %>
23
+ <div class="pb-2">
24
+ <%= render Maglev::Uikit::PaginationComponent.new(pagy: @pagy, hidden_if_single_page: false, show_info: false) %>
25
+ </div>
26
+ <% end %>
27
+ <%= link_to t('maglev.editor.pages.list.new_button'), new_editor_page_path(**maglev_editing_route_context, **query_params), class: maglev_button_classes(size: :big), data: { turbo_frame: '_top' } %>
28
+ </div>
22
29
  <% end %>
23
30
  <% end %>
@@ -1 +1,3 @@
1
- <%= turbo_stream.console_log 'Publication created' %>
1
+ <%= turbo_stream.console_log 'Publication created' %>
2
+
3
+ <%= turbo_stream.refresh delayed: true %>
@@ -1,15 +1,7 @@
1
- <%= hidden_field_tag 'lock_version', @section_block.lock_version.presence || 0, data: { editor_section_form_target: 'lockVersion' } %>
2
-
3
- <% if @section_block.definition.advanced_settings.blank? %>
4
- <%= section_block_form_settings(@section, @section_block) %>
5
- <% else %>
6
- <%= render Maglev::Uikit::TabsComponent.new(container_classes: 'w-full h-full flex flex-col') do |tabs| %>
7
- <% tabs.with_tab(label: t('maglev.editor.section_blocks.edit.tabs.main')) do %>
8
- <%= section_block_form_settings(@section, @section_block) %>
9
- <% end %>
10
-
11
- <% tabs.with_tab(label: t('maglev.editor.section_blocks.edit.tabs.advanced')) do %>
12
- <%= section_block_form_settings(@section, @section_block, advanced: true) %>
13
- <% end %>
1
+ <% if @section_block.definition.empty? %>
2
+ <%= render Maglev::Uikit::Well::SimpleWellComponent.new do |well| %>
3
+ <% well.with_title_content(t('maglev.editor.section_blocks.edit.no_settings')) %>
14
4
  <% end %>
5
+ <% else %>
6
+ <%= section_block_form_settings(@section, @section_block, advanced: defined?(advanced) && advanced) %>
15
7
  <% end %>
@@ -0,0 +1,15 @@
1
+ <%= hidden_field_tag 'lock_version', source_lock_version, data: { editor_section_form_target: 'lockVersion' } %>
2
+
3
+ <% if @section_block.definition.advanced_settings.blank? %>
4
+ <%= render 'maglev/editor/section_blocks/form' %>
5
+ <% else %>
6
+ <%= render Maglev::Uikit::TabsComponent.new(container_classes: 'w-full h-full flex flex-col') do |tabs| %>
7
+ <% tabs.with_tab(label: t('maglev.editor.section_blocks.edit.tabs.main')) do %>
8
+ <%= render 'maglev/editor/section_blocks/form' %>
9
+ <% end %>
10
+
11
+ <% tabs.with_tab(label: t('maglev.editor.section_blocks.edit.tabs.advanced')) do %>
12
+ <%= render 'maglev/editor/section_blocks/form', advanced: true %>
13
+ <% end %>
14
+ <% end %>
15
+ <% end %>
@@ -6,7 +6,7 @@
6
6
  'editor-preview-notification-center-section-id-param': @section.id,
7
7
  } do |f| %>
8
8
  <%= f.hidden_field :parent_id, value: parent_id if parent_id %>
9
- <%= f.hidden_field :lock_version, value: @section.lock_version %>
9
+ <%= f.hidden_field :lock_version, value: source_lock_version %>
10
10
 
11
11
  <div class="space-y-4">
12
12
  <% blocks.each do |block_definition| %>
@@ -12,7 +12,7 @@
12
12
  controller: 'editor-section-form',
13
13
  'editor-section-form-section-id-value': @section.id,
14
14
  'editor-section-form-section-block-id-value': @section_block.id,
15
- 'editor-section-form-section-lock-version-value': @section.lock_version,
15
+ 'editor-section-form-section-lock-version-value': source_lock_version,
16
16
  action: %(
17
17
  editor-setting:change->editor-section-form#onSettingChange
18
18
  editor-section-form:connected@window->editor-preview-notification-center#checkSectionLockVersion
@@ -23,6 +23,6 @@
23
23
  dispatcher:section-block-#{@section_block.id}:persisted@window->editor-section-form#onPersist
24
24
  )
25
25
  } do %>
26
- <%= render 'maglev/editor/section_blocks/form' %>
26
+ <%= render 'maglev/editor/section_blocks/form_with_tabs' %>
27
27
  <% end %>
28
28
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <% if @section.blocks.any? %>
2
2
  <%= render Maglev::Uikit::List::ListComponent.new(
3
3
  sort_form: {
4
- path: sort_editor_section_blocks_path(@section, lock_version: @section.lock_version, **maglev_editing_route_context),
4
+ path: sort_editor_section_blocks_path(@section, lock_version: source_lock_version, **maglev_editing_route_context),
5
5
  data: {
6
6
  turbo_frame: '_top',
7
7
  action: 'sortable:drag-stopped@window->editor-preview-notification-center#moveSectionBlocks',
@@ -35,7 +35,7 @@
35
35
  <% end %>
36
36
  <% end %>
37
37
  <% else %>
38
- <p class="text-center mt-8 text-gray-800">
38
+ <p class="text-center mt-8 text-gray-500">
39
39
  <%= t('maglev.editor.section_blocks.index.empty') %>
40
40
  </p>
41
41
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <%= render Maglev::Uikit::List::ListComponent.new(
2
2
  sort_form: {
3
- path: sort_editor_section_blocks_path(@section, parent_id: parent_id, lock_version: @section.lock_version, **maglev_editing_route_context),
3
+ path: sort_editor_section_blocks_path(@section, parent_id: parent_id, lock_version: source_lock_version, **maglev_editing_route_context),
4
4
  data: { turbo_frame: '_top' }
5
5
  },
6
6
  sortable_scope: parent_id || 'root',
@@ -1,5 +1,13 @@
1
+ <%= turbo_stream.dispatch_event "section-block-#{@section_block.id}:persisted", payload: { lockVersion: source_lock_version }.to_json %>
2
+
1
3
  <%= turbo_stream.update 'page-layout-notification', method: 'morph' do %>
2
4
  <%= render Maglev::Uikit::BadgeComponent.new(color: :green, icon_name: 'checkbox_circle', disappear_after: 3.seconds).with_content(flash.now[:notice]) %>
3
5
  <% end %>
4
6
 
5
- <%= turbo_stream.dispatch_event "section-block-#{@section_block.id}:persisted", payload: { lockVersion: @section_block.lock_version }.to_json %>
7
+ <%= turbo_stream.update dom_id(current_maglev_page, 'topbar-page-info'), method: 'morph' do %>
8
+ <%= render 'layouts/maglev/editor/topbar/page_info' %>
9
+ <% end %>
10
+
11
+ <%= turbo_stream.update dom_id(current_maglev_page, 'topbar-publish-button'), method: 'morph' do %>
12
+ <%= render 'layouts/maglev/editor/topbar/publish_button' %>
13
+ <% end %>
@@ -1,21 +1,7 @@
1
- <%= hidden_field_tag 'lock_version', @section.lock_version.presence || 0, data: { editor_section_form_target: 'lockVersion' } %>
2
-
3
- <% if @section.definition.blocks.none? && !@section.definition.advanced_settings.any? %>
4
- <%= section_form_settings(@section) %>
5
- <% else %>
6
- <%= render Maglev::Uikit::TabsComponent.new(container_classes: 'w-full h-full flex flex-col') do |tabs| %>
7
- <% tabs.with_tab(label: t('maglev.editor.sections.edit.tabs.main')) do %>
8
- <%= section_form_settings(@section) %>
9
- <% end %>
10
-
11
- <% tabs.with_tab(label: t('maglev.editor.sections.edit.tabs.advanced')) do %>
12
- <%= section_form_settings(@section, advanced: true) %>
13
- <% end if @section.definition.advanced_settings.any? %>
14
-
15
- <% tabs.with_tab(
16
- label: @section.blocks_label,
17
- link: { url: editor_section_blocks_path(@section, maglev_editing_route_context), html_options: { data: { turbo_frame: '_top' } } }
18
- ) unless @section.definition.blocks.none?
19
- %>
1
+ <% if @section.definition.empty? %>
2
+ <%= render Maglev::Uikit::Well::SimpleWellComponent.new do |well| %>
3
+ <% well.with_title_content(t('maglev.editor.sections.edit.no_settings')) %>
20
4
  <% end %>
21
- <% end %>
5
+ <% else %>
6
+ <%= section_form_settings(@section, advanced: defined?(advanced) && advanced) %>
7
+ <% end %>
@@ -0,0 +1,21 @@
1
+ <%= hidden_field_tag 'lock_version', source_lock_version, data: { editor_section_form_target: 'lockVersion' } %>
2
+
3
+ <% if @section.definition.blocks.none? && !@section.definition.advanced_settings.any? %>
4
+ <%= render 'maglev/editor/sections/form' %>
5
+ <% else %>
6
+ <%= render Maglev::Uikit::TabsComponent.new(container_classes: 'w-full h-full flex flex-col') do |tabs| %>
7
+ <% tabs.with_tab(label: t('maglev.editor.sections.edit.tabs.main')) do %>
8
+ <%= render 'maglev/editor/sections/form' %>
9
+ <% end %>
10
+
11
+ <% tabs.with_tab(label: t('maglev.editor.sections.edit.tabs.advanced')) do %>
12
+ <%= render 'maglev/editor/sections/form', advanced: true %>
13
+ <% end if @section.definition.advanced_settings.any? %>
14
+
15
+ <% tabs.with_tab(
16
+ label: @section.blocks_label,
17
+ link: { url: editor_section_blocks_path(@section, maglev_editing_route_context), html_options: { data: { turbo_frame: '_top' } } }
18
+ ) unless @section.definition.blocks.none?
19
+ %>
20
+ <% end %>
21
+ <% end %>
@@ -43,7 +43,7 @@
43
43
  <% end %>
44
44
  <% end %>
45
45
  <% else %>
46
- <p class="text-center mt-8 text-gray-800">
46
+ <p class="text-center mt-8 text-gray-500">
47
47
  <%= t('maglev.editor.sections.index.empty') %>
48
48
  </p>
49
49
  <% end %>
@@ -7,7 +7,7 @@
7
7
  <%= form_with url: editor_section_path(@section, maglev_editing_route_context), method: :put, data: {
8
8
  controller: 'editor-section-form',
9
9
  'editor-section-form-section-id-value': @section.id,
10
- 'editor-section-form-section-lock-version-value': @section.lock_version,
10
+ 'editor-section-form-section-lock-version-value': source_lock_version,
11
11
  action: %(
12
12
  editor-setting:change->editor-section-form#onSettingChange
13
13
  editor-section-form:connected@window->editor-preview-notification-center#checkSectionLockVersion
@@ -18,7 +18,7 @@
18
18
  dispatcher:section-#{@section.id}:persisted@window->editor-section-form#onPersist
19
19
  )
20
20
  } do
21
- %>
22
- <%= render 'maglev/editor/sections/form' %>
21
+ %>
22
+ <%= render 'maglev/editor/sections/form_with_tabs' %>
23
23
  <% end %>
24
24
  <% end %>
@@ -6,6 +6,6 @@
6
6
  <%= render 'list' %>
7
7
 
8
8
  <% page_layout.with_footer do %>
9
- <%= link_to t('maglev.editor.sections.index.add_button'), new_editor_section_path(maglev_editing_route_context), class: maglev_button_classes(size: :big), data: { turbo_frame: '_top' } %>
9
+ <%= link_to t('maglev.editor.sections.index.add_button'), new_editor_section_path(maglev_editing_route_context), class: maglev_button_classes(size: :big), data: { turbo_frame: 'modal' } %>
10
10
  <% end %>
11
11
  <% end %>
@@ -1,3 +1,20 @@
1
+ <%= turbo_frame_tag 'modal' do %>
2
+ <%= render Maglev::Uikit::ModalComponent.new(id: 'new-section-modal', open: true) do |modal| %>
3
+ <% modal.with_title_content t('maglev.editor.sections.new.title') %>
4
+ <% modal.with_notification_content maglev_flash_message %>
5
+
6
+ <div class="flex h-[calc(100dvh-16rem)] min-h-0 w-[calc(100dvw-4rem)] flex-col gap-2 lg:w-3xl xl:w-5xl">
7
+ <%= render 'maglev/editor/sections/theme/search' %>
8
+
9
+ <% if @theme_sections.any? %>
10
+ <%= render 'maglev/editor/sections/theme/list' %>
11
+ <% else %>
12
+ <%= render 'maglev/editor/sections/theme/empty_list' %>
13
+ <% end %>
14
+ </div>
15
+ <% end %>
16
+ <% end %>
17
+
1
18
  <%= render Maglev::Uikit::PageLayoutComponent.new(expanded: true, back_path: editor_real_root_path(maglev_editing_route_context)) do |page_layout| %>
2
19
  <% page_layout.with_title_content t('maglev.editor.sections.new.title') %>
3
20
  <% page_layout.with_notification_content maglev_flash_message %>
@@ -17,4 +34,4 @@
17
34
 
18
35
  <%= render 'theme_list', f: f %>
19
36
  <% end %>
20
- <% end %>
37
+ <% end if false %>
@@ -0,0 +1,3 @@
1
+ <div class="flex min-h-0 flex-1 flex-col items-center justify-center px-4 py-12">
2
+ <p class="text-gray-500"><%= t('maglev.editor.sections.new.empty_list') %></p>
3
+ </div>
@@ -0,0 +1,35 @@
1
+ <div class="relative -mx-4 -my-4 flex min-h-0 flex-1 flex-col overflow-y-auto">
2
+ <%= form_with url: editor_sections_path(maglev_editing_route_context), html: { class: 'flex min-h-0 w-full flex-1 flex-col' }, data: {
3
+ turbo_frame: '_top',
4
+ controller: 'auto-save dispatcher',
5
+ action: %(
6
+ turbo:submit-end->editor-preview-notification-center#addSection
7
+ turbo:submit-end->dispatcher#trigger
8
+ turbo:submit-end->uikit-modal#close:self
9
+ ),
10
+ 'dispatcher-event-name-value': 'page-preview:remove-empty-message'
11
+ } do |f| %>
12
+ <%= f.hidden_field :position, value: @position %>
13
+
14
+ <div class="grid w-full grid-cols-1 gap-4 px-4 py-4 md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3">
15
+ <% @theme_sections.each do |section| %>
16
+ <%= render Maglev::Uikit::List::ListItemComponent.new(options: {
17
+ wrapper_tag: :label,
18
+ wrapper_classes: 'cursor-pointer transition duration-150 ease-in-out transform hover:scale-105 hover:z-10 hover:ring-2 hover:ring-inset hover:ring-editor-primary/50' }
19
+ ) do |item| %>
20
+ <% item.with_big_image do %>
21
+ <% if screenshot_url = services.fetch_section_screenshot_url.call(section: section) %>
22
+ <%= image_tag screenshot_url, class: item.big_image_classes(class: 'rounded-md border border-gray-200'), data: { controller: 'broken-image' } %>
23
+ <% else %>
24
+ <%= render 'maglev/editor/sections/theme/screenshot_placeholder' %>
25
+ <% end %>
26
+ <% end %>
27
+
28
+ <% item.with_title_content(section.human_name) %>
29
+
30
+ <%= f.radio_button :section_type, section.id, class: 'sr-only peer' %>
31
+ <% end %>
32
+ <% end %>
33
+ </div>
34
+ <% end %>
35
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="relative bg-gray-200 rounded p-4">
2
+ <div class="h-12 bg-gray-300 mb-3 rounded"></div>
3
+ <div class="h-3 bg-gray-300 w-2/3 mb-2 rounded"></div>
4
+ <div class="h-3 bg-gray-300 w-1/2 mb-3 rounded"></div>
5
+ <div class="h-6 bg-gray-400 w-24 rounded"></div>
6
+ </div>