Fix hound warnings
This commit is contained in:
@@ -40,36 +40,36 @@ class Admin::Widget::CardsController < Admin::BaseController
|
||||
|
||||
private
|
||||
|
||||
def card_params
|
||||
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
def card_params
|
||||
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
|
||||
params.require(:widget_card).permit(
|
||||
:link_url, :button_text, :button_url, :alignment, :header, :site_customization_page_id,
|
||||
:columns,
|
||||
translation_params(Widget::Card),
|
||||
image_attributes: image_attributes
|
||||
)
|
||||
end
|
||||
|
||||
def header_card?
|
||||
params[:header_card].present?
|
||||
end
|
||||
|
||||
def redirect_to_customization_page_cards_or_homepage
|
||||
notice = t("admin.site_customization.pages.cards.#{params[:action]}.notice")
|
||||
|
||||
if @card.site_customization_page_id
|
||||
redirect_to admin_site_customization_page_cards_path(page), notice: notice
|
||||
else
|
||||
redirect_to admin_homepage_url, notice: notice
|
||||
params.require(:widget_card).permit(
|
||||
:link_url, :button_text, :button_url, :alignment, :header, :site_customization_page_id,
|
||||
:columns,
|
||||
translation_params(Widget::Card),
|
||||
image_attributes: image_attributes
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def page
|
||||
::SiteCustomization::Page.find(@card.site_customization_page_id)
|
||||
end
|
||||
def header_card?
|
||||
params[:header_card].present?
|
||||
end
|
||||
|
||||
def resource
|
||||
Widget::Card.find(params[:id])
|
||||
end
|
||||
def redirect_to_customization_page_cards_or_homepage
|
||||
notice = t("admin.site_customization.pages.cards.#{params[:action]}.notice")
|
||||
|
||||
if @card.site_customization_page_id
|
||||
redirect_to admin_site_customization_page_cards_path(page), notice: notice
|
||||
else
|
||||
redirect_to admin_homepage_url, notice: notice
|
||||
end
|
||||
end
|
||||
|
||||
def page
|
||||
::SiteCustomization::Page.find(@card.site_customization_page_id)
|
||||
end
|
||||
|
||||
def resource
|
||||
Widget::Card.find(params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<%= @page.title %> <%= t("admin.site_customization.pages.cards.cards_title") %></h2>
|
||||
|
||||
<div class="float-right">
|
||||
<%= link_to t("admin.site_customization.pages.cards.create_card"),
|
||||
<%= link_to t("admin.site_customization.pages.cards.create_card"),
|
||||
new_admin_widget_card_path(page_id: params[:page_id]), class: "button" %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
feature 'Cards' do
|
||||
feature "Cards" do
|
||||
|
||||
background do
|
||||
admin = create(:administrator).user
|
||||
@@ -232,8 +232,8 @@ feature 'Cards' do
|
||||
image_input = all(".image").last.find("input[type=file]", visible: false)
|
||||
attach_file(
|
||||
image_input[:id],
|
||||
Rails.root.join('spec/fixtures/files/clippy.jpg'),
|
||||
Rails.root.join("spec/fixtures/files/clippy.jpg"),
|
||||
make_visible: true)
|
||||
expect(page).to have_field('widget_card_image_attributes_title', with: "clippy.jpg")
|
||||
expect(page).to have_field("widget_card_image_attributes_title", with: "clippy.jpg")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user