alchemy_cms 5.0.1 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +1 -1
  3. data/.github/workflows/ci.yml +126 -0
  4. data/.github/workflows/stale.yml +1 -1
  5. data/.gitignore +1 -0
  6. data/CHANGELOG.md +66 -2
  7. data/CONTRIBUTING.md +2 -2
  8. data/Gemfile +2 -2
  9. data/README.md +2 -2
  10. data/alchemy_cms.gemspec +3 -3
  11. data/app/assets/images/alchemy/missing-image.svg +1 -0
  12. data/app/assets/javascripts/alchemy/admin.js +0 -1
  13. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +1 -4
  14. data/app/assets/javascripts/alchemy/alchemy.preview.js.coffee +0 -3
  15. data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +29 -4
  16. data/app/assets/stylesheets/alchemy/_variables.scss +8 -0
  17. data/app/assets/stylesheets/alchemy/admin.scss +0 -1
  18. data/app/assets/stylesheets/alchemy/archive.scss +23 -17
  19. data/app/assets/stylesheets/alchemy/buttons.scss +26 -15
  20. data/app/assets/stylesheets/alchemy/elements.scss +58 -19
  21. data/app/assets/stylesheets/alchemy/errors.scss +1 -1
  22. data/app/assets/stylesheets/alchemy/frame.scss +0 -1
  23. data/app/assets/stylesheets/alchemy/hints.scss +2 -1
  24. data/app/assets/stylesheets/alchemy/navigation.scss +7 -10
  25. data/app/assets/stylesheets/alchemy/pagination.scss +1 -1
  26. data/app/assets/stylesheets/alchemy/search.scss +13 -3
  27. data/app/assets/stylesheets/alchemy/selects.scss +26 -20
  28. data/app/assets/stylesheets/alchemy/tables.scss +38 -9
  29. data/app/assets/stylesheets/alchemy/tags.scss +19 -31
  30. data/app/controllers/alchemy/admin/pages_controller.rb +58 -8
  31. data/app/controllers/alchemy/admin/pictures_controller.rb +13 -6
  32. data/app/controllers/alchemy/admin/resources_controller.rb +3 -3
  33. data/app/controllers/alchemy/pages_controller.rb +49 -14
  34. data/app/decorators/alchemy/element_editor.rb +1 -0
  35. data/app/helpers/alchemy/admin/base_helper.rb +0 -44
  36. data/app/helpers/alchemy/admin/navigation_helper.rb +2 -1
  37. data/app/models/alchemy/attachment.rb +20 -3
  38. data/app/models/alchemy/attachment/url.rb +40 -0
  39. data/app/models/alchemy/essence_picture.rb +3 -3
  40. data/app/models/alchemy/essence_picture_view.rb +5 -3
  41. data/app/models/alchemy/legacy_page_url.rb +1 -1
  42. data/app/models/alchemy/page.rb +24 -1
  43. data/app/models/alchemy/page/page_natures.rb +2 -0
  44. data/app/models/alchemy/page/url_path.rb +8 -6
  45. data/app/models/alchemy/picture.rb +58 -2
  46. data/app/models/alchemy/picture/calculations.rb +55 -0
  47. data/app/models/alchemy/picture/transformations.rb +5 -49
  48. data/app/models/alchemy/picture/url.rb +28 -77
  49. data/app/models/alchemy/picture_thumb.rb +57 -0
  50. data/app/models/alchemy/picture_thumb/create.rb +39 -0
  51. data/app/models/alchemy/picture_thumb/signature.rb +23 -0
  52. data/app/models/alchemy/picture_thumb/uid.rb +22 -0
  53. data/app/models/alchemy/picture_variant.rb +114 -0
  54. data/app/models/alchemy/site/layout.rb +30 -2
  55. data/app/serializers/alchemy/page_tree_serializer.rb +4 -4
  56. data/app/views/alchemy/admin/attachments/show.html.erb +8 -8
  57. data/app/views/alchemy/admin/dashboard/index.html.erb +13 -16
  58. data/app/views/alchemy/admin/elements/_element_footer.html.erb +1 -1
  59. data/app/views/alchemy/admin/elements/publish.js.erb +1 -0
  60. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +1 -1
  61. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +2 -2
  62. data/app/views/alchemy/admin/layoutpages/edit.html.erb +4 -6
  63. data/app/views/alchemy/admin/pages/_create_language_form.html.erb +19 -29
  64. data/app/views/alchemy/admin/pages/_form.html.erb +4 -6
  65. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +12 -2
  66. data/app/views/alchemy/admin/pages/_page_layout_filter.html.erb +29 -0
  67. data/app/views/alchemy/admin/pages/_table.html.erb +27 -0
  68. data/app/views/alchemy/admin/pages/_table_row.html.erb +107 -0
  69. data/app/views/alchemy/admin/pages/_toolbar.html.erb +77 -0
  70. data/app/views/alchemy/admin/pages/edit.html.erb +9 -1
  71. data/app/views/alchemy/admin/pages/index.html.erb +41 -74
  72. data/app/views/alchemy/admin/pages/list/_table.html.erb +31 -0
  73. data/app/views/alchemy/admin/pages/unlock.js.erb +2 -2
  74. data/app/views/alchemy/admin/pages/update.js.erb +19 -10
  75. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +14 -13
  76. data/app/views/alchemy/admin/partials/_search_form.html.erb +8 -8
  77. data/app/views/alchemy/admin/pictures/_archive.html.erb +1 -1
  78. data/app/views/alchemy/admin/pictures/_form.html.erb +1 -1
  79. data/app/views/alchemy/admin/pictures/_picture.html.erb +3 -3
  80. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -1
  81. data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +1 -1
  82. data/app/views/alchemy/admin/pictures/index.html.erb +1 -1
  83. data/app/views/alchemy/admin/pictures/show.html.erb +3 -3
  84. data/app/views/alchemy/admin/resources/_filter_bar.html.erb +13 -11
  85. data/app/views/alchemy/admin/resources/_per_page_select.html.erb +3 -3
  86. data/app/views/alchemy/admin/resources/index.html.erb +4 -1
  87. data/app/views/alchemy/admin/tags/index.html.erb +14 -15
  88. data/app/views/alchemy/base/500.html.erb +11 -13
  89. data/app/views/alchemy/essences/_essence_file_view.html.erb +3 -3
  90. data/config/alchemy/config.yml +15 -11
  91. data/config/alchemy/modules.yml +12 -12
  92. data/config/locales/alchemy.en.yml +6 -4
  93. data/config/routes.rb +1 -1
  94. data/db/migrate/20200617110713_create_alchemy_picture_thumbs.rb +22 -0
  95. data/db/migrate/20200907111332_remove_tri_state_booleans.rb +33 -0
  96. data/lib/alchemy.rb +66 -0
  97. data/lib/alchemy/admin/preview_url.rb +2 -0
  98. data/lib/alchemy/auth_accessors.rb +12 -5
  99. data/lib/alchemy/config.rb +1 -3
  100. data/lib/alchemy/engine.rb +7 -6
  101. data/lib/alchemy/modules.rb +11 -1
  102. data/lib/alchemy/permissions.rb +1 -0
  103. data/lib/alchemy/test_support/factories/picture_factory.rb +0 -1
  104. data/lib/alchemy/test_support/factories/picture_thumb_factory.rb +12 -0
  105. data/lib/alchemy/test_support/integration_helpers.rb +0 -7
  106. data/lib/alchemy/version.rb +1 -1
  107. data/lib/alchemy_cms.rb +2 -4
  108. data/lib/generators/alchemy/install/files/alchemy.en.yml +2 -2
  109. data/lib/generators/alchemy/install/templates/dragonfly.rb.tt +5 -5
  110. data/lib/tasks/alchemy/thumbnails.rake +37 -0
  111. data/vendor/assets/javascripts/jquery_plugins/select2.js +3729 -0
  112. data/vendor/assets/stylesheets/alchemy_admin/select2.scss +740 -0
  113. metadata +46 -37
  114. data/.github/workflows/greetings.yml +0 -13
  115. data/.travis.yml +0 -48
  116. data/app/controllers/concerns/alchemy/locale_redirects.rb +0 -40
  117. data/app/controllers/concerns/alchemy/page_redirects.rb +0 -68
  118. data/lib/alchemy/userstamp.rb +0 -12
