Sha256: 45b492a434918db6f1c547945771cc0a183e57c300dd5f0a74bb894d97850639

Contents?: true

Size: 1.68 KB

Versions: 68

Compression:

Stored size: 1.68 KB

Contents

/**
 * Created by eric schlange on 12/16/14.
 */
var validatedSocialSubmit = false;

var validatePublic = function(event, shared_item_name) {
  // check if social sharing is included
  if ($('.'+shared_item_name).length > 0 && $('.'+shared_item_name+':checked').length > 0) {
    if (confirm('Are you sure that you would like to make these public?')) {
      return true;
    }
    else {
      event.preventDefault();
      return false;
    }
  } 
  // no social sharing
  else {
    return true;
  }
};

var validateMutliFormPage = function(event, shared_item_name, activity_id) {
  validatedSocialSubmit = false;
  if(!validatedSocialSubmit) {
    var shared_item_buttons = $("#activity-"+activity_id+" ."+shared_item_name);
    if (shared_item_buttons != null && 0 < shared_item_buttons.length) {
      for (var current_button_index = 0; current_button_index < shared_item_buttons.length && !validatedSocialSubmit; current_button_index++) {
        if (shared_item_buttons[current_button_index].checked) {
          if (confirm('Are you sure that you would like to make this public?')) {
            validatedSocialSubmit = true;
            return true;
          } else {
            event.preventDefault();
            return false;
          }
        }
      }
    } else {
      validatedSocialSubmit = true;
      return true;
    }
  }
};


var validatePublicNoEvent = function(event, shared_item_name) {
  if ($('.'+shared_item_name).length > 0 && $('.'+shared_item_name+':checked').length > 0) {
    if (confirm('Are you sure that you would like to make these public?')) {
      return true;
    }
    else {
      event.preventDefault();
      return false;
    }
  } 
  else {
    return true;
  }
};

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.22.8 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.22.7 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.22.6 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.22.5 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.22.4 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.22.2 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.22.1 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.22.0 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.21.2 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.21.1 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.21.0 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.20.1 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.19.9 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.19.8 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.19.7 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.19.6 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.19.5 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.19.4 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js
think_feel_do_engine-3.19.3 app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js