Sha256: 78fff50216406fe2d938c4cd11f79da3d8f80b3e98ce0cc6c2407cac46962757

Contents?: true

Size: 1.32 KB

Versions: 25

Compression:

Stored size: 1.32 KB

Contents

-# frozen_string_literal: true
- question.validations.each do |validation|
  - exp_classes = ["error", validation[:type], validation[:subtype]].compact
  - valtypes = answer.errors[question.key].collect{|e| e[:valtype]}
  - unless valtypes.include?(validation[:type])
    - exp_classes << "hidden"
  - translate_options = case validation[:type]
  - when :requires_answer, :valid_integer, :valid_float, :valid_date, :too_many_checked, :not_all_checked
    - {}
  - when :maximum, :minimum, :answer_group_minimum, :answer_group_maximum
    - if validation[:subtype] == :date
      - {value: validation[:value], friendly_date: I18n.l(validation[:value], format: :friendly_date)}
    - else
      - {value: validation[:value]}
  - when :regexp
    - {matcher: validation[:matcher]}
  - when :maximum_checked_allowed
    - {count: validation[:maximum_checked_value], maximum_checked_value: validation[:maximum_checked_value]}
  - when :minimum_checked_required
    - {count: validation[:minimum_checked_value], minimum_checked_value: validation[:minimum_checked_value]}
  - else
    %strong
      Error: unknown validation type
      = validation[:type]
  - validation_text = validation[:explanation]
  - validation_text ||= translate("validations.#{validation[:type]}.#{validation[:subtype]}", translate_options)
  %div{:class => exp_classes}= validation_text

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
quby-5.3.0 app/views/quby/v1/shared/_validations.html.haml
quby-5.2.0 app/views/quby/v1/shared/_validations.html.haml
quby-5.1.3 app/views/quby/v1/shared/_validations.html.haml
quby-5.1.2 app/views/quby/v1/shared/_validations.html.haml
quby-5.1.1 app/views/quby/v1/shared/_validations.html.haml
quby-5.1.0 app/views/quby/v1/shared/_validations.html.haml
quby-5.0.5 app/views/quby/v1/shared/_validations.html.haml
quby-5.0.4 app/views/quby/v1/shared/_validations.html.haml
quby-5.0.3 app/views/quby/v1/shared/_validations.html.haml
quby-5.0.2 app/views/quby/v1/shared/_validations.html.haml
quby-5.0.1 app/views/quby/v1/shared/_validations.html.haml
quby-5.0.0 app/views/quby/v1/shared/_validations.html.haml
quby-4.0.4 app/views/quby/v1/shared/_validations.html.haml
quby-5.0.0.pre4 app/views/quby/v1/shared/_validations.html.haml
quby-5.0.0.pre3 app/views/quby/v1/shared/_validations.html.haml
quby-5.0.0.pre2 app/views/quby/v1/shared/_validations.html.haml
quby-5.0.0.pre1 app/views/quby/v1/shared/_validations.html.haml
quby-4.0.3 app/views/quby/v1/shared/_validations.html.haml
quby-4.0.2 app/views/quby/v1/shared/_validations.html.haml
quby-4.0.1 app/views/quby/v1/shared/_validations.html.haml