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
@@ -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
  })()
@@ -1,24 +1,25 @@
1
- <%= search_form_for @query, url: url_for(
2
- action: 'index',
3
- size: @size
1
+ <%= search_form_for @query, url: url_for({
2
+ action: 'index',
3
+ size: @size,
4
+ }.merge(search_filter_params.except(:q))
4
5
  ), remote: true, html: {class: 'search_form', id: nil} do |f| %>
5
- <%= hidden_field_tag("element_id", @element.blank? ? "" : @element.id) %>
6
- <%= hidden_field_tag("content_id", @content.blank? ? "" : @content.id) %>
6
+ <%= hidden_field_tag("element_id", @element.blank? ? "" : @element.id, id: nil) %>
7
+ <%= hidden_field_tag("content_id", @content.blank? ? "" : @content.id, id: nil) %>
7
8
  <div class="search_field">
8
- <label>
9
+ <button type="submit">
9
10
  <%= render_icon('search') %>
10
- <%= f.search_field resource_handler.search_field_name,
11
- placeholder: Alchemy.t(:search),
12
- class: 'search_input_field',
13
- id: nil %>
14
- </label>
15
- <%= link_to render_icon(:times, size: 'xs'), url_for(
11
+ </button>
12
+ <%= f.search_field resource_handler.search_field_name,
13
+ placeholder: Alchemy.t(:search),
14
+ class: 'search_input_field',
15
+ id: nil %>
16
+ <%= link_to render_icon(:times, size: 'xs'), url_for({
16
17
  action: 'index',
17
18
  element_id: @element.blank? ? '' : @element.id,
18
19
  content_id: @content.blank? ? '' : @content.id,
19
20
  size: @size,
20
21
  overlay: true
21
- ),
22
+ }.merge(search_filter_params.except(:q))),
22
23
  remote: true,
23
24
  class: 'search_field_clear',
24
25
  title: Alchemy.t(:click_to_show_all),
@@ -1,15 +1,15 @@
1
- <%- url ||= resource_url_proxy.url_for(action: 'index') -%>
1
+ <%- url ||= resource_url_proxy.url_for({ action: 'index' }.merge(search_filter_params.except(:q, :page))) -%>
2
2
 
3
3
  <%= search_form_for @query, url: url, class: 'search_form' do |f| %>
4
4
  <div class="search_field">
5
- <label>
5
+ <button type="submit">
6
6
  <%= render_icon('search') %>
7
- <%= f.search_field resource_handler.search_field_name,
8
- class: 'search_input_field',
9
- placeholder: Alchemy.t(:search) %>
10
- </label>
7
+ </button>
8
+ <%= f.search_field resource_handler.search_field_name,
9
+ class: 'search_input_field',
10
+ placeholder: Alchemy.t(:search) %>
11
11
  <% local_assigns.fetch(:additional_query_fields, []).each do |field| %>
12
- <%= f.hidden_field field %>
12
+ <%= f.hidden_field field, id: nil %>
13
13
  <% end %>
14
14
  <%= link_to render_icon(:times, size: 'xs'), url,
15
15
  class: 'search_field_clear',
@@ -17,7 +17,7 @@
17
17
  title: Alchemy.t(:click_to_show_all),
18
18
  style: search_filter_params.fetch(:q, {}).fetch(resource_handler.search_field_name, '').present? ? 'display: block' : 'display: none' %>
19
19
  <% local_assigns.fetch(:additional_params, []).each do |additional_param| %>
20
- <%= hidden_field_tag additional_param, search_filter_params[additional_param] %>
20
+ <%= hidden_field_tag additional_param, search_filter_params[additional_param], id: nil %>
21
21
  <% end %>
22
22
  </div>
23
23
  <% end %>
@@ -31,7 +31,7 @@
31
31
  admin_pictures_path(
32
32
  q: search_filter_params[:q],
33
33
  tagged_with: search_filter_params[:tagged_with],
34
- size: params[:size],
34
+ size: @size,
35
35
  filter: search_filter_params[:filter]
36
36
  ),
37
37
  class: 'secondary button with_icon',
@@ -6,7 +6,7 @@
6
6
  <small class="hint"><%= Alchemy.t('Please seperate the tags with commata') %></small>
7
7
  </div>
8
8
  <%= hidden_field_tag :q, search_filter_params[:q] %>
9
- <%= hidden_field_tag :size, params[:size] %>
9
+ <%= hidden_field_tag :size, @size %>
10
10
  <%= hidden_field_tag :tagged_with, search_filter_params[:tagged_with] %>
11
11
  <%= hidden_field_tag :filter, search_filter_params[:filter] %>
12
12
  <%= f.submit Alchemy.t(:save) %>
@@ -12,7 +12,7 @@
12
12
  q: search_filter_params[:q],
13
13
  page: params[:page],
14
14
  tagged_with: search_filter_params[:tagged_with],
15
- size: params[:size],
15
+ size: @size,
16
16
  filter: search_filter_params[:filter]
17
17
  ),
18
18
  {
@@ -22,7 +22,7 @@
22
22
  </span>
23
23
  <% end %>
24
24
  <% image = image_tag(
25
- picture.url(size: preview_size(@size), flatten: true),
25
+ picture.url(size: preview_size(@size), flatten: true) || "alchemy/missing-image.svg",
26
26
  alt: picture.name,
27
27
  title: Alchemy.t(:zoom_image)
28
28
  ) %>
@@ -34,7 +34,7 @@
34
34
  q: search_filter_params[:q],
35
35
  page: params[:page],
36
36
  tagged_with: search_filter_params[:tagged_with],
37
- size: params[:size],
37
+ size: @size,
38
38
  filter: search_filter_params[:filter]
39
39
  ),
40
40
  class: 'thumbnail_background'
@@ -1,7 +1,7 @@
1
1
  <div class="picture_thumbnail assign_image_list_detail <%= size.blank? ? 'medium' : size %>" name="<%= picture_to_assign.name %>" id="picture_to_assign_<%= picture_to_assign.id %>">
2
2
  <%= link_to(
3
3
  image_tag(
4
- picture_to_assign.url(size: preview_size(size), flatten: true),
4
+ picture_to_assign.url(size: preview_size(size), flatten: true) || "alchemy/missing-image.svg",
5
5
  alt: picture_to_assign.name
6
6
  ),
7
7
  alchemy.assign_admin_essence_pictures_path(
@@ -1,6 +1,6 @@
1
1
  <%= form_tag update_multiple_admin_pictures_path do %>
2
2
  <%= hidden_field_tag :q, search_filter_params[:q] %>
3
- <%= hidden_field_tag :size, params[:size] %>
3
+ <%= hidden_field_tag :size, @size %>
4
4
  <%= hidden_field_tag :tagged_with, search_filter_params[:tagged_with] %>
5
5
  <%= hidden_field_tag :filter, search_filter_params[:filter] %>
6
6
 
@@ -5,7 +5,7 @@
5
5
  object: Alchemy::Picture.new,
6
6
  file_attribute: 'image_file',
7
7
  redirect_url: alchemy.admin_pictures_path(
8
- size: params[:size],
8
+ size: @size,
9
9
  filter: 'last_upload'
10
10
  ) %>
11
11
  <div class="toolbar_spacer"></div>
@@ -1,5 +1,5 @@
1
1
  <div class="zoomed-picture-background">
2
- <%= image_tag @picture.url %>
2
+ <%= image_tag @picture.url || "alchemy/missing-image.svg" %>
3
3
  </div>
4
4
 
5
5
  <div class="picture-overlay-navigation">
@@ -9,7 +9,7 @@
9
9
  q: search_filter_params[:q],
10
10
  page: params[:page],
11
11
  tagged_with: search_filter_params[:tagged_with],
12
- size: params[:size],
12
+ size: @size,
13
13
  filter: search_filter_params[:filter]
14
14
  ),
15
15
  class: "previous-picture",
@@ -23,7 +23,7 @@
23
23
  q: search_filter_params[:q],
24
24
  page: params[:page],
25
25
  tagged_with: search_filter_params[:tagged_with],
26
- size: params[:size],
26
+ size: @size,
27
27
  filter: search_filter_params[:filter]
28
28
  ),
29
29
  class: "next-picture",
@@ -1,21 +1,23 @@
1
1
  <div id="filter_bar">
2
- <h3><%= Alchemy.t('Filter') %></h3>
3
- <%= select_tag(
4
- 'resource_filter',
5
- options_for_select(
6
- resource_filter_select, search_filter_params[:filter]
7
- ),
8
- include_blank: Alchemy.t(:all, scope: ['resources', resource_name, 'filters']),
9
- data: { remote: !!request.xhr? },
10
- class: 'alchemy_selectbox'
11
- ) %>
2
+ <label>
3
+ <h3><%= local_assigns[:label] || Alchemy.t('Filter') %></h3>
4
+ <%= select_tag(
5
+ 'resource_filter',
6
+ options_for_select(
7
+ resource_filter_select, search_filter_params[:filter]
8
+ ),
9
+ include_blank: Alchemy.t(:all, scope: ['resources', resource_name, 'filters']),
10
+ data: { remote: !!request.xhr? },
11
+ class: 'alchemy_selectbox'
12
+ ) %>
13
+ </label>
12
14
  </div>
13
15
 
14
16
  <script type="text/javascript">
15
17
  $(function() {
16
18
  $('#resource_filter').on('change', function(e) {
17
19
  var $this = $(this);
18
- var url = '<%= resources_path(resource_handler.namespaced_resources_name, search_filter_params.except(:filter).to_h) %>';
20
+ var url = '<%= local_assigns[:url] || resources_path(resource_handler.namespaced_resources_name, search_filter_params.except(:filter).to_h) %>';
19
21
  if ($this.data('remote') === true) {
20
22
  $.get(url, {filter: $this.val()}, null, 'script');
21
23
  } else {
@@ -2,10 +2,10 @@
2
2
  <% search_filter_params.reject { |k, _| k == 'page' || k == 'per_page' }.each do |key, value| %>
3
3
  <% if value.is_a? Hash %>
4
4
  <% value.each do |k, v| %>
5
- <%= hidden_field_tag "#{key}[#{k}]", v %>
5
+ <%= hidden_field_tag "#{key}[#{k}]", v, id: nil %>
6
6
  <% end %>
7
7
  <% else %>
8
- <%= hidden_field_tag key, value %>
8
+ <%= hidden_field_tag key, value, id: nil %>
9
9
  <% end %>
10
10
  <% end %>
11
11
  <label>
@@ -17,4 +17,4 @@
17
17
  ),
18
18
  onchange: 'this.form.submit()' %>
19
19
  </label>
20
- <% end %>
20
+ <% end %>
@@ -21,7 +21,10 @@
21
21
  dialog: false,
22
22
  if_permitted_to: [:index, resource_model]
23
23
  ) %>
24
- <%= render 'alchemy/admin/partials/search_form' %>
24
+ <%= render 'alchemy/admin/partials/search_form', additional_params: [
25
+ resource_has_filters ? :filter : nil,
26
+ resource_has_tags ? :tagged_with : nil
27
+ ].compact %>
25
28
  <% end %>
26
29
 
27
30
  <div id="archive_all" class="resources-table-wrapper<%= ' with_tag_filter' if resource_has_tags || resource_has_filters %>">