Sha256: a5bd5b6aa6dc2df9c65d914608b31cc9731610000c5eba247bf86cc7bb7c516b

Contents?: true

Size: 1.38 KB

Versions: 24

Compression:

Stored size: 1.38 KB

Contents

.nested-fields.row
  .col-lg-4
    = f.input :name, label: t('capsule.attributes.validation'), collection: f.object.simple_validations.map { |v| [t("keppler_capsules.validations.#{v}"), v] }, include_blank: false, input_html: { id: "select"}
  .col-lg-3
    = f.input :field, label: t('capsule.attributes.capsule_field'), collection: @capsule.capsule_fields.map(&:name_field), include_blank: false
  .col-lg-3{style: "display:none"}
    = f.input :validation, label: t('capsule.attributes.value')
  .col-lg-1
    = link_to_remove_association "<button class='btn btn-default btn-delete-field'><i class='icon-trash'></i></button>".html_safe, f
    .clearfix
:javascript
  $(document).on('cocoon:after-insert', function(e, insertedItem) {
    $("select[name='capsule[capsule_validations_attributes]["+get_form_id()+"][name]']").change(function(){
      var validationValid = [
        'validates_max_number', 'validates_min_number',
        'validates_format_of', 'validates_character_quantity_of'
      ];

      if(validationValid.includes(this.value)) {
        $(insertedItem[0].childNodes[5]).css("display", "block");
      } else {
        $(insertedItem[0].childNodes[5]).css("display", "none");
      }
    })

    function get_form_id() {
      var element = insertedItem[0];
      for(var i=0; i < 3; i++) {
        element = element.childNodes[1];
      }
      return element.name.split("][")[1]
    }
  });

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
keppler-2.1.22 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.21 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.20 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.19 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.18 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.17 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.16 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.15 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.14 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.13 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.12 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.11 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.10 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.9 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.8 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.7 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.6 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.5 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.4 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml
keppler-2.1.3 installer/core/rockets/keppler_capsules/app/views/keppler_capsules/admin/capsules/_capsule_validation_fields.html.haml