Skip to content

Commit

Permalink
Fix image / attachments not visible in admin edit
Browse files Browse the repository at this point in the history
  • Loading branch information
ahukkanen committed Jan 2, 2025
1 parent 99edd41 commit 3cf7a6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 0 additions & 4 deletions app/controllers/decidim/ideas/admin/ideas_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ def update_area_scope
def edit
enforce_permission_to :edit, :idea, idea: idea
@form = form(Admin::IdeaForm).from_model(idea)

@form.add_images = form(Decidim::AttachmentForm).from_model(
idea.image
)
end

def update
Expand Down
3 changes: 3 additions & 0 deletions app/forms/decidim/ideas/admin/idea_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class IdeaForm < Decidim::Form
delegate :categories, to: :current_component

def map_model(model)
self.images = [model.image].compact
self.actual_attachments = model.actual_attachments

self.suggested_hashtags = Decidim::ContentRenderers::HashtagRenderer.new(model.body).extra_hashtags.map(&:name).map(&:downcase)

self.user_group_id = model.user_groups.first&.id
Expand Down

0 comments on commit 3cf7a6e

Please sign in to comment.