Files
nairobi/app/views/admin/widget/cards/_form.html.erb
Javi Martín 629df5ab9b Simplify getting imageable/documentable in forms
The imageable/documentable object is always the object the form builder
is based on; since we're already passing the form builder, we don't have
to pass the object as well.

The only exception are the poll answers. In this case, we're passing a
new answer as the object. That's OK; the same hack that we're using to
send the data to the answer URL without displaying existing attachments
causes the form to keep working the same way.
2021-07-13 16:58:13 +02:00

59 lines
1.6 KiB
Plaintext

<%= render "shared/globalize_locales", resource: card %>
<%= translatable_form_for [namespace.to_sym, card.cardable, card], url: local_assigns[:url] do |f| %>
<%= render "shared/errors", resource: card %>
<div class="row">
<%= f.translatable_fields do |translations_form| %>
<div class="small-12 medium-6 column end">
<%= translations_form.text_field :label %>
</div>
<div class="column">
<%= translations_form.text_field :title %>
</div>
<div class="column">
<%= translations_form.text_area :description, rows: 5 %>
</div>
<div class="small-12 medium-6 column end">
<%= translations_form.text_field :link_text %>
</div>
<% end %>
</div>
<div class="row">
<div class="small-12 medium-6 column">
<%= f.text_field :link_url %>
</div>
</div>
<div class="row">
<% unless card.header? %>
<div class="column">
<%= f.label :columns %>
<p class="help-text"><%= t("admin.site_customization.pages.cards.columns_help") %></p>
<div class="small-12 medium-4 large-2">
<%= f.select :columns, (1..12), label: false %>
</div>
</div>
<% end %>
</div>
<%= f.hidden_field :header, value: card.header? %>
<div class="row">
<div class="image-form">
<div class="image small-12 column">
<%= render "images/nested_image", f: f %>
</div>
</div>
<div class="column">
<%= f.submit(
t("admin.homepage.#{admin_submit_action(card)}.#{card.header? ? "submit_header" : "submit_card"}"),
class: "button success"
) %>
</div>
</div>
<% end %>