-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3054 from AlchemyCMS/page-update-turbo-stream
Use turbo streams to update page from configure dialog
- Loading branch information
Showing
13 changed files
with
139 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<%= alchemy_form_for [:admin, @page], url: alchemy.admin_layoutpage_path(@page), class: 'edit_page' do |f| %> | ||
<%= f.input :name, autofocus: true %> | ||
<%= render Alchemy::Admin::TagsAutocomplete.new do %> | ||
<%= f.input :tag_list, input_html: { value: f.object.tag_list.join(",") } %> | ||
<%= turbo_frame_tag @page do %> | ||
<%= alchemy_form_for [:admin, @page], url: alchemy.admin_layoutpage_path(@page), class: 'edit_page', remote: false do |f| %> | ||
<%= f.input :name, autofocus: true %> | ||
<%= render Alchemy::Admin::TagsAutocomplete.new do %> | ||
<%= f.input :tag_list, input_html: { value: f.object.tag_list.join(",") } %> | ||
<% end %> | ||
<%= f.submit Alchemy.t(:save) %> | ||
<% end %> | ||
<%= f.submit Alchemy.t(:save) %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div class="page_status_and_name" id="page_<%= current_page.id %>_status"> | ||
<div class="page_status_and_name" id="locked_page_<%= current_page.id %>"> | ||
<%= render 'alchemy/admin/pages/page_infos', page: current_page %> | ||
<%= render 'alchemy/admin/pages/page_status', page: current_page %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,58 @@ | ||
<%= alchemy_form_for [:admin, @page], class: 'edit_page' do |f| %> | ||
<% unless @page.language_root? || @page.layoutpage %> | ||
<%= render Alchemy::Admin::PageSelect.new(@page.parent) do %> | ||
<%= f.input :parent_id, required: true %> | ||
<%= turbo_frame_tag @page do %> | ||
<%= alchemy_form_for [:admin, @page], class: 'edit_page', remote: false do |f| %> | ||
<% unless @page.language_root? || @page.layoutpage %> | ||
<%= render Alchemy::Admin::PageSelect.new(@page.parent) do %> | ||
<%= f.input :parent_id, required: true %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<div class="input check_boxes"> | ||
<label class="control-label"><%= Alchemy.t(:page_status) %></label> | ||
<div class="control_group"> | ||
<%= render 'alchemy/admin/pages/publication_fields' %> | ||
<%= page_status_checkbox(@page, :restricted) %> | ||
<% if configuration(:sitemap)['show_flag'] %> | ||
<%= page_status_checkbox(@page, :sitemap) %> | ||
<% end %> | ||
<div class="input check_boxes"> | ||
<label class="control-label"><%= Alchemy.t(:page_status) %></label> | ||
<div class="control_group"> | ||
<%= render 'alchemy/admin/pages/publication_fields' %> | ||
<%= page_status_checkbox(@page, :restricted) %> | ||
<% if configuration(:sitemap)['show_flag'] %> | ||
<%= page_status_checkbox(@page, :sitemap) %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<%= f.input :name, autofocus: true %> | ||
<%= f.input :urlname, as: 'string', input_html: {value: @page.slug}, label: Alchemy::Page.human_attribute_name(:slug) %> | ||
<alchemy-char-counter max-chars="60"> | ||
<%= f.input :title %> | ||
</alchemy-char-counter> | ||
<%= f.input :name, autofocus: true %> | ||
<%= f.input :urlname, as: 'string', input_html: {value: @page.slug}, label: Alchemy::Page.human_attribute_name(:slug) %> | ||
<alchemy-char-counter max-chars="60"> | ||
<%= f.input :title %> | ||
</alchemy-char-counter> | ||
|
||
<% if Alchemy.enable_searchable %> | ||
<div class="input check_boxes"> | ||
<label class="control-label"><%= Alchemy.t(:fulltext_search) %></label> | ||
<div class="control_group"> | ||
<%= page_status_checkbox(@page, :searchable) %> | ||
</div> | ||
</div> | ||
<% end %> | ||
|
||
<% if Alchemy.enable_searchable %> | ||
<div class="input check_boxes"> | ||
<label class="control-label"><%= Alchemy.t(:fulltext_search) %></label> | ||
<label class="control-label"><%= Alchemy.t(:search_engines) %></label> | ||
<div class="control_group"> | ||
<%= page_status_checkbox(@page, :searchable) %> | ||
<%= page_status_checkbox(@page, :robot_index) %> | ||
<%= page_status_checkbox(@page, :robot_follow) %> | ||
</div> | ||
</div> | ||
<% end %> | ||
|
||
<div class="input check_boxes"> | ||
<label class="control-label"><%= Alchemy.t(:search_engines) %></label> | ||
<div class="control_group"> | ||
<%= page_status_checkbox(@page, :robot_index) %> | ||
<%= page_status_checkbox(@page, :robot_follow) %> | ||
</div> | ||
</div> | ||
<alchemy-char-counter max-chars="160"> | ||
<%= f.input :meta_description, as: 'text' %> | ||
</alchemy-char-counter> | ||
|
||
<alchemy-char-counter max-chars="160"> | ||
<%= f.input :meta_description, as: 'text' %> | ||
</alchemy-char-counter> | ||
<%= f.input :meta_keywords, | ||
as: 'text', | ||
hint: Alchemy.t('pages.update.comma_seperated') %> | ||
<%= f.input :meta_keywords, | ||
as: 'text', | ||
hint: Alchemy.t('pages.update.comma_seperated') %> | ||
<%= render Alchemy::Admin::TagsAutocomplete.new do %> | ||
<%= f.input :tag_list, input_html: { value: f.object.tag_list.join(",") } %> | ||
<% end %> | ||
<%= render Alchemy::Admin::TagsAutocomplete.new do %> | ||
<%= f.input :tag_list, input_html: { value: f.object.tag_list.join(",") } %> | ||
<%= hidden_field_tag :view, params[:view] %> | ||
<%= f.submit Alchemy.t(:save) %> | ||
<% end %> | ||
<%= f.submit Alchemy.t(:save) %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<alchemy-growl><%= @notice %></alchemy-action> | ||
<alchemy-action name="closeCurrentDialog"></alchemy-action> | ||
|
||
<% if @while_page_edit -%> | ||
<%= turbo_stream.replace "locked_page_#{@page.id}" do %> | ||
<%= render("alchemy/admin/pages/current_page", current_page: @page) %> | ||
<% end %> | ||
<alchemy-action name="reloadPreview"></alchemy-action> | ||
<% else %> | ||
<%= turbo_stream.replace "locked_page_#{@page.id}" do %> | ||
<%= render("alchemy/admin/pages/locked_page", locked_page: @page) %> | ||
<% end %> | ||
<% if @view == "list" %> | ||
<turbo-stream action="refresh"></turbo-stream> | ||
<% elsif @page.parent_id != @old_parent_id -%> | ||
<%= turbo_stream.append "sitemap" do %> | ||
<script type="module"> | ||
Alchemy.currentSitemap.load(<%= @page.get_language_root.id %>); | ||
</script> | ||
<% end %> | ||
<% else -%> | ||
<% if @page.layoutpage %> | ||
<%= turbo_stream.replace "page_#{@page.id}" do %> | ||
<%= render("alchemy/admin/layoutpages/layoutpage", layoutpage: @page) %> | ||
<% end %> | ||
<% else %> | ||
<%= turbo_stream.append "sitemap" do %> | ||
<script type="module"> | ||
const page = document.getElementById('page_<%= @page.id %>'); | ||
const page_html = "<%= j render('page', page: @page) %>".replace(/__ID__/g, "<%= @page.id %>"); | ||
const compiler = Handlebars.compile(page_html); | ||
const tree = <%== @tree.to_json %>; | ||
page.outerHTML = compiler(tree.pages[0]); | ||
</script> | ||
<% end %> | ||
<% end %> | ||
<% end -%> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters