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-0.13.4 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.13.3 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.13.2 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.13.1 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.13.0 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.12.2 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.11.2 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.12.1 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.12.0 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.11.1 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.10.9 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.11.0 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.10.8 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.10.7 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.10.6 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.10.4 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.9.6 app/assets/javascripts/trigger_form.js
foreman-tasks-0.10.3 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.10.2 app/assets/javascripts/foreman_tasks/trigger_form.js
foreman-tasks-0.10.1 app/assets/javascripts/foreman_tasks/trigger_form.js