Class: Decidim::Feeds::FeedForm

Inherits:
Form
  • Object
show all
Includes:
AttachmentAttributes, TranslatableAttributes
Defined in:
app/forms/decidim/feeds/feed_form.rb

Overview

A form object used to create feeds from the admin dashboard.

Instance Method Summary collapse

Instance Method Details

#has_attachments?Boolean



61
62
63
# File 'app/forms/decidim/feeds/feed_form.rb', line 61

def has_attachments?
  feed.has_attachments? && errors[:documents].empty? && documents.present?
end

#has_error_in_attachments?Boolean



65
66
67
# File 'app/forms/decidim/feeds/feed_form.rb', line 65

def has_error_in_attachments?
  errors[:documents].present?
end

#map_model(model) ⇒ Object

def processes_for_select @processes_for_select ||= organization_participatory_processes &.map { |pp| [translated_attribute(pp.title), pp.id] } &.sort_by { |arr| arr } end



55
56
57
58
59
# File 'app/forms/decidim/feeds/feed_form.rb', line 55

def map_model(model)
  self.title = model.title # translated_attribute(model.title)
  # self.slug = model.slug
  self.documents = model.attachments
end