Sha256: fc702ae975fd2c3a0eb787c338d81d8e1bbe6c89eff48dfeb6251bbcd2d6439d

Contents?: true

Size: 669 Bytes

Versions: 44

Compression:

Stored size: 669 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Elections
    module TrusteeZone
      # This class holds a form to modify trustee information.
      class TrusteeForm < Decidim::Form
        mimic :trustee

        attribute :name, String
        attribute :public_key, String
        validates :name, :public_key, presence: true
        validate :dont_change_data

        def dont_change_data
          errors.add :name, :cant_be_changed if trustee.name.present?
          errors.add :public_key, :cant_be_changed if trustee.public_key.present?
        end

        def trustee
          @trustee ||= context[:trustee]
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
decidim-elections-0.28.4 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.27.9 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.28.3 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.27.8 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.28.2 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.27.7 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.28.1 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.27.6 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.26.10 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.26.9 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.28.0 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.27.5 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.28.0.rc5 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.28.0.rc4 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.26.8 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.27.4 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.27.3 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.26.7 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.26.5 app/forms/decidim/elections/trustee_zone/trustee_form.rb
decidim-elections-0.27.2 app/forms/decidim/elections/trustee_zone/trustee_form.rb