Skip to content

Commit

Permalink
Revert "Send language_id (of the currently editing page) parameter to…
Browse files Browse the repository at this point in the history
… Pages API requests for page select on link overlay"

We need to revert the change made in AlchemyCMS#2439. We return all pages from the API on purpose. As already discussed in AlchemyCMS#2258

The actual issue was introduced in c98605a where we started to scope the pages to the language again. This change needs to be reverted as well.

This reverts commit f695769.
  • Loading branch information
tvdeyen committed Jun 30, 2023
1 parent 4a40764 commit c6b019f
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 25 deletions.
7 changes: 1 addition & 6 deletions app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,12 @@ class window.Alchemy.LinkDialog extends Alchemy.Dialog
initPageSelect: ->
pageTemplate = HandlebarsTemplates.page
element_anchor_placeholder = @$element_anchor.attr('placeholder')
if @link_object.dataset.languageId
api_url = "#{Alchemy.routes.api_pages_path}?language_id=#{@link_object.dataset.languageId}"
else
api_url = Alchemy.routes.api_pages_path

@$internal_link.select2
placeholder: Alchemy.t('Search page')
allowClear: true
minimumInputLength: 3
ajax:
url: api_url
url: Alchemy.routes.api_pages_path
datatype: 'json'
quietMillis: 300
data: (term, page) ->
Expand Down
1 change: 0 additions & 1 deletion app/views/alchemy/ingredients/shared/_link_tools.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
onclick: 'new Alchemy.LinkDialog(this).open(); return false;',
class: "icon_button#{ingredient_editor.linked? ? ' linked' : ''} link-ingredient",
"data-parent-selector": "[data-ingredient-id='#{ingredient_editor.id}']",
"data-language-id": ingredient_editor.page&.language_id,
title: Alchemy.t(:place_link),
id: "edit_link_#{ingredient_editor.id}"
) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
class: picture_editor.linked? ? "linked" : nil,
title: Alchemy.t(:link_image),
"data-parent-selector": "[data-ingredient-id='#{picture_editor.id}']",
"data-language-id": picture_editor.page&.language_id,
id: "edit_link_#{picture_editor.id}"
} do %>
<span class="disabled" tabindex="-1"><%= render_icon(:link) %></span>
Expand Down
17 changes: 0 additions & 17 deletions spec/features/admin/link_overlay_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,6 @@
)
end

it "should only return pages from the language of the page being edited" do
page_in_other_language = create :alchemy_page, :public, language: create(:alchemy_language, language_code: "es", public: true)

visit edit_admin_page_path(page1)

within "#element_#{article.id}" do
fill_in "Intro", with: "Link me"
click_link "Link text"
end

within "#overlay_tab_internal_link" do
expect(page).to have_selector("#s2id_internal_link")
expect { select2(page_in_other_language.name, from: "Page") }.to raise_error(Capybara::ElementNotFound)
expect(find("#internal_link").value).not_to eq page_in_other_language.urlname
end
end

it "should be possible to link a page" do
visit edit_admin_page_path(page1)

Expand Down

0 comments on commit c6b019f

Please sign in to comment.