@@ -0,0 +1,29 @@
1
+ <div id="page_layout_filter">
2
+ <label>
3
+ <h3><%= Alchemy::Page.human_attribute_name(:page_layout) %></h3>
4
+ <%= select_tag(
5
+ "page_layout",
6
+ options_for_select(
7
+ @current_language.site.page_layout_names.map do |layout|
8
+ [
9
+ Alchemy::PageLayout.human_layout_name(layout),
10
+ layout
11
+ ]
12
+ end,
13
+ search_filter_params[:page_layout]
14
+ ),
15
+ include_blank: Alchemy.t(:all, scope: ["resources", "page", "filters"]),
16
+ class: "alchemy_selectbox full_width"
17
+ ) %>
18
+ </label>
19
+ </div>
20
+
21
+ <script type="text/javascript">
22
+ $(function() {
23
+ $("#page_layout").on("change", function(e) {
24
+ var url = "<%= alchemy.admin_pages_path(search_filter_params.except(:page_layout, :page).merge(view: "list")) %>";
25
+ delimiter = url.match(/\?/) ? "&" : "?";
26
+ Turbolinks.visit(url + delimiter + "page_layout=" + encodeURIComponent($(this).val()));
27
+ });
28
+ });
29
+ </script>
@@ -0,0 +1,27 @@
1
+ <table class="list">
2
+ <thead>
3
+ <tr>
4
+ <th class="icon"></th>
5
+ <th class="string name">
6
+ <%= sort_link [:alchemy, @query],
7
+ "name",
8
+ Alchemy::Page.human_attribute_name(:name),
9
+ default_order: "asc" %>
10
+ </th>
11
+ <th><%= Alchemy::Page.human_attribute_name(:urlname) %></th>
12
+ <th><%= Alchemy::Page.human_attribute_name(:page_type) %></th>
13
+ <th><%= Alchemy::Page.human_attribute_name(:tag_list) %></th>
14
+ <th>
15
+ <%= sort_link [:alchemy, @query],
16
+ :updated_at,
17
+ Alchemy::Page.human_attribute_name(:updated_at),
18
+ default_order: "desc" %>
19
+ </th>
20
+ <th class="status center"><%= Alchemy::Page.human_attribute_name(:status) %></th>
21
+ <th class="tools"></th>
22
+ </tr>
23
+ </thead>
24
+ <tbody>
25
+ <%= render partial: "table_row", collection: @pages, as: "page" %>
26
+ </tbody>
27
+ </table>
@@ -0,0 +1,107 @@
1
+ <tr class="<%= cycle(:even, :odd) %>" data-page-id="<%= page.id %>">
2
+ <td class="icon">
3
+ <% if can?(:edit_content, page) %>
4
+ <% if page.locked? %>
5
+ <span class="with-hint">
6
+ <i class="icon fas fa-edit fa-fw"></i>
7
+ <span class="hint-bubble">
8
+ <%= Alchemy.t("This page is locked", name: page.locker_name) %>
9
+ </span>
10
+ </span>
11
+ <% else %>
12
+ <i class="icon far fa-file fa-lg"></i>
13
+ <% end %>
14
+ <% else %>
15
+ <span class="with-hint">
16
+ <i class="icon fas fa-ban fa-fw"></i>
17
+ <span class="hint-bubble">
18
+ <%= Alchemy.t("Your user role does not allow you to edit this page") %>
19
+ </span>
20
+ </span>
21
+ <% end %>
22
+ </td>
23
+ <td class="string name">
24
+ <%= link_to_if(
25
+ can?(:edit_content, page),
26
+ page.name,
27
+ alchemy.edit_admin_page_path(page),
28
+ title: Alchemy.t(:edit_page),
29
+ ) { content_tag(:span, page.name) } -%>
30
+ </td>
31
+ <td class="url">
32
+ <%= page.url_path %>
33
+ </td>
34
+ <td class="page_layout">
35
+ <%= Alchemy.t(page.page_layout, scope: "page_layout_names", default: page.page_layout.to_s.humanize) %>
36
+ </td>
37
+ <td class="tags">
38
+ <% page.tag_list.each do |tag| %>
39
+ <%= content_tag(:span, tag, class: "tag") %>
40
+ <% end %>
41
+ </td>
42
+ <td class="date">
43
+ <%= l(page.updated_at, format: :"alchemy.default") %>
44
+ </td>
45
+ <td class="status center">
46
+ <span class="page_status with-hint">
47
+ <i class="icon fas fa-fw fa-compass <% unless page.public? %>disabled<% end %>" data-fa-transform="shrink-2"></i>
48
+ <span class="hint-bubble"><%= page.status_title(:public) %></span>
49
+ </span>
50
+ <span class="page_status with-hint">
51
+ <i class="icon fas fa-fw fa-lock <% unless page.restricted? %>disabled<% end %>" data-fa-transform="shrink-2"></i>
52
+ <span class="hint-bubble"><%= page.status_title(:restricted) %></span>
53
+ </span>
54
+ </td>
55
+ <td class="tools">
56
+ <% if can?(:info, page) %>
57
+ <div class="button_with_label">
58
+ <%= link_to_dialog(
59
+ render_icon('info-circle'),
60
+ alchemy.info_admin_page_path(page),
61
+ {
62
+ title: Alchemy.t(:page_infos),
63
+ size: '520x290'
64
+ }
65
+ ) %>
66
+ <label class="center"><%= Alchemy.t(:page_infos) %></label>
67
+ </div>
68
+ <% end %>
69
+ <% if can?(:configure, page) %>
70
+ <div class="button_with_label sitemap_tool">
71
+ <%= link_to_dialog(
72
+ render_icon(:cog),
73
+ alchemy.configure_admin_page_path(page),
74
+ {
75
+ title: Alchemy.t(:edit_page_properties),
76
+ size: '450x680'
77
+ }
78
+ ) -%>
79
+ <label class="center"><%= Alchemy.t(:edit_page_properties) %></label>
80
+ </div>
81
+ <% end %>
82
+ <% if can?(:copy, page) %>
83
+ <div class="button_with_label sitemap_tool">
84
+ <%= link_to(
85
+ render_icon(:copy),
86
+ alchemy.insert_admin_clipboard_path(
87
+ remarkable_type: :pages,
88
+ remarkable_id: page.id,
89
+ ),
90
+ remote: true,
91
+ method: :post
92
+ ) %>
93
+ <label class="center"><%= Alchemy.t(:copy_page) %></label>
94
+ </div>
95
+ <% end %>
96
+ <% if can?(:destroy, page) %>
97
+ <div class="button_with_label">
98
+ <%= link_to_confirm_dialog(
99
+ render_icon(:minus),
100
+ Alchemy.t(:confirm_to_delete_page),
101
+ alchemy.admin_page_path(page)
102
+ ) -%>
103
+ <label class="center"><%= Alchemy.t(:delete_page) %></label>
104
+ </div>
105
+ <% end %>
106
+ </td>
107
+ </tr>
@@ -0,0 +1,77 @@
1
+ <div class="toolbar_buttons">
2
+ <%= render "alchemy/admin/partials/site_select" %>
3
+ <%= render "alchemy/admin/partials/language_tree_select" %>
4
+ <%= toolbar_button(
5
+ icon: :plus,
6
+ url: alchemy.new_admin_page_path(language: @current_language),
7
+ hotkey: 'alt+n',
8
+ dialog_options: {
9
+ title: Alchemy.t('Add a page'),
10
+ size: '340x215',
11
+ overflow: true
12
+ },
13
+ title: Alchemy.t('Add a page'),
14
+ label: Alchemy.t('Add a page'),
15
+ if_permitted_to: [:create, Alchemy::Page]
16
+ ) %>
17
+ <div class="toolbar_spacer"></div>
18
+ <% if can?(:flush, Alchemy::Page) %>
19
+ <div class="button_with_label">
20
+ <%= link_to(
21
+ render_icon(:eraser),
22
+ alchemy.flush_admin_pages_path,
23
+ remote: true,
24
+ method: :post,
25
+ class: "icon_button please_wait",
26
+ title: Alchemy.t("Flush page cache")
27
+ ) %>
28
+ <label><%= Alchemy.t("Flush page cache") %></label>
29
+ </div>
30
+ <% end %>
31
+ <% if can?(:sort, Alchemy::Page) %>
32
+ <div class="button_with_label">
33
+ <%= link_to(
34
+ render_icon(:random),
35
+ alchemy.sort_admin_pages_path,
36
+ method: :get,
37
+ class: "icon_button",
38
+ title: Alchemy.t("Sort pages")
39
+ ) %>
40
+ <label><%= Alchemy.t("Sort pages") %></label>
41
+ </div>
42
+ <% end %>
43
+ <div class="button_with_label" id="clipboard_button">
44
+ <%= link_to_dialog(
45
+ render_icon(clipboard_empty?("pages") ? :clipboard : :paste),
46
+ alchemy.admin_clipboard_path(remarkable_type: "pages"),
47
+ {
48
+ title: Alchemy.t("Clipboard"),
49
+ size: "380x305"
50
+ },
51
+ class: "icon_button",
52
+ title: Alchemy.t("Show clipboard")
53
+ ) %>
54
+ <label><%= Alchemy.t("Show clipboard") %></label>
55
+ </div>
56
+ <div class="toolbar_spacer"></div>
57
+ <div class="button_with_label<%= @view != "list" ? " active" : nil %>">
58
+ <%= link_to(
59
+ render_icon(:stream),
60
+ alchemy.admin_pages_path(view: "tree"),
61
+ class: "icon_button"
62
+ ) %>
63
+ <label><%= Alchemy.t("Hierarchical") %></label>
64
+ </div>
65
+ <div class="button_with_label<%= @view == "list" ? " active" : nil %>">
66
+ <%= link_to(
67
+ render_icon("sort-amount-down-alt"),
68
+ alchemy.admin_pages_path(view: "list"),
69
+ class: "icon_button"
70
+ ) %>
71
+ <label><%= Alchemy.t("Sortable List") %></label>
72
+ </div>
73
+ </div>
74
+ <% search_filter_params[:view] = "list" %>
75
+ <%= render "alchemy/admin/partials/search_form",
76
+ url: alchemy.admin_pages_path(search_filter_params.except(:q, :page)),
77
+ additional_params: [:view, :page_layout, :tagged_with, :filter] %>
@@ -88,6 +88,14 @@
88
88
  class: 'alchemy_selectbox medium' %>
89
89
  </div>
90
90
  <div class="toolbar_spacer"></div>
91
+ <% if @preview_urls.many? %>
92
+ <div class="select_with_label">
93
+ <label><%= Alchemy.t(:preview_url) %></label>
94
+ <%= select_tag 'preview_url',
95
+ options_for_select(@preview_urls),
96
+ class: 'alchemy_selectbox large' %>
97
+ </div>
98
+ <% end %>
91
99
  <div class="button_with_label">
92
100
  <%= link_to render_icon(:redo), nil, {
93
101
  title: Alchemy.t('Reload Preview'),
@@ -190,7 +198,7 @@
190
198
  }
191
199
  });
192
200
 
193
- Alchemy.PreviewWindow.init('<%= @preview_url %>');
201
+ Alchemy.PreviewWindow.init(<%== @preview_urls.first %>);
194
202
 
195
203
  $('#preview_size').bind('open.selectBoxIt', function (e) {
196
204
  $('#top_menu').css('z-index', 5000);
@@ -3,81 +3,48 @@
3
3
  <% end %>
4
4
 
5
5
  <% content_for :toolbar do %>
6
- <div class="toolbar_buttons">
7
- <%= render 'alchemy/admin/partials/site_select' %>
8
- <%= render 'alchemy/admin/partials/language_tree_select' %>
9
- <% if can?(:flush, Alchemy::Page) %>
10
- <div class="button_with_label">
11
- <%= link_to(
12
- render_icon(:eraser),
13
- alchemy.flush_admin_pages_path,
14
- :remote => true,
15
- :method => :post,
16
- :class => 'icon_button please_wait',
17
- :title => Alchemy.t('Flush page cache')
18
- ) %>
19
- <label><%= Alchemy.t('Flush page cache') %></label>
20
- </div>
21
- <% end %>
22
- <% if can?(:sort, Alchemy::Page) %>
23
- <div class="button_with_label">
24
- <%= link_to(
25
- render_icon(:random),
26
- alchemy.sort_admin_pages_path,
27
- method: :get,
28
- class: 'icon_button',
29
- title: Alchemy.t('Sort pages')
30
- ) %>
31
- <label><%= Alchemy.t('Sort pages') %></label>
32
- </div>
33
- <% end %>
34
- <div class="button_with_label" id="clipboard_button">
35
- <%= link_to_dialog(
36
- render_icon(clipboard_empty?('pages') ? :clipboard : :paste),
37
- alchemy.admin_clipboard_path(:remarkable_type => 'pages'),
38
- {
39
- :title => Alchemy.t('Clipboard'),
40
- :size => '380x305'
41
- },
42
- :class => 'icon_button',
43
- :title => Alchemy.t('Show clipboard')
44
- ) %>
45
- <label><%= Alchemy.t('Show clipboard') %></label>
46
- </div>
47
- </div>
48
- <div class="search_form">
49
- <div class="search_field">
50
- <label>
51
- <%= text_field_tag 'filter', '',
52
- class: 'search_input_field',
53
- placeholder: Alchemy.t(:search),
54
- id: nil %>
55
- <%= render_icon :search %>
56
- </label>
57
- <%= link_to(render_icon(:times, size: 'xs'), '#', {
58
- class: "search_field_clear",
59
- title: Alchemy.t(:click_to_show_all)
60
- }) %>
61
- </div>
62
- </div>
6
+ <%= render "alchemy/admin/pages/toolbar" %>
63
7
  <% end %>
64
8
 
65
- <div id="archive_all">
66
- <% if @page_root %>
67
- <h2 id="page_filter_result"></h2>
68
-
69
- <%= render 'sitemap', page_partial: 'page', full: !!@sorting %>
70
-
71
- <% elsif can?(:create, Alchemy::Page) %>
72
-
73
- <%= render partial: 'create_language_form' %>
74
-
75
- <% else %>
76
-
77
- <%= render_message :warn do %>
78
- <h2>No language root page found.</h2>
79
- <p>Please ask the admin to create one.</p>
9
+ <%= content_tag :div,
10
+ id: "archive_all",
11
+ class: [@view == "list" && "resources-table-wrapper with_tag_filter"] do %>
12
+ <% if @view == "list" %>
13
+ <%= render "alchemy/admin/resources/table_header", resources_instance_variable: @pages %>
14
+ <% if @pages.any? %>
15
+ <%= render "table" %>
16
+ <% elsif search_filter_params.present? %>
17
+ <%= render_message do %>
18
+ <%= Alchemy.t("No pages found") %>
19
+ <% end %>
20
+ <% elsif can?(:create, Alchemy::Page) %>
21
+ <%= render partial: "create_language_form" %>
22
+ <% end %>
23
+
24
+ <%= paginate @pages, scope: alchemy, theme: "alchemy" %>
25
+
26
+ <div id="library_sidebar">
27
+ <%= render "page_layout_filter" %>
28
+
29
+ <%= render "filter_bar",
30
+ label: Alchemy::Page.human_attribute_name(:status),
31
+ url: alchemy.admin_pages_path(search_filter_params.except(:filter, :page).merge(view: "list")) %>
32
+
33
+ <% if resource_has_tags %>
34
+ <%= render "tag_list" %>
35
+ <% end %>
36
+ </div>
37
+ <% else %>
38
+ <% if @page_root %>
39
+ <h2 id="page_filter_result"></h2>
40
+ <%= render "sitemap", page_partial: "page", full: !!@sorting %>
41
+ <% elsif can?(:create, Alchemy::Page) %>
42
+ <%= render partial: "create_language_form" %>
43
+ <% else %>
44
+ <%= render_message :warn do %>
45
+ <h2>No language root page found.</h2>
46
+ <p>Please ask the admin to create one.</p>
47
+ <% end %>
48
+ <% end %>
80
49
  <% end %>
81
-
82
50
  <% end %>
83
- </div>
@@ -0,0 +1,31 @@
1
+ <% if @pages.any? %>
2
+ <table class="list">
3
+ <thead>
4
+ <tr>
5
+ <th class="icon"></th>
6
+ <th class="string name">
7
+ <%= sort_link [:alchemy, @query],
8
+ "name",
9
+ Alchemy::Page.human_attribute_name(:name),
10
+ default_order: "asc" %>
11
+ </th>
12
+ <th><%= Alchemy::Page.human_attribute_name(:urlname) %></th>
13
+ <th><%= Alchemy::Page.human_attribute_name(:page_type) %></th>
14
+ <th><%= Alchemy::Page.human_attribute_name(:tag_list) %></th>
15
+ <th class="status center"><%= Alchemy::Page.human_attribute_name(:status) %></th>
16
+ <th class="tools"></th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <%= render partial: "page", collection: @pages %>
21
+ </tbody>
22
+ </table>
23
+ <% elsif search_filter_params.present? %>
24
+ <%= render_message do %>
25
+ <%= Alchemy.t('No pages found') %>
26
+ <% end %>
27
+ <% else %>
28
+ <%= render partial: 'alchemy/admin/pages/create_language_form' %>
29
+ <% end %>
30
+
31
+ <%= paginate @pages, scope: alchemy, theme: 'alchemy' %>
@@ -2,12 +2,12 @@
2
2
  var locked_page_tab = document.querySelector('#locked_page_<%= @page.id -%>')
3
3
  var locked_page_icon = document.querySelector(
4
4
  '#page_<%= @page.id -%> > .sitemap_page > .sitemap_left_images .with-hint'
5
- )
5
+ ) || document.querySelector('[data-page-id="<%= @page.id -%>"] > .icon')
6
6
  if (locked_page_tab) {
7
7
  locked_page_tab.remove()
8
8
  }
9
9
  if (locked_page_icon) {
10
- locked_page_icon.innerHTML = '<%= j render_icon(:file, style: 'regular', size: 'lg') %>'
10
+ locked_page_icon.innerHTML = '<i class="icon far fa-file fa-lg"></i>'
11
11
  }
12
12
  Alchemy.growl('<%= flash[:notice] -%>')
13
13
  })()
@@ -1,5 +1,5 @@
1
1
  (function() {
2
- var $page;
2
+ var page = document.querySelector('#page_<%= @page.id %>');
3
3
 
4
4
  <% if @old_page_layout != @page.page_layout -%>
5
5
  Alchemy.ElementsWindow.reload();
@@ -9,18 +9,27 @@
9
9
  <% if @while_page_edit -%>
10
10
 
11
11
  Alchemy.reloadPreview();
12
- $('#page_<%= @page.id %>_status').replaceWith('<%= j render("current_page", current_page: @page) %>');
12
+ document.querySelector('#page_<%= @page.id %>_status').outerHTML = '<%= j render("current_page", current_page: @page) %>';
13
+ Alchemy.growl("<%= j @notice %>");
14
+ Alchemy.closeCurrentDialog();
13
15
 
14
16
  <% else -%>
15
17
 
16
- var page_html = "<%= j render('page', page: @page) %>";
17
- var compiler = Handlebars.compile(page_html);
18
- var tree = <%== @tree.to_json %>;
19
- var html = compiler(tree.pages[0]);
20
- $('#page_<%= @page.id %>').replaceWith(html);
18
+ if (page) {
19
+ var page_html = "<%= j render('page', page: @page) %>";
20
+ var compiler = Handlebars.compile(page_html);
21
+ var tree = <%== @tree.to_json %>;
22
+ page.outerHTML = compiler(tree.pages[0]);
23
+ Alchemy.growl("<%= j @notice %>");
24
+ Alchemy.closeCurrentDialog();
25
+ } else {
26
+ document.addEventListener('turbolinks:load', function () {
27
+ Alchemy.growl("<%= j @notice %>");
28
+ }, { once: true })
29
+ Alchemy.closeCurrentDialog(function() {
30
+ Turbolinks.visit(location.toString(), { action: "replace" });
31
+ });
32
+ }
21
33
 
22
34
  <% end -%>
23
-
24
- Alchemy.growl("<%= j @notice %>");
25
- Alchemy.closeCurrentDialog();
26
35
  })()