class Decidim::Debates::Admin::DebateForm
This class holds a Form to create/update debates from Decidim’s admin panel.
def category
def category return unless current_component @category ||= current_component.categories.find_by(id: decidim_category_id) end
def map_model(model)
def map_model(model) self.finite = model.start_time.present? && model.end_time.present? self.decidim_category_id = model.categorization.decidim_category_id if model.categorization presenter = DebatePresenter.new(model) self.title = presenter.title(all_locales: title.is_a?(Hash)) self.description = presenter.description(all_locales: description.is_a?(Hash)) end
def scope
Finds the Scope from the given decidim_scope_id, uses the compoenent scope if missing.
def scope @scope ||= @scope_id ? current_component.scopes.find_by(id: @scope_id) : current_component.scope end
def scope_id
Scope identifier
def scope_id @scope_id || scope&.id end
def validate_end_time?
def validate_end_time? finite && start_time.present? end
def validate_start_time?
def validate_start_time? end_time.present? end