Use icons as links to edit content blocks
Just like we do with the rest of the tables in the admin section.
This commit is contained in:
@@ -34,21 +34,21 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% @content_blocks.each do |content_block| %>
|
<% @content_blocks.each do |content_block| %>
|
||||||
<tr id="<%= dom_id(content_block) %>">
|
<tr id="<%= dom_id(content_block) %>">
|
||||||
<td><%= link_to "#{content_block.name} (#{content_block.locale})", edit_admin_site_customization_content_block_path(content_block) %></td>
|
<td><%= "#{content_block.name} (#{content_block.locale})" %></td>
|
||||||
<td><%= raw content_block.body %></td>
|
<td><%= raw content_block.body %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= render Admin::TableActionsComponent.new(content_block, actions: [:destroy]) %>
|
<%= render Admin::TableActionsComponent.new(content_block) %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% @headings_content_blocks.each do |content_block| %>
|
<% @headings_content_blocks.each do |content_block| %>
|
||||||
<tr id="<%= dom_id(content_block) %>">
|
<tr id="<%= dom_id(content_block) %>">
|
||||||
<td><%= link_to "#{content_block.name} (#{content_block.locale})", admin_site_customization_edit_heading_content_block_path(content_block) %></td>
|
<td><%= "#{content_block.name} (#{content_block.locale})" %></td>
|
||||||
<td><%= raw content_block.body %></td>
|
<td><%= raw content_block.body %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= render Admin::TableActionsComponent.new(
|
<%= render Admin::TableActionsComponent.new(
|
||||||
content_block,
|
content_block,
|
||||||
actions: [:destroy],
|
edit_path: admin_site_customization_edit_heading_content_block_path(content_block),
|
||||||
destroy_path: admin_site_customization_delete_heading_content_block_path(content_block)
|
destroy_path: admin_site_customization_delete_heading_content_block_path(content_block)
|
||||||
) %>
|
) %>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -2,13 +2,19 @@ require "rails_helper"
|
|||||||
|
|
||||||
describe "Admin custom content blocks", :admin do
|
describe "Admin custom content blocks", :admin do
|
||||||
scenario "Index" do
|
scenario "Index" do
|
||||||
block = create(:site_customization_content_block)
|
block = create(:site_customization_content_block, name: "top_links")
|
||||||
heading_block = create(:heading_content_block)
|
heading_block = create(:heading_content_block, heading: create(:budget_heading, name: "Reforestation"))
|
||||||
visit admin_site_customization_content_blocks_path
|
visit admin_site_customization_content_blocks_path
|
||||||
|
|
||||||
expect(page).to have_content(block.name)
|
within "tr", text: "top_links" do
|
||||||
|
expect(page).to have_link "Edit"
|
||||||
|
end
|
||||||
|
|
||||||
|
within "tr", text: "Reforestation" do
|
||||||
|
expect(page).to have_link "Edit"
|
||||||
|
end
|
||||||
|
|
||||||
expect(page).to have_content(block.body)
|
expect(page).to have_content(block.body)
|
||||||
expect(page).to have_content(heading_block.heading.name)
|
|
||||||
expect(page).to have_content(heading_block.body)
|
expect(page).to have_content(heading_block.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -73,7 +79,7 @@ describe "Admin custom content blocks", :admin do
|
|||||||
click_link "Custom content blocks"
|
click_link "Custom content blocks"
|
||||||
end
|
end
|
||||||
|
|
||||||
click_link "top_links (en)"
|
within("tr", text: "top_links (en)") { click_link "Edit" }
|
||||||
|
|
||||||
fill_in "site_customization_content_block_body", with: "Some other custom content"
|
fill_in "site_customization_content_block_body", with: "Some other custom content"
|
||||||
click_button "Update Custom content block"
|
click_button "Update Custom content block"
|
||||||
|
|||||||
Reference in New Issue
Block a user