Class: Decidim::Posts::PostForm
- Inherits:
-
Form
- Object
- Form
- Decidim::Posts::PostForm
- Includes:
- AttachmentAttributes, TranslatableAttributes
- Defined in:
- app/forms/decidim/posts/post_form.rb
Instance Method Summary collapse
-
#has_attachments? ⇒ Boolean
def component_suggested_hashtags @component_suggested_hashtags ||= ordered_hashtag_list(current_component.current_settings.suggested_hashtags) end.
- #has_error_in_attachments? ⇒ Boolean
-
#map_model(model) ⇒ Object
delegate :categories, to: :current_component.
Instance Method Details
#has_attachments? ⇒ Boolean
def component_suggested_hashtags
||= ordered_hashtag_list(current_component.current_settings.)
end
87 88 89 |
# File 'app/forms/decidim/posts/post_form.rb', line 87 def post. && errors[:documents].empty? && documents.present? end |
#has_error_in_attachments? ⇒ Boolean
91 92 93 |
# File 'app/forms/decidim/posts/post_form.rb', line 91 def errors[:documents].present? end |
#map_model(model) ⇒ Object
delegate :categories, to: :current_component
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/forms/decidim/posts/post_form.rb', line 40 def map_model(model) self.body = translated_attribute(model.body) self.highlighted = model.highlighted self.fixed = model.fixed self.category = model.category self.enable_comments = model.enable_comments self.questions = model.questions.map do |question| QuestionForm.from_model(question) end # @suggested_hashtags = Decidim::ContentRenderers::HashtagRenderer.new(body).extra_hashtags.map(&:name).map(&:downcase) # presenter = PostPresenter.new(model) # self.body = presenter.editor_body(all_locales: body.is_a?(Hash)) self.documents = model. end |