Skip to content

Commit

Permalink
Allow to change page parent
Browse files Browse the repository at this point in the history
Unless the page is the current language root or a layoutpage, we allow to change the parent.

This is much more efficient than using the dragndrop interface, especially in large trees.
  • Loading branch information
tvdeyen committed Mar 4, 2022
1 parent f992443 commit 01eb770
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/views/alchemy/admin/pages/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<%= alchemy_form_for [:admin, @page], class: 'edit_page' do |f| %>
<% unless @page.language_root? || @page.layoutpage %>
<%= f.input :parent_id, required: true, input_html: { class: 'alchemy_selectbox' } %>
<% end %>

<div class="input check_boxes">
<label class="control-label"><%= Alchemy.t(:page_status) %></label>
<div class="control_group">
Expand Down Expand Up @@ -37,3 +41,18 @@

<%= f.submit Alchemy.t(:save) %>
<% end %>

<script>
$('#page_parent_id').alchemyPageSelect({
placeholder: "<%= Alchemy.t(:search_page) %>",
url: "<%= alchemy.api_pages_path %>",
allowClear: false,
<% if @page.parent %>
initialSelection: {
id: <%= @page.parent.id %>,
text: "<%= @page.parent.name %>",
url_path: "<%= @page.parent.url_path %>"
}
<% end %>
})
</script>

0 comments on commit 01eb770

Please sign in to comment.