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