Class: Decidim::Proposals::CollaborativeDraftForm

Inherits:
ProposalForm show all
Defined in:
decidim-proposals/app/forms/decidim/proposals/collaborative_draft_form.rb

Overview

A form object to be used when public users want to create a Collaborative Draft.

Constant Summary

Constants included from AttributeObject::TypeMap

AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal

Instance Attribute Summary

Attributes inherited from AttributeObject::Form

#context

Instance Method Summary collapse

Methods inherited from ProposalForm

#category, #component_automatic_hashtags, #component_suggested_hashtags, #extra_hashtags, #geocoded?, #geocoding_enabled?, #has_address?, #scope, #scope_id, #suggested_hashtag_checked?, #suggested_hashtags

Methods included from HasUploadValidations

#attached_uploader, #maximum_avatar_size, #maximum_upload_size

Methods included from TranslatableAttributes

#default_locale?

Methods inherited from AttributeObject::Form

ensure_hash, from_model, from_params, hash_from, infer_model_name, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context

Methods included from AttributeObject::Model

#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h

Instance Method Details

#map_model(model) ⇒ Object



7
8
9
10
11
12
13
# File 'decidim-proposals/app/forms/decidim/proposals/collaborative_draft_form.rb', line 7

def map_model(model)
  super

  return unless model.categorization

  self.category_id = model.categorization.decidim_category_id
end

#user_groupObject



15
16
17
# File 'decidim-proposals/app/forms/decidim/proposals/collaborative_draft_form.rb', line 15

def user_group
  @user_group ||= Decidim::UserGroup.find user_group_id if user_group_id.present?
end