Skip to content

Commit

Permalink
Fix humanization for add nested element button
Browse files Browse the repository at this point in the history
Converting `nestable_element` to a symbol allows us to humanize the nestable element name.
  • Loading branch information
nsaloj authored and tvdeyen committed Dec 28, 2023
1 parent 2a0cc22 commit 1281ae7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<%= f.hidden_field :page_version_id, value: element.page_version_id %>
<%= f.hidden_field :parent_element_id, value: element.id %>
<button class="add-nestable-element-button" is="alchemy-button">
<%= Alchemy.t(:add_nested_element, name: Alchemy.t(nestable_element, scope: 'element_names')) %>
<%= Alchemy.t(:add_nested_element, name: Alchemy.t(nestable_element.to_sym, scope: 'element_names')) %>
</button>
<% end %>
<% else %>
<%= link_to_dialog (nestable_element ? Alchemy.t(:add_nested_element, name: Alchemy.t(nestable_element, scope: 'element_names')) : Alchemy.t("New Element")),
<%= link_to_dialog (nestable_element ? Alchemy.t(:add_nested_element, name: Alchemy.t(nestable_element.to_sym, scope: 'element_names')) : Alchemy.t("New Element")),
alchemy.new_admin_element_path(
parent_element_id: element.id,
page_version_id: element.page_version_id
Expand Down
4 changes: 2 additions & 2 deletions spec/features/admin/edit_elements_feature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
scenario "the add button opens add element form with the clipboard tab" do
visit alchemy.admin_elements_path(page_version_id: element.page_version_id)
button = page.find(".add-nestable-element-button")
expect(button).to have_content "Add slide"
expect(button).to have_content "Add Slide"
button.click
expect(page).to have_select("Element")
expect(page).to have_css("[panel='paste_element_tab']")
Expand All @@ -76,7 +76,7 @@
scenario "the add element button immediately creates the nested element." do
visit alchemy.admin_elements_path(page_version_id: element.page_version_id)
button = page.find("button.add-nestable-element-button")
expect(button).to have_content "Add slide"
expect(button).to have_content "Add Slide"
button.click
expect(page).to have_selector(".element-editor[data-element-name='slide']")
end
Expand Down

0 comments on commit 1281ae7

Please sign in to comment.