alchemy_cms 5.0.3 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +1 -1
  3. data/.github/workflows/stale.yml +1 -1
  4. data/.gitignore +1 -0
  5. data/CHANGELOG.md +66 -2
  6. data/CONTRIBUTING.md +2 -2
  7. data/Gemfile +1 -1
  8. data/README.md +1 -1
  9. data/alchemy_cms.gemspec +3 -3
  10. data/app/assets/images/alchemy/missing-image.svg +1 -0
  11. data/app/assets/javascripts/alchemy/admin.js +0 -1
  12. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +1 -4
  13. data/app/assets/javascripts/alchemy/alchemy.preview.js.coffee +0 -3
  14. data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +29 -4
  15. data/app/assets/stylesheets/alchemy/_variables.scss +8 -0
  16. data/app/assets/stylesheets/alchemy/admin.scss +0 -1
  17. data/app/assets/stylesheets/alchemy/archive.scss +23 -17
  18. data/app/assets/stylesheets/alchemy/buttons.scss +26 -15
  19. data/app/assets/stylesheets/alchemy/elements.scss +58 -19
  20. data/app/assets/stylesheets/alchemy/errors.scss +1 -1
  21. data/app/assets/stylesheets/alchemy/frame.scss +0 -1
  22. data/app/assets/stylesheets/alchemy/hints.scss +2 -1
  23. data/app/assets/stylesheets/alchemy/navigation.scss +7 -10
  24. data/app/assets/stylesheets/alchemy/pagination.scss +1 -1
  25. data/app/assets/stylesheets/alchemy/search.scss +13 -3
  26. data/app/assets/stylesheets/alchemy/selects.scss +26 -20
  27. data/app/assets/stylesheets/alchemy/tables.scss +38 -9
  28. data/app/assets/stylesheets/alchemy/tags.scss +19 -31
  29. data/app/controllers/alchemy/admin/pages_controller.rb +58 -8
  30. data/app/controllers/alchemy/admin/pictures_controller.rb +13 -6
  31. data/app/controllers/alchemy/admin/resources_controller.rb +3 -3
  32. data/app/controllers/alchemy/pages_controller.rb +49 -14
  33. data/app/decorators/alchemy/element_editor.rb +1 -0
  34. data/app/helpers/alchemy/admin/base_helper.rb +0 -44
  35. data/app/helpers/alchemy/admin/navigation_helper.rb +2 -1
  36. data/app/models/alchemy/attachment.rb +20 -3
  37. data/app/models/alchemy/attachment/url.rb +40 -0
  38. data/app/models/alchemy/essence_picture.rb +3 -3
  39. data/app/models/alchemy/essence_picture_view.rb +5 -3
  40. data/app/models/alchemy/legacy_page_url.rb +1 -1
  41. data/app/models/alchemy/page.rb +24 -1
  42. data/app/models/alchemy/page/page_natures.rb +2 -0
  43. data/app/models/alchemy/page/url_path.rb +8 -6
  44. data/app/models/alchemy/picture.rb +58 -2
  45. data/app/models/alchemy/picture/calculations.rb +55 -0
  46. data/app/models/alchemy/picture/transformations.rb +5 -49
  47. data/app/models/alchemy/picture/url.rb +28 -77
  48. data/app/models/alchemy/picture_thumb.rb +57 -0
  49. data/app/models/alchemy/picture_thumb/create.rb +39 -0
  50. data/app/models/alchemy/picture_thumb/signature.rb +23 -0
  51. data/app/models/alchemy/picture_thumb/uid.rb +22 -0
  52. data/app/models/alchemy/picture_variant.rb +114 -0
  53. data/app/models/alchemy/site/layout.rb +30 -2
  54. data/app/views/alchemy/admin/attachments/show.html.erb +8 -8
  55. data/app/views/alchemy/admin/dashboard/index.html.erb +13 -16
  56. data/app/views/alchemy/admin/elements/_element_footer.html.erb +1 -1
  57. data/app/views/alchemy/admin/elements/publish.js.erb +1 -0
  58. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +1 -1
  59. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +2 -2
  60. data/app/views/alchemy/admin/layoutpages/edit.html.erb +4 -6
  61. data/app/views/alchemy/admin/pages/_create_language_form.html.erb +19 -29
  62. data/app/views/alchemy/admin/pages/_form.html.erb +4 -6
  63. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +12 -2
  64. data/app/views/alchemy/admin/pages/_page_layout_filter.html.erb +29 -0
  65. data/app/views/alchemy/admin/pages/_table.html.erb +27 -0
  66. data/app/views/alchemy/admin/pages/_table_row.html.erb +107 -0
  67. data/app/views/alchemy/admin/pages/_toolbar.html.erb +77 -0
  68. data/app/views/alchemy/admin/pages/edit.html.erb +9 -1
  69. data/app/views/alchemy/admin/pages/index.html.erb +41 -74
  70. data/app/views/alchemy/admin/pages/list/_table.html.erb +31 -0
  71. data/app/views/alchemy/admin/pages/unlock.js.erb +2 -2
  72. data/app/views/alchemy/admin/pages/update.js.erb +19 -10
  73. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +14 -13
  74. data/app/views/alchemy/admin/partials/_search_form.html.erb +8 -8
  75. data/app/views/alchemy/admin/pictures/_archive.html.erb +1 -1
  76. data/app/views/alchemy/admin/pictures/_form.html.erb +1 -1
  77. data/app/views/alchemy/admin/pictures/_picture.html.erb +3 -3
  78. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -1
  79. data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +1 -1
  80. data/app/views/alchemy/admin/pictures/index.html.erb +1 -1
  81. data/app/views/alchemy/admin/pictures/show.html.erb +3 -3
  82. data/app/views/alchemy/admin/resources/_filter_bar.html.erb +13 -11
  83. data/app/views/alchemy/admin/resources/_per_page_select.html.erb +3 -3
  84. data/app/views/alchemy/admin/resources/index.html.erb +4 -1
  85. data/app/views/alchemy/admin/tags/index.html.erb +14 -15
  86. data/app/views/alchemy/base/500.html.erb +11 -13
  87. data/app/views/alchemy/essences/_essence_file_view.html.erb +3 -3
  88. data/config/alchemy/config.yml +15 -11
  89. data/config/alchemy/modules.yml +12 -12
  90. data/config/locales/alchemy.en.yml +6 -4
  91. data/config/routes.rb +1 -1
  92. data/db/migrate/20200617110713_create_alchemy_picture_thumbs.rb +22 -0
  93. data/db/migrate/20200907111332_remove_tri_state_booleans.rb +33 -0
  94. data/lib/alchemy.rb +66 -0
  95. data/lib/alchemy/admin/preview_url.rb +2 -0
  96. data/lib/alchemy/auth_accessors.rb +12 -5
  97. data/lib/alchemy/config.rb +1 -3
  98. data/lib/alchemy/engine.rb +7 -6
  99. data/lib/alchemy/modules.rb +11 -1
  100. data/lib/alchemy/permissions.rb +1 -0
  101. data/lib/alchemy/test_support/factories/picture_factory.rb +0 -1
  102. data/lib/alchemy/test_support/factories/picture_thumb_factory.rb +12 -0
  103. data/lib/alchemy/test_support/integration_helpers.rb +0 -7
  104. data/lib/alchemy/version.rb +1 -1
  105. data/lib/alchemy_cms.rb +2 -4
  106. data/lib/generators/alchemy/install/files/alchemy.en.yml +2 -2
  107. data/lib/generators/alchemy/install/templates/dragonfly.rb.tt +5 -5
  108. data/lib/tasks/alchemy/thumbnails.rake +37 -0
  109. data/vendor/assets/javascripts/jquery_plugins/select2.js +3729 -0
  110. data/vendor/assets/stylesheets/alchemy_admin/select2.scss +740 -0
  111. metadata +41 -31
  112. data/.github/workflows/greetings.yml +0 -13
  113. data/app/controllers/concerns/alchemy/locale_redirects.rb +0 -40
  114. data/app/controllers/concerns/alchemy/page_redirects.rb +0 -68
  115. data/lib/alchemy/userstamp.rb +0 -12
