Sha256: dd4c1b42936d03ec1da4ea80cc68c88bd18f3b379923d463c230030fb32f986b

Contents?: true

Size: 1.33 KB

Versions: 11

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # A form object used to update the current organization from the admin
    # dashboard.
    #
    class OrganizationForm < Form
      include TranslatableAttributes

      mimic :organization

      attribute :name, String
      attribute :reference_prefix, String
      attribute :twitter_handler, String
      attribute :facebook_handler, String
      attribute :instagram_handler, String
      attribute :youtube_handler, String
      attribute :github_handler, String
      attribute :default_locale, String
      attribute :badges_enabled, Boolean
      attribute :user_groups_enabled, Boolean

      attribute :send_welcome_notification, Boolean
      attribute :customize_welcome_notification, Boolean

      translatable_attribute :welcome_notification_subject, String
      translatable_attribute :welcome_notification_body, String

      validates :welcome_notification_subject, :welcome_notification_body, translatable_presence: true, if: proc { |form| form.customize_welcome_notification }

      validates :name, presence: true
      validates :default_locale, :reference_prefix, presence: true
      validates :default_locale, inclusion: { in: :available_locales }

      private

      def available_locales
        current_organization.available_locales
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-admin-0.20.1 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.20.0 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.19.1 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.18.1 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.19.0 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.17.2 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.18.0 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.17.1 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.16.1 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.17.0 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.16.0 app/forms/decidim/admin/organization_form.rb