Skip to content

Commit

Permalink
Reverse changes to image_methods / Edit admin form
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed Dec 30, 2024
1 parent bd00b49 commit d44b9e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
12 changes: 4 additions & 8 deletions app/commands/concerns/decidim/ideas/image_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@ module Decidim
module Ideas
# A module with all the image attachment common methods
module ImageMethods
include Decidim::AttachmentMethods

private

def build_image
form_image = @form.add_images.compact_blank

form_image = @form.add_images.compact_blank.first
@image = Decidim::Ideas::Attachment.new(
attached_to: @attached_to, # Keep first
title: { I18n.locale.to_s => form_image.first },
file: signed_id_for(form_image.last),
weight: 0,
content_type: content_type_for(form_image.last)
title: { I18n.locale.to_s => form_image["title"] },
file: form_image["file"],
weight: 0
)
end

Expand Down
16 changes: 8 additions & 8 deletions app/views/decidim/ideas/admin/ideas/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@
<div class="row column">
<fieldset>
<legend><%= t(".image_legend") %></legend>
<%= form.fields_for :add_images, @form.attachment do |nested_form| %>
<div class="row column">
<%= nested_form.text_field :title %>
</div>
<%= form.fields_for :images, @form.images do |nested_form| %>
<div class="row column">
<%= nested_form.text_field :title %>
</div>

<div class="row column">
<%= nested_form.upload :file, button_class: "button button__sm button__transparent-secondary", optional: true %>
</div>
<div class="row column">
<%= nested_form.upload :file, button_class: "button button__sm button__transparent-secondary", optional: true %>
</div>
<% end %>
</fieldset>
</div>
Expand All @@ -99,7 +99,7 @@
<div class="row column">
<fieldset>
<legend><%= t(".attachment_legend") %></legend>
<%= form.fields_for :attachment, @form.attachment do |nested_form| %>
<%= form.fields_for :actual_attachments, @form.actual_attachments do |nested_form| %>
<div class="row column">
<%= nested_form.text_field :title %>
</div>
Expand Down

0 comments on commit d44b9e7

Please sign in to comment.