@@ -1,20 +1,17 @@
1
- <%= toolbar(
2
- buttons: [
3
- {
4
- icon: 'info-circle',
5
- label: Alchemy.t(:info),
6
- url: alchemy.dashboard_info_path,
1
+ <%= content_for :toolbar do %>
2
+ <%= toolbar_button(
3
+ icon: 'info-circle',
4
+ label: Alchemy.t(:info),
5
+ url: alchemy.dashboard_info_path,
6
+ title: Alchemy.t(:info),
7
+ dialog_options: {
7
8
  title: Alchemy.t(:info),
8
- dialog_options: {
9
- title: Alchemy.t(:info),
10
- size: "420x435"
11
- },
12
- if_permitted_to: [:info, :alchemy_admin_dashboard],
13
- hotkey: 'alt+i'
14
- }
15
- ],
16
- search: false
17
- ) %>
9
+ size: "420x435"
10
+ },
11
+ if_permitted_to: [:info, :alchemy_admin_dashboard],
12
+ hotkey: 'alt+i'
13
+ ) %>
14
+ <% end %>
18
15
 
19
16
  <div id="dashboard">
20
17
  <h1>
@@ -5,7 +5,7 @@
5
5
  </p>
6
6
  <% end %>
7
7
 
8
- <button type="submit" form="element_<%= element.id %>_form" class="button" data-alchemy-button>
8
+ <button type="submit" <%= "disabled" unless element.public? %> form="element_<%= element.id %>_form" class="button" data-alchemy-button>
9
9
  <%= Alchemy.t(:save) %>
10
10
  </button>
11
11
  </div>
@@ -16,5 +16,6 @@ var eye = el.find('> .element-toolbar .publish-element-button .icon');
16
16
  eye.addClass('fa-eye');
17
17
  label.text('<%= Alchemy.t(:show_element) %>');
18
18
  <%- end -%>
19
+ el.toggleClass('visible hidden');
19
20
 
20
21
  Alchemy.reloadPreview();
@@ -34,7 +34,7 @@
34
34
  $('#imageToCrop').load(function() {
35
35
  Alchemy.ImageCropper.init(
36
36
  <%= @initial_box.values.to_json %>,
37
- <% if @essence_picture.can_be_cropped_to("#{@min_size[:width]}x#{@min_size[:height]}") %>
37
+ <% if @picture.can_be_cropped_to?("#{@min_size[:width]}x#{@min_size[:height]}") %>
38
38
  <%= @min_size.values.to_json %>,
39
39
  <% else %>
40
40
  <%= false %>,
@@ -4,10 +4,10 @@
4
4
  <%= f.input :caption, as: @content.settings[:caption_as_textarea] ? 'text' : 'string' %>
5
5
  <%= f.input :title %>
6
6
  <%= f.input :alt_tag %>
7
- <%- if @content.settings[:sizes].present? -%>
7
+ <%- if @content.settings[:sizes].present? && @content.settings[:srcset].blank? -%>
8
8
  <%= f.input :render_size,
9
9
  collection: [
10
- [Alchemy.t('Layout default'), @content.settings[:size]]
10
+ [Alchemy.t('Layout default'), ""]
11
11
  ] + @content.settings[:sizes].to_a,
12
12
  include_blank: false,
13
13
  input_html: {class: 'alchemy_selectbox'} %>
@@ -5,11 +5,9 @@
5
5
  include_blank: Alchemy.t('Please choose'),
6
6
  input_html: {class: 'alchemy_selectbox'} %>
7
7
  <%= f.input :name, autofocus: true %>
8
- <% if @page.taggable? %>
9
- <div class="input string">
10
- <%= f.label :tag_list %>
11
- <%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f %>
12
- </div>
13
- <% end %>
8
+ <div class="input string">
9
+ <%= f.label :tag_list %>
10
+ <%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f %>
11
+ </div>
14
12
  <%= f.submit Alchemy.t(:save) %>
15
13
  <% end %>
@@ -1,8 +1,7 @@
1
1
  <div class="panel">
2
2
  <%= render_message do %>
3
- <p><%= Alchemy.t(:language_does_not_exist) %></p>
3
+ <p><%= Alchemy.t(:homepage_does_not_exist) %></p>
4
4
  <% end %>
5
- <%- if @language -%>
6
5
 
7
6
  <%- if @languages_with_page_tree.size >= 1 -%>
8
7
  <%= form_tag(alchemy.copy_language_tree_admin_pages_path) do %>
@@ -19,32 +18,23 @@
19
18
  <% end %>
20
19
  <%- end -%>
21
20
 
22
- <%- if params[:action] == "index" -%>
23
- <%= alchemy_form_for([:admin, Alchemy::Page.new], id: 'create_language_tree') do |form| %>
24
- <% if @languages_with_page_tree.size >= 1 %>
25
- <h3><%= Alchemy.t(:create_language_tree_heading) %></h3>
26
- <p><%= Alchemy.t(:want_to_create_new_language) %></p>
27
- <% end %>
28
- <%= form.input :name, input_html: {value: @language.frontpage_name} %>
29
- <%= form.input :page_layout,
30
- collection: @page_layouts,
31
- selected: @language.page_layout,
32
- label: Alchemy.t(:page_type),
33
- include_blank: Alchemy.t('Please choose'),
34
- required: true,
35
- input_html: {class: 'alchemy_selectbox'} %>
36
- <%= form.hidden_field :language_id, value: @language.id %>
37
- <%= form.hidden_field :language_code, value: @language.code %>
38
- <%= form.hidden_field :language_root, value: true %>
39
- <%= form.hidden_field :public, value: Alchemy::Language.all.size == 1 %>
40
- <%= form.submit Alchemy.t("create_tree_as_new_language", language: @language.name), autofocus: true %>
21
+ <%= alchemy_form_for([:admin, Alchemy::Page.new], id: 'create_language_tree') do |form| %>
22
+ <% if @languages_with_page_tree.size >= 1 %>
23
+ <h3><%= Alchemy.t(:create_language_tree_heading) %></h3>
24
+ <p><%= Alchemy.t(:want_to_create_new_language) %></p>
41
25
  <% end %>
42
- <%- end -%>
43
-
44
- <%- else -%>
45
-
46
- <p><%= Alchemy.t("Actually this language does not exist. Please create this language first.") %></p>
47
-
48
- <%- end -%>
49
-
26
+ <%= form.input :name, input_html: {value: @language.frontpage_name} %>
27
+ <%= form.input :page_layout,
28
+ collection: @page_layouts,
29
+ selected: @language.page_layout,
30
+ label: Alchemy.t(:page_type),
31
+ include_blank: Alchemy.t('Please choose'),
32
+ required: true,
33
+ input_html: {class: 'alchemy_selectbox'} %>
34
+ <%= form.hidden_field :language_id, value: @language.id %>
35
+ <%= form.hidden_field :language_code, value: @language.code %>
36
+ <%= form.hidden_field :language_root, value: true %>
37
+ <%= form.hidden_field :public, value: Alchemy::Language.all.size == 1 %>
38
+ <%= form.submit Alchemy.t(:create), autofocus: true %>
39
+ <% end %>
50
40
  </div>
@@ -36,12 +36,10 @@
36
36
  as: 'text',
37
37
  hint: Alchemy.t('pages.update.comma_seperated') %>
38
38
 
39
- <% if @page.taggable? %>
40
- <div class="input string autocomplete_tag_list">
41
- <%= f.label :tag_list %>
42
- <%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f %>
43
- </div>
44
- <% end %>
39
+ <div class="input string autocomplete_tag_list">
40
+ <%= f.label :tag_list %>
41
+ <%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f %>
42
+ </div>
45
43
 
46
44
  <%= f.submit Alchemy.t(:save) %>
47
45
  <% end %>
@@ -1,12 +1,22 @@
1
1
  <%= alchemy_form_for([:admin, @page]) do |f| %>
2
- <%= f.hidden_field(:parent_id) %>
2
+ <% if @page.parent_id || @page.layoutpage %>
3
+ <%= f.hidden_field(:parent_id) %>
4
+ <% else %>
5
+ <% @page.parent = @current_language.root_page %>
6
+ <%= f.input :parent_id,
7
+ collection: @current_language.pages.contentpages,
8
+ label_method: :name,
9
+ value_method: :id,
10
+ input_html: { class: "alchemy_selectbox" } %>
11
+ <% end %>
3
12
  <%= f.hidden_field(:language_id) %>
4
13
  <%= f.hidden_field(:layoutpage) %>
5
14
  <%= f.input :page_layout,
6
15
  collection: @page_layouts,
7
16
  label: Alchemy.t(:page_type),
8
- include_blank: Alchemy.t('Please choose'),
17
+ include_blank: @page_layouts.length == 1 ? nil : Alchemy.t('Please choose'),
9
18
  required: true,
19
+ selected: @page_layouts.length == 1 ? @page_layouts.first : nil,
10
20
  input_html: {class: 'alchemy_selectbox'} %>
11
21
  <%= f.input :name %>
12
22
  <%= f.submit Alchemy.t(:create) %>
@@ -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);