Sha256: 3be3e03e4dbd587ca02ee49fe4a551309e38c578a26279e437336e0387a873c9

Contents?: true

Size: 1.52 KB

Versions: 108

Compression:

Stored size: 1.52 KB

Contents

function trigger_form_selector_binds(form_name, form_object_name) {
  var form = $('form#' +  form_name);
  var trigger_mode_selector = form.find('input.trigger_mode_selector');
  var input_type_selector = form.find('.form-control#input_type_selector');

  trigger_mode_selector.on('click', function () {
    ["future", "immediate", "recurring"].forEach(function(type) {
      form.find('fieldset.trigger_mode_form#trigger_mode_' + type).hide();
    });
    form.find('fieldset.trigger_mode_form#trigger_mode_' + $(this).val()).show();
  });

  input_type_selector.on('change', function () {
    var fieldset = form.find('fieldset.trigger_mode_form#trigger_mode_recurring');
    ['cronline', 'monthly', 'weekly', 'hourly', 'daily'].forEach(function(type) {
      fieldset.find('fieldset.input_type_form#input_type_' + type).hide();
    })
    fieldset.find('fieldset.input_type_form#input_type_' + $(this).val()).show();
    var timepicker = fieldset.find('fieldset.input_type_form#time_picker');
    if($(this).val() == 'cronline') {
      timepicker.hide();
    } else {
      var hour_picker = timepicker.find('#s2id_triggering_time_time_4i');
      if($(this).val() == 'hourly') {
        hour_picker.hide();
      } else {
        hour_picker.show();
      }
      timepicker.show();
    }
  });

  form.find('input.end_time_limit_selector').on('click', function() {
    var o = form.find('fieldset#trigger_mode_recurring fieldset#end_time_limit_form');
    if($(this).val() === 'true') {
      o.show();
    } else {
      o.hide();
    };
  });
};

Version data entries

108 entries across 108 versions & 1 rubygems

Version Path
foreman-tasks-4.1.6 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-5.1.0 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-4.1.5 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-4.1.4 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-4.1.3 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-3.0.6 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-5.0.0 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-4.1.2 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-4.1.1 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-4.0.1 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-4.1.0 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-3.0.5 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-4.0.0 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-3.0.4 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-2.0.3 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-3.0.3 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-3.0.2 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-3.0.1 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-3.0.0 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-2.0.2 app/assets/javascripts/foreman_tasks/trigger_form.js