Class: Decidim::Feeds::Admin::FeedForm

Inherits:
Form
  • Object
show all
Includes:
AttachmentAttributes, TranslatableAttributes
Defined in:
app/forms/decidim/feeds/admin/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

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

Returns:

  • (Boolean)


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

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

#has_error_in_attachments?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'app/forms/decidim/feeds/admin/feed_form.rb', line 69

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

#map_model(model) ⇒ Object



44
45
46
47
48
# File 'app/forms/decidim/feeds/admin/feed_form.rb', line 44

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