Class: Decidim::Organization
Overview
Organizations are one of the main models of Decidim. In a single Decidim installation we can find many organizations and each of them can start their own participatory processes.
Constant Summary
collapse
- SOCIAL_HANDLERS =
[:twitter, :facebook, :instagram, :youtube, :github].freeze
- AVAILABLE_MACHINE_TRANSLATION_DISPLAY_PRIORITIES =
%w(original translation).freeze
Class Method Summary
collapse
Instance Method Summary
collapse
#attached_uploader, #maximum_avatar_size
empty_translatable, ensure_translatable, multi_translation, translated_in_current_locale?
#default_locale?
Class Method Details
.log_presenter_class_for(_log) ⇒ Object
Instance Method Details
#admin_terms_of_use_body ⇒ Object
114
115
116
117
|
# File 'app/models/decidim/organization.rb', line 114
def admin_terms_of_use_body
self[:admin_terms_of_use_body] ||
multi_translation("decidim.admin_terms_of_use.default_body", available_locales)
end
|
#available_authorization_handlers ⇒ Object
79
80
81
|
# File 'app/models/decidim/organization.rb', line 79
def available_authorization_handlers
available_authorizations & Decidim.authorization_handlers.map(&:name)
end
|
#customize_welcome_notification ⇒ Object
100
101
102
|
# File 'app/models/decidim/organization.rb', line 100
def customize_welcome_notification
self[:welcome_notification_subject].present? || self[:welcome_notification_body].present?
end
|
#enabled_omniauth_providers ⇒ Object
131
132
133
134
135
136
|
# File 'app/models/decidim/organization.rb', line 131
def enabled_omniauth_providers
return Decidim::OmniauthProvider.enabled || {} if omniauth_settings.nil?
default_except_disabled = Decidim::OmniauthProvider.enabled.except(*tenant_disabled_providers_keys)
default_except_disabled.merge(tenant_enabled_providers)
end
|
#machine_translation_prioritizes_original? ⇒ Boolean
138
139
140
|
# File 'app/models/decidim/organization.rb', line 138
def machine_translation_prioritizes_original?
machine_translation_display_priority == "original"
end
|
#machine_translation_prioritizes_translation? ⇒ Boolean
142
143
144
|
# File 'app/models/decidim/organization.rb', line 142
def machine_translation_prioritizes_translation?
machine_translation_display_priority == "translation"
end
|
#maximum_upload_size ⇒ Object
This is needed for the upload validations
75
76
77
|
# File 'app/models/decidim/organization.rb', line 75
def maximum_upload_size
settings.upload_maximum_file_size
end
|
#open_data_file_path ⇒ Object
127
128
129
|
# File 'app/models/decidim/organization.rb', line 127
def open_data_file_path
"#{host}-open-data.zip"
end
|
#presenter ⇒ Object
Returns the presenter for this author, to be used in the views. Required by ActsAsAuthor.
148
149
150
|
# File 'app/models/decidim/organization.rb', line 148
def presenter
Decidim::Debates::OfficialAuthorPresenter.new
end
|
#public_participatory_spaces ⇒ Object
90
91
92
93
94
|
# File 'app/models/decidim/organization.rb', line 90
def public_participatory_spaces
@public_participatory_spaces ||= Decidim.participatory_space_manifests.flat_map do |manifest|
manifest.participatory_spaces.call(self).public_spaces
end
end
|
#published_components ⇒ Object
96
97
98
|
# File 'app/models/decidim/organization.rb', line 96
def published_components
@published_components ||= Component.where(participatory_space: public_participatory_spaces).published
end
|
#sign_in_enabled? ⇒ Boolean
123
124
125
|
# File 'app/models/decidim/organization.rb', line 123
def sign_in_enabled?
!users_registration_mode_disabled?
end
|
#sign_up_enabled? ⇒ Boolean
119
120
121
|
# File 'app/models/decidim/organization.rb', line 119
def sign_up_enabled?
users_registration_mode_enabled?
end
|
#static_pages_accessible_for(user) ⇒ Object
152
153
154
|
# File 'app/models/decidim/organization.rb', line 152
def static_pages_accessible_for(user)
static_pages.accessible_for(self, user)
end
|
#top_scopes ⇒ Object
Returns top level scopes for this organization.
Returns an ActiveRecord::Relation.
86
87
88
|
# File 'app/models/decidim/organization.rb', line 86
def top_scopes
@top_scopes ||= scopes.top_level
end
|
#welcome_notification_body ⇒ Object
109
110
111
112
|
# File 'app/models/decidim/organization.rb', line 109
def welcome_notification_body
self[:welcome_notification_body] ||
multi_translation("decidim.welcome_notification.default_body", available_locales)
end
|
#welcome_notification_subject ⇒ Object
104
105
106
107
|
# File 'app/models/decidim/organization.rb', line 104
def welcome_notification_subject
self[:welcome_notification_subject] ||
multi_translation("decidim.welcome_notification.default_subject", available_locales)
end
|