Update widget cards translatable fields
This commit is contained in:
@@ -43,9 +43,8 @@ class Admin::Widget::CardsController < Admin::BaseController
|
||||
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
|
||||
params.require(:widget_card).permit(
|
||||
:label, :title, :description, :link_text, :link_url,
|
||||
:button_text, :button_url, :alignment, :header,
|
||||
*translation_params(Widget::Card),
|
||||
:link_url, :button_text, :button_url, :alignment, :header,
|
||||
translation_params(Widget::Card),
|
||||
image_attributes: image_attributes
|
||||
)
|
||||
end
|
||||
|
||||
@@ -9,6 +9,7 @@ class Widget::Card < ActiveRecord::Base
|
||||
translates :description, touch: true
|
||||
translates :link_text, touch: true
|
||||
globalize_accessors
|
||||
accepts_nested_attributes_for :translations, allow_destroy: true
|
||||
|
||||
def self.header
|
||||
where(header: true)
|
||||
|
||||
@@ -2,17 +2,19 @@
|
||||
|
||||
<%= translatable_form_for [:admin, @card] do |f| %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.translatable_text_field :label %>
|
||||
</div>
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<div class="small-12 medium-6">
|
||||
<%= translations_form.text_field :label %>
|
||||
</div>
|
||||
|
||||
<%= f.translatable_text_field :title %>
|
||||
<%= translations_form.text_field :title %>
|
||||
|
||||
<%= f.translatable_text_area :description, rows: 5 %>
|
||||
<%= translations_form.text_area :description, rows: 5 %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.translatable_text_field :link_text %>
|
||||
</div>
|
||||
<div class="small-12 medium-6">
|
||||
<%= translations_form.text_field :link_text %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 medium-6">
|
||||
<%= f.text_field :link_url %>
|
||||
|
||||
@@ -291,6 +291,11 @@ en:
|
||||
description: Description
|
||||
link_text: Link text
|
||||
link_url: Link URL
|
||||
widget/card/translation:
|
||||
label: Label (optional)
|
||||
title: Title
|
||||
description: Description
|
||||
link_text: Link text
|
||||
widget/feed:
|
||||
limit: Number of items
|
||||
errors:
|
||||
|
||||
@@ -291,6 +291,11 @@ es:
|
||||
description: Descripción
|
||||
link_text: Texto del enlace
|
||||
link_url: URL del enlace
|
||||
widget/card/translation:
|
||||
label: Etiqueta (opcional)
|
||||
title: Título
|
||||
description: Descripción
|
||||
link_text: Texto del enlace
|
||||
widget/feed:
|
||||
limit: Número de elementos
|
||||
errors:
|
||||
|
||||
@@ -16,10 +16,10 @@ feature 'Cards' do
|
||||
visit admin_homepage_path
|
||||
click_link "Create card"
|
||||
|
||||
fill_in "widget_card_label_en", with: "Card label"
|
||||
fill_in "widget_card_title_en", with: "Card text"
|
||||
fill_in "widget_card_description_en", with: "Card description"
|
||||
fill_in "widget_card_link_text_en", with: "Link text"
|
||||
fill_in "Label (optional)", with: "Card label"
|
||||
fill_in "Title", with: "Card text"
|
||||
fill_in "Description", with: "Card description"
|
||||
fill_in "Link text", with: "Link text"
|
||||
fill_in "widget_card_link_url", with: "consul.dev"
|
||||
attach_image_to_card
|
||||
click_button "Create card"
|
||||
@@ -64,10 +64,10 @@ feature 'Cards' do
|
||||
click_link "Edit"
|
||||
end
|
||||
|
||||
fill_in "widget_card_label_en", with: "Card label updated"
|
||||
fill_in "widget_card_title_en", with: "Card text updated"
|
||||
fill_in "widget_card_description_en", with: "Card description updated"
|
||||
fill_in "widget_card_link_text_en", with: "Link text updated"
|
||||
fill_in "Label (optional)", with: "Card label updated"
|
||||
fill_in "Title", with: "Card text updated"
|
||||
fill_in "Description", with: "Card description updated"
|
||||
fill_in "Link text", with: "Link text updated"
|
||||
fill_in "widget_card_link_url", with: "consul.dev updated"
|
||||
click_button "Save card"
|
||||
|
||||
@@ -104,10 +104,10 @@ feature 'Cards' do
|
||||
visit admin_homepage_path
|
||||
click_link "Create header"
|
||||
|
||||
fill_in "widget_card_label_en", with: "Header label"
|
||||
fill_in "widget_card_title_en", with: "Header text"
|
||||
fill_in "widget_card_description_en", with: "Header description"
|
||||
fill_in "widget_card_link_text_en", with: "Link text"
|
||||
fill_in "Label (optional)", with: "Header label"
|
||||
fill_in "Title", with: "Header text"
|
||||
fill_in "Description", with: "Header description"
|
||||
fill_in "Link text", with: "Link text"
|
||||
fill_in "widget_card_link_url", with: "consul.dev"
|
||||
click_button "Create header"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user