alchemy_cms 5.3.0 → 5.3.1

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.

Potentially problematic release.


This version of alchemy_cms might be problematic. Click here for more details.

Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/app/assets/javascripts/alchemy/admin.js +0 -1
  4. data/app/assets/javascripts/alchemy/templates/index.js +1 -0
  5. data/app/assets/javascripts/alchemy/templates/page.hbs +17 -7
  6. data/app/assets/javascripts/alchemy/templates/page_folder.hbs +3 -0
  7. data/app/assets/stylesheets/alchemy/page-select.scss +29 -4
  8. data/app/assets/stylesheets/alchemy/sitemap.scss +2 -6
  9. data/app/controllers/alchemy/admin/pages_controller.rb +8 -12
  10. data/app/controllers/alchemy/api/pages_controller.rb +14 -4
  11. data/app/serializers/alchemy/page_serializer.rb +7 -1
  12. data/app/serializers/alchemy/page_tree_serializer.rb +3 -3
  13. data/app/views/alchemy/admin/pages/_page.html.erb +111 -133
  14. data/app/views/alchemy/admin/pages/_sitemap.html.erb +2 -8
  15. data/app/views/alchemy/admin/pages/_toolbar.html.erb +0 -12
  16. data/app/views/alchemy/admin/pages/index.html.erb +1 -1
  17. data/app/views/alchemy/admin/partials/_routes.html.erb +8 -1
  18. data/app/views/alchemy/essences/_essence_page_editor.html.erb +1 -1
  19. data/config/locales/alchemy.en.yml +0 -3
  20. data/config/routes.rb +4 -2
  21. data/lib/alchemy/permissions.rb +0 -1
  22. data/lib/alchemy/version.rb +1 -1
  23. data/package/src/page_sorter.js +68 -0
  24. data/package/src/sitemap.js +55 -36
  25. data/package.json +1 -1
  26. metadata +4 -6
  27. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +0 -24
  28. data/app/views/alchemy/admin/pages/fold.js.erb +0 -2
  29. data/app/views/alchemy/admin/pages/sort.html.erb +0 -19
  30. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +0 -434
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b27eb5b4a0bdb143597a3e2cc33d0a8bfa4dd0d8febb2fd9261f2ad692716bc8
4
- data.tar.gz: 7c67ed54f66b70419ac653421bdf3f8d38389bd3e67acfe70675bfcc8b357abd
3
+ metadata.gz: 0d0f346b9e40e791697acdf21d5e1193c72023f8f2570b777683ba2e781b67c1
4
+ data.tar.gz: b0c6a7f6e466bd0b134f9a7fdc76cb88ec1a56d0ca068209fa6b004619ed3a8e
5
5
  SHA512:
6
- metadata.gz: aad3d674038b933605c7c8b5d11d74c707ed2687f9a5350e7762d56882a8994f85ea0a7e86e60ed4ee6cddb32aa46ecde70c42bcf91ceca62ad00e071195c497
7
- data.tar.gz: c2f4a299345aafda98c2d40465ab8e011ee5d345104d32342503197afedccc4ed7bc527cce09afe8163dad148fe2019f3a2e18b0a0770eb48d971c9df51239dc
6
+ metadata.gz: e10199dcdc4b12d01bfebef27d23b752d1dd95c393263dac664c2d5588677aca80113c8b99ca281aefa130592767cc01304ab635d09273c63f3cc575ab2a1313
7
+ data.tar.gz: eaf3f967e1cb5ac4644cddf31ffdfcf3e931107be5508091fe94f61ceb7c096bacc4e39a8203ab8ba1ddf820992abfdae795774f91ac4ff571fc7687f7efd0ba
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 5.3.1 (2022-03-11)
2
+
3
+ - Allow all pages in API again ([tvdeyen](https://github.com/tvdeyen))
4
+ - New sortable page tree ([tvdeyen](https://github.com/tvdeyen))
5
+ - Send language_id to Api::PagesController#index so Pages can be restricted to the language of the page. ([dbwinger](https://github.com/dbwinger))
6
+ - Eager load in PageTree serializer ([tvdeyen](https://github.com/tvdeyen))
7
+
8
+ ## 5.3.0 (2022-03-09)
9
+
10
+ - Allow parent page change ([tvdeyen](https://github.com/tvdeyen))
11
+ - Precompile packs during test setup ([tvdeyen](https://github.com/tvdeyen))
12
+ - Rework Sitemap JS ([tvdeyen](https://github.com/tvdeyen))
13
+ - Fix rendering errors in page configure overlay ([tvdeyen](https://github.com/tvdeyen))
14
+
1
15
  ## 5.2.7 (2022-03-01)
2
16
 
3
17
  - Fix copying page with descendants to a different language ([dbwinger](https://github.com/dbwinger))
@@ -37,7 +37,6 @@
37
37
  //= require alchemy/alchemy.link_dialog
38
38
  //= require alchemy/alchemy.list_filter
39
39
  //= require alchemy/alchemy.initializer
40
- //= require alchemy/alchemy.page_sorter
41
40
  //= require alchemy/alchemy.uploader
42
41
  //= require alchemy/alchemy.preview_window
43
42
  //= require alchemy/alchemy.spinner
@@ -2,3 +2,4 @@
2
2
  //= require alchemy/templates/page
3
3
  //= require alchemy/templates/node_folder
4
4
  //= require alchemy/templates/node
5
+ //= require alchemy/templates/page_folder
@@ -1,9 +1,19 @@
1
1
  <div class="page-select--page">
2
- <i class="icon far fa-file fa-lg"></i>
3
- <span class="page-select--page-name">
4
- {{ page.name }}
5
- </span>
6
- <span class="page-select--page-urlname">
7
- {{ page.url_path }}
8
- </span>
2
+ <div class="page-select--top">
3
+ <i class="icon far fa-file fa-lg"></i>
4
+ <span class="page-select--page-name">
5
+ {{ page.name }}
6
+ </span>
7
+ <span class="page-select--page-urlname">
8
+ {{ page.url_path }}
9
+ </span>
10
+ </div>
11
+ <div class="page-select--bottom">
12
+ <span class="page-select--site-name">
13
+ {{ page.site.name }}
14
+ </span>
15
+ <span class="page-select--language-code">
16
+ {{ page.language.name }}
17
+ </span>
18
+ </div>
9
19
  </div>
@@ -0,0 +1,3 @@
1
+ <a class="page_folder" data-page-id="{{ page.id }}">
2
+ <i class="far fa-{{#if page.folded }}plus{{else}}minus{{/if}}-square fa-fw"></i>
3
+ </a>
@@ -7,24 +7,49 @@
7
7
 
8
8
  .page-select--page {
9
9
  display: flex;
10
- align-items: center;
10
+ flex-direction: column;
11
11
 
12
12
  .icon {
13
13
  margin: 0 8px 0 4px;
14
14
 
15
15
  .select2-highlighted & {
16
- color: $white
16
+ color: $white;
17
17
  }
18
18
  }
19
19
  }
20
20
 
21
+ .page-select--top,
22
+ .page-select--bottom {
23
+ display: flex;
24
+ flex-direction: row;
25
+ align-items: center;
26
+ }
27
+
28
+ .page-select--bottom {
29
+ font-size: $small-font-size;
30
+ padding-left: 6 * $default-padding;
31
+ }
32
+
33
+ .page-select--language-code {
34
+ display: inline-block;
35
+ background-color: $medium-gray;
36
+ margin-left: auto;
37
+ border-radius: $default-border-radius;
38
+ padding: $default-padding / 2 $default-padding;
39
+
40
+ .select2-highlighted & {
41
+ color: $select-hover-bg-color;
42
+ background-color: white;
43
+ }
44
+ }
45
+
21
46
  .page-select--page-urlname {
22
47
  margin-left: auto;
23
- padding: $default-padding 2*$default-padding;
48
+ padding: $default-padding 2 * $default-padding;
24
49
  color: $dark-gray;
25
50
  font-size: $small-font-size;
26
51
 
27
52
  .select2-highlighted & {
28
- color: $white
53
+ color: $white;
29
54
  }
30
55
  }
@@ -142,12 +142,8 @@ $sitemap-url-xlarge-width: 350px;
142
142
  #sitemap {
143
143
  padding: 0 0 104px 0;
144
144
 
145
- &.sorting {
146
- padding-top: 100px;
147
-
148
- .page_icon {
149
- cursor: move;
150
- }
145
+ .handle {
146
+ cursor: move;
151
147
  }
152
148
 
153
149
  .page_folder {
@@ -7,7 +7,7 @@ module Alchemy
7
7
 
8
8
  helper "alchemy/pages"
9
9
 
10
- before_action :load_resource, except: [:index, :flush, :new, :order, :create, :copy_language_tree, :link, :sort]
10
+ before_action :load_resource, except: [:index, :flush, :new, :order, :create, :copy_language_tree, :link]
11
11
 
12
12
  authorize_resource class: Alchemy::Page, except: [:index, :tree]
13
13
 
@@ -21,7 +21,7 @@ module Alchemy
21
21
  except: [:show]
22
22
 
23
23
  before_action :set_root_page,
24
- only: [:index, :show, :sort, :order]
24
+ only: [:index, :show, :order]
25
25
 
26
26
  before_action :run_on_page_layout_callbacks,
27
27
  if: :run_on_page_layout_callbacks?,
@@ -173,9 +173,7 @@ module Alchemy
173
173
  def fold
174
174
  # @page is fetched via before filter
175
175
  @page.fold!(current_alchemy_user.id, !@page.folded?(current_alchemy_user.id))
176
- respond_to do |format|
177
- format.js
178
- end
176
+ render json: serialized_page_tree
179
177
  end
180
178
 
181
179
  # Leaves the page editing mode and unlocks the page for other users
@@ -220,10 +218,6 @@ module Alchemy
220
218
  redirect_to admin_pages_path
221
219
  end
222
220
 
223
- def sort
224
- @sorting = true
225
- end
226
-
227
221
  # Receives a JSON object representing a language tree to be ordered
228
222
  # and updates all pages in that language structure to their correct indexes
229
223
  def order
@@ -405,9 +399,11 @@ module Alchemy
405
399
  end
406
400
 
407
401
  def serialized_page_tree
408
- PageTreeSerializer.new(@page, ability: current_ability,
409
- user: current_alchemy_user,
410
- full: params[:full] == "true")
402
+ PageTreeSerializer.new(
403
+ @page,
404
+ ability: current_ability,
405
+ user: current_alchemy_user,
406
+ )
411
407
  end
412
408
 
413
409
  def load_languages_and_layouts
@@ -2,17 +2,19 @@
2
2
 
3
3
  module Alchemy
4
4
  class Api::PagesController < Api::BaseController
5
+ serialization_scope :current_ability
5
6
  before_action :load_page, only: [:show]
6
7
 
7
8
  # Returns all pages as json object
8
9
  #
9
10
  def index
10
11
  # Fix for cancancan not able to merge multiple AR scopes for logged in users
11
- if cannot? :edit_content, Alchemy::Page
12
- @pages = Alchemy::Page.accessible_by(current_ability, :index)
13
- @pages = @pages.where(language: Language.current)
12
+ if can? :edit_content, Alchemy::Page
13
+ @pages = Alchemy::Page.all
14
14
  else
15
- @pages = Language.current&.pages.presence || Alchemy::Page.none
15
+ language = Alchemy::Language.find_by(id: params[:language_id]) || Alchemy::Language.current
16
+ @pages = Alchemy::Page.accessible_by(current_ability, :index)
17
+ @pages = @pages.where(language: language)
16
18
  end
17
19
  @pages = @pages.includes(*page_includes)
18
20
  @pages = @pages.ransack(params[:q]).result
@@ -49,6 +51,14 @@ module Alchemy
49
51
  respond_with @page
50
52
  end
51
53
 
54
+ def move
55
+ @page = Page.find(params[:id])
56
+ authorize! :update, @page
57
+ target_parent_page = Page.find(params[:target_parent_id])
58
+ @page.move_to_child_with_index(target_parent_page, params[:new_position])
59
+ render json: @page, serializer: PageSerializer
60
+ end
61
+
52
62
  private
53
63
 
54
64
  def load_page
@@ -14,8 +14,14 @@ module Alchemy
14
14
  :created_at,
15
15
  :updated_at,
16
16
  :status,
17
- :url_path
17
+ :url_path,
18
+ :parent_id
18
19
 
19
20
  has_many :elements
21
+
22
+ with_options if: -> { scope.can?(:edit_content, object) } do
23
+ belongs_to :site
24
+ belongs_to :language
25
+ end
20
26
  end
21
27
  end
@@ -3,13 +3,13 @@
3
3
  module Alchemy
4
4
  class PageTreeSerializer < BaseSerializer
5
5
  def attributes
6
- {"pages" => nil}
6
+ { "pages" => nil }
7
7
  end
8
8
 
9
9
  def pages
10
10
  tree = []
11
- path = [{id: object.parent_id, children: tree}]
12
- page_list = object.self_and_descendants
11
+ path = [{ id: object.parent_id, children: tree }]
12
+ page_list = object.self_and_descendants.includes(language: :site)
13
13
  base_level = object.level - 1
14
14
  # Load folded pages in advance
15
15
  folded_user_pages = FoldedPage.folded_for_user(opts[:user]).pluck(:page_id)
@@ -1,24 +1,7 @@
1
- <li id="page_{{id}}" class="page_level_{{level}} {{page_layout}}" data-slug="{{slug}}" data-restricted="{{restricted}}">
1
+ <li id="page_{{id}}" class="sitemap-item {{page_layout}}" data-slug="{{slug}}" data-restricted="{{restricted}}" data-page-id="{{id}}" data-folded="{{folded}}">
2
2
  <div class="sitemap_page{{#if locked}} locked{{/if}}" name="{{name}}">
3
- <div class="sitemap_left_images<% if @sorting %>{{#unless root}} handle{{/unless}}<% end %>">
4
- <% unless @sorting %>
5
- {{#unless root_or_leaf}}
6
- <%= link_to(
7
- alchemy.fold_admin_page_path(page),
8
- remote: true,
9
- method: :post,
10
- class: "page_folder",
11
- title: "{{#if folded}}#{Alchemy.t('Show childpages')}{{else}}#{Alchemy.t('Hide childpages')}{{/if}}",
12
- id: "fold_button_{{id}}"
13
- ) do %>
14
- {{#if folded}}
15
- <i class="far fa-plus-square fa-fw"></i>
16
- {{else}}
17
- <i class="far fa-minus-square fa-fw"></i>
18
- {{/if}}
19
- <% end %>
20
- {{/unless}}
21
- <% end %>
3
+ <div class="sitemap_left_images">
4
+ <span class="page_folder"></span>
22
5
  {{#if definition_missing}}
23
6
  <%= page_layout_missing_warning %>
24
7
  {{else}}
@@ -31,121 +14,121 @@
31
14
  </span>
32
15
  </span>
33
16
  {{else}}
17
+ <span class="{{#unless root}}handle{{/unless}}">
34
18
  <i class="icon far fa-file fa-lg"></i>
19
+ </span>
35
20
  {{/if}}
36
21
  {{else}}
37
22
  <span class="with-hint">
38
23
  <i class="icon fas fa-ban fa-fw"></i>
39
24
  <span class="hint-bubble">
40
- <%= Alchemy.t('Your user role does not allow you to edit this page') %>
25
+ <%= Alchemy.t("Your user role does not allow you to edit this page") %>
41
26
  </span>
42
27
  </span>
43
28
  {{/if}}
44
29
  {{/if}}
45
30
  </div>
46
31
  <div class="sitemap_right_tools">
47
- <%- unless @sorting -%>
48
- {{#if permissions.info}}
49
- <div class="button_with_label sitemap_tool">
50
- <%= link_to_dialog(
51
- render_icon('info-circle'),
52
- alchemy.info_admin_page_path(page),
53
- {
54
- title: Alchemy.t(:page_infos),
55
- size: '520x290'
56
- }
57
- ) %>
58
- <label class="center"><%= Alchemy.t(:page_infos) %></label>
59
- {{else}}
60
- <div class="sitemap_tool disabled with-hint">
61
- <%= render_icon('info-circle') %>
62
- <span class="hint-bubble">
63
- <%= Alchemy.t('Your user role does not allow you to edit this page') %>
64
- </span>
65
- {{/if}}
66
- </div>
67
- {{#if permissions.configure}}
68
- <div class="button_with_label sitemap_tool">
69
- <%= link_to_dialog(
70
- render_icon(:cog),
71
- alchemy.configure_admin_page_path(page),
72
- {
73
- title: Alchemy.t(:edit_page_properties),
74
- size: '450x680'
75
- }
76
- ) -%>
77
- <label class="center"><%= Alchemy.t(:edit_page_properties) %></label>
78
- {{else}}
79
- <div class="sitemap_tool disabled with-hint">
80
- <%= render_icon(:cog) %>
81
- <span class="hint-bubble">
82
- <%= Alchemy.t('Your user role does not allow you to edit this page') %>
83
- </span>
84
- {{/if}}
85
- </div>
86
- {{#if permissions.copy}}
87
- <div class="button_with_label sitemap_tool">
88
- <%= link_to(
89
- render_icon(:copy),
90
- alchemy.insert_admin_clipboard_path(
91
- remarkable_type: page.class.name.demodulize.underscore.pluralize,
92
- remarkable_id: '__ID__',
93
- ).gsub('__ID__', '{{id}}'),
94
- remote: true,
95
- method: 'post'
96
- ) %>
97
- <label class="center"><%= Alchemy.t(:copy_page) %></label>
98
- {{else}}
99
- <div class="sitemap_tool disabled with-hint">
100
- <%= render_icon(:copy) %>
101
- <span class="hint-bubble">
102
- <%= Alchemy.t('Your user role does not allow you to edit this page') %>
103
- </span>
104
- {{/if}}
105
- </div>
106
- {{#if permissions.destroy}}
107
- <div class="button_with_label sitemap_tool">
108
- <%= link_to_confirm_dialog(
109
- render_icon(:minus),
110
- Alchemy.t(:confirm_to_delete_page),
111
- url_for(
112
- controller: 'pages',
113
- action: 'destroy',
114
- id: '__ID__'
115
- ).gsub('__ID__', '{{id}}')
116
- ) -%>
117
- <label class="center"><%= Alchemy.t(:delete_page) %></label>
118
- {{else}}
119
- <div class="sitemap_tool disabled with-hint">
120
- <%= render_icon(:minus) %>
121
- <span class="hint-bubble">
122
- <%= Alchemy.t('Your user role does not allow you to edit this page') %>
123
- </span>
124
- {{/if}}
125
- </div>
126
- {{#if permissions.create}}
127
- <div class="button_with_label sitemap_tool">
128
- <%= link_to_dialog(
129
- render_icon(:plus),
130
- alchemy.new_admin_page_path(parent_id: '__ID__').gsub('__ID__', '{{id}}'),
131
- {
132
- title: Alchemy.t(:create_page),
133
- size: '340x165',
134
- overflow: true
135
- }
136
- ) -%>
137
- <label class="left"><%= Alchemy.t(:create_page) %></label>
138
- {{else}}
139
- <div class="sitemap_tool disabled with-hint">
140
- <%= render_icon(:plus) %>
141
- <span class="hint-bubble">
142
- <%= Alchemy.t('Your user role does not allow you to edit this page') %>
143
- </span>
144
- {{/if}}
145
- </div>
146
- <%- end -%>
32
+ {{#if permissions.info}}
33
+ <div class="button_with_label sitemap_tool">
34
+ <%= link_to_dialog(
35
+ render_icon("info-circle"),
36
+ alchemy.info_admin_page_path(id: "__ID__"),
37
+ {
38
+ title: Alchemy.t(:page_infos),
39
+ size: "520x290"
40
+ }
41
+ ) %>
42
+ <label class="center"><%= Alchemy.t(:page_infos) %></label>
43
+ {{else}}
44
+ <div class="sitemap_tool disabled with-hint">
45
+ <%= render_icon("info-circle") %>
46
+ <span class="hint-bubble">
47
+ <%= Alchemy.t("Your user role does not allow you to edit this page") %>
48
+ </span>
49
+ {{/if}}
50
+ </div>
51
+ {{#if permissions.configure}}
52
+ <div class="button_with_label sitemap_tool">
53
+ <%= link_to_dialog(
54
+ render_icon(:cog),
55
+ alchemy.configure_admin_page_path(id: "__ID__"),
56
+ {
57
+ title: Alchemy.t(:edit_page_properties),
58
+ size: "450x680"
59
+ }
60
+ ) -%>
61
+ <label class="center"><%= Alchemy.t(:edit_page_properties) %></label>
62
+ {{else}}
63
+ <div class="sitemap_tool disabled with-hint">
64
+ <%= render_icon(:cog) %>
65
+ <span class="hint-bubble">
66
+ <%= Alchemy.t("Your user role does not allow you to edit this page") %>
67
+ </span>
68
+ {{/if}}
69
+ </div>
70
+ {{#if permissions.copy}}
71
+ <div class="button_with_label sitemap_tool">
72
+ <%= link_to(
73
+ render_icon(:copy),
74
+ alchemy.insert_admin_clipboard_path(
75
+ remarkable_type: :pages,
76
+ remarkable_id: "__ID__",
77
+ ),
78
+ remote: true,
79
+ method: :post
80
+ ) %>
81
+ <label class="center"><%= Alchemy.t(:copy_page) %></label>
82
+ {{else}}
83
+ <div class="sitemap_tool disabled with-hint">
84
+ <%= render_icon(:copy) %>
85
+ <span class="hint-bubble">
86
+ <%= Alchemy.t("Your user role does not allow you to edit this page") %>
87
+ </span>
88
+ {{/if}}
89
+ </div>
90
+ {{#if permissions.destroy}}
91
+ <div class="button_with_label sitemap_tool">
92
+ <%= link_to_confirm_dialog(
93
+ render_icon(:minus),
94
+ Alchemy.t(:confirm_to_delete_page),
95
+ url_for(
96
+ controller: "pages",
97
+ action: "destroy",
98
+ id: "__ID__"
99
+ )
100
+ ) -%>
101
+ <label class="center"><%= Alchemy.t(:delete_page) %></label>
102
+ {{else}}
103
+ <div class="sitemap_tool disabled with-hint">
104
+ <%= render_icon(:minus) %>
105
+ <span class="hint-bubble">
106
+ <%= Alchemy.t("Your user role does not allow you to edit this page") %>
107
+ </span>
108
+ {{/if}}
109
+ </div>
110
+ {{#if permissions.create}}
111
+ <div class="button_with_label sitemap_tool">
112
+ <%= link_to_dialog(
113
+ render_icon(:plus),
114
+ alchemy.new_admin_page_path(parent_id: "__ID__"),
115
+ {
116
+ title: Alchemy.t(:create_page),
117
+ size: "340x165",
118
+ overflow: true
119
+ }
120
+ ) -%>
121
+ <label class="left"><%= Alchemy.t(:create_page) %></label>
122
+ {{else}}
123
+ <div class="sitemap_tool disabled with-hint">
124
+ <%= render_icon(:plus) %>
125
+ <span class="hint-bubble">
126
+ <%= Alchemy.t("Your user role does not allow you to edit this page") %>
127
+ </span>
128
+ {{/if}}
129
+ </div>
147
130
  </div>
148
- <div class="page_infos" id="page_<%= page.id %>_infos">
131
+ <div class="page_infos">
149
132
  <span class="page_status with-hint">
150
133
  <i class="icon fas fa-fw fa-compass {{#unless public}}disabled{{/unless}}" data-fa-transform="shrink-2"></i>
151
134
  <span class="hint-bubble">{{status_titles.public}}</span>
@@ -160,23 +143,18 @@
160
143
  </div>
161
144
  <div class="sitemap_sitename">
162
145
  {{#if permissions.edit_content}}
163
- <%= link_to_unless(
164
- @sorting,
165
- '{{name}}',
166
- alchemy.edit_admin_page_path(page),
146
+ <%= link_to(
147
+ "{{name}}",
148
+ alchemy.edit_admin_page_path(id: "__ID__"),
167
149
  title: Alchemy.t(:edit_page),
168
150
  class: "sitemap_pagename_link"
169
- ) { content_tag('span', '{{name}}', class: "sitemap_pagename_link") } -%>
151
+ ) -%>
170
152
  {{else}}
171
- <%= content_tag('span', '{{name}}', class: "sitemap_pagename_link") %>
153
+ <%= content_tag("span", "{{name}}", class: "sitemap_pagename_link") %>
172
154
  {{/if}}
173
155
  </div>
174
156
  </div>
175
- {{#if children}}
176
- <% unless @sorting %>{{#unless folded}}<% end %>
177
- <ul id="page_{{id}}_children" class="level_{{level}}_children">
157
+ <ul id="page_{{id}}_children" class="children" data-parent-id="{{id}}">
178
158
  {{> list}}
179
159
  </ul>
180
- <% unless @sorting %>{{/unless}}<% end %>
181
- {{/if}}
182
160
  </li>
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
 
10
10
  <script id="sitemap-template" type="text/x-handlebars-template">
11
- <ul id="sitemap" class="list<%= @sorting ? ' sorting' : nil %>">
11
+ <ul id="sitemap" class="list">
12
12
  {{> list}}
13
13
  </ul>
14
14
  </script>
@@ -23,13 +23,7 @@
23
23
  $(function() {
24
24
  Alchemy.currentSitemap = new Alchemy.Sitemap({
25
25
  url: '<%= alchemy.tree_admin_pages_path %>',
26
- page_root_id: <%= @page_root.id %>,
27
- full: <%= full %>
28
- <% if @sorting %>
29
- ,ready: function () {
30
- Alchemy.PageSorter();
31
- }
32
- <% end %>
26
+ page_root_id: <%= @page_root.id %>
33
27
  });
34
28
  Alchemy.PagePublicationFields();
35
29
  });
@@ -28,18 +28,6 @@
28
28
  <label><%= Alchemy.t("Flush page cache") %></label>
29
29
  </div>
30
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
31
  <div class="button_with_label" id="clipboard_button">
44
32
  <%= link_to_dialog(
45
33
  render_icon(clipboard_empty?("pages") ? :clipboard : :paste),
@@ -37,7 +37,7 @@
37
37
  <% else %>
38
38
  <% if @page_root %>
39
39
  <h2 id="page_filter_result"></h2>
40
- <%= render "sitemap", page_partial: "page", full: !!@sorting %>
40
+ <%= render "sitemap", page_partial: "page" %>
41
41
  <% elsif can?(:create, Alchemy::Page) %>
42
42
  <%= render partial: "create_language_form" %>
43
43
  <% else %>
@@ -23,8 +23,15 @@
23
23
  return '<%= alchemy.move_api_node_path(id: 1) %>'.replace(/1/, id);
24
24
  },
25
25
 
26
+ move_admin_page_path: function(id) {
27
+ return '<%= alchemy.move_api_page_path(id: 1) %>'.replace(/1/, id);
28
+ },
29
+
30
+ fold_admin_page_path: function(id) {
31
+ return '<%= alchemy.fold_admin_page_path(id: 1) %>'.replace(/1/, id);
32
+ },
33
+
26
34
  order_admin_elements_path: '<%= alchemy.order_admin_elements_path %>',
27
- order_admin_pages_path: '<%= alchemy.order_admin_pages_path %>',
28
35
  link_admin_pages_path: '<%= alchemy.link_admin_pages_path %>',
29
36
  api_pages_path: '<%= alchemy.api_pages_path %>',
30
37
  api_elements_path: '<%= alchemy.api_elements_path %>'
@@ -14,7 +14,7 @@
14
14
  <script>
15
15
  $('#<%= essence_page_editor.form_field_id %>').alchemyPageSelect({
16
16
  placeholder: "<%= Alchemy.t(:search_page) %>",
17
- url: "<%= alchemy.api_pages_path %>",
17
+ url: "<%= alchemy.api_pages_path language_id: essence_page_editor.page&.language_id %>",
18
18
  query_params: <%== essence_page_editor.settings[:query_params].to_json %>,
19
19
  <% if essence_page_editor.essence.page %>
20
20
  initialSelection: {