Sha256: 87a7ee9959c5300cdd62b086a6c23c1679be6c93c800aceee42a1e88e696d2e2

Contents?: true

Size: 914 Bytes

Versions: 3

Compression:

Stored size: 914 Bytes

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

      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

3 entries across 3 versions & 1 rubygems

Version Path
decidim-admin-0.15.2 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.15.1 app/forms/decidim/admin/organization_form.rb
decidim-admin-0.15.0 app/forms/decidim/admin/organization_form.rb