Class: Decidim::Admin::StaticPageForm

Inherits:
Form show all
Includes:
TranslatableAttributes
Defined in:
decidim-admin/app/forms/decidim/admin/static_page_form.rb

Overview

A form object to create or update pages.

Constant Summary

Constants included from Decidim::AttributeObject::TypeMap

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

Instance Attribute Summary

Attributes inherited from Decidim::AttributeObject::Form

#context

Instance Method Summary collapse

Methods included from TranslatableAttributes

#default_locale?

Methods inherited from Decidim::AttributeObject::Form

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

Methods included from Decidim::AttributeObject::Model

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

Instance Method Details

#control_public_access?Boolean

Returns:


45
46
47
# File 'decidim-admin/app/forms/decidim/admin/static_page_form.rb', line 45

def control_public_access?
  current_organization.force_users_to_authenticate_before_access_organization?
end

#slugObject


28
29
30
# File 'decidim-admin/app/forms/decidim/admin/static_page_form.rb', line 28

def slug
  super.to_s.downcase
end

#topicObject


32
33
34
35
36
37
# File 'decidim-admin/app/forms/decidim/admin/static_page_form.rb', line 32

def topic
  @topic ||= StaticPageTopic.find_by(
    organization: organization,
    id: topic_id
  )
end

#topicsObject


39
40
41
42
43
# File 'decidim-admin/app/forms/decidim/admin/static_page_form.rb', line 39

def topics
  @topics ||= StaticPageTopic.where(
    organization: current_organization
  )
end