Use polymorphic routes to manage cards
We use a different logic to load the card depending on the controller we're using, and then share the rest of the code. This way we simplify the code a bit, since we don't have to check for the page_id parameter.
This commit is contained in:
@@ -17,8 +17,6 @@
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= render Admin::TableActionsComponent.new(card,
|
||||
edit_path: edit_admin_widget_card_path(card, page_id: params[:page_id])
|
||||
) %>
|
||||
<%= render Admin::TableActionsComponent.new(card) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<div class="float-right">
|
||||
<%= link_to t("admin.site_customization.pages.cards.create_card"),
|
||||
new_admin_widget_card_path(page_id: params[:page_id]), class: "button" %>
|
||||
new_admin_site_customization_page_widget_card_path(@page), class: "button" %>
|
||||
</div>
|
||||
|
||||
<% if @cards.present? %>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<td>
|
||||
<%= render Admin::TableActionsComponent.new(page) do |actions| %>
|
||||
<%= actions.link_to t("admin.site_customization.pages.page.see_cards"),
|
||||
admin_site_customization_page_cards_path(page),
|
||||
admin_site_customization_page_widget_cards_path(page),
|
||||
class: "cards-link" %>
|
||||
|
||||
<% if page.status == "published" %>
|
||||
|
||||
Reference in New Issue
Block a user