Sha256: 25e95fb012ece122a6f1b94ec7471b40262604dd75a7cc898941e10978ac0cb5

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

$(function() {
	
	// all .toggle links must have a rel attribute to identify what element will toggle
	$(document).on("click",'a.toggle', function() {
		$($(this).attr('rel')).toggle();
	});

	// open modalbox
	$('.lightbox').fancybox({
		closeClick: false,
		autoSize: true
	});

	// datepicker input text field
	$('.datepicker').datepicker();

	// notices fadeout
	$(document).on("click",'a#system_notice_close, #system_notice', function() {
		$('#system_notice').remove();
	});

	// ajax forms cancel button closes modal window
	$(document).on("click",'.mdwa_ajax a.cancel', function() {
		$.fancybox.close(true);
	});	

	// set focus on modalbox form
  $(document).bind("ajaxComplete", function() {
    setFocusOnForm();
  });
	
});

function checkOrUncheckAll( to_be_checked ){
  var to_be_checked = to_be_checked || false;
  $( ".cid" ).attr( "checked", to_be_checked );
}

function defineAction( form, action, confirmation ) {
  var response = true;
  if( confirmation ) {
    response = confirm("Are you sure?");
  }
  if( response ) {
    $( "#" + form ).attr( "action", action);
    $( "#" + form ).submit();
  }
}

function defineOrder( form, action, id ) {
  $( "#" + form ).attr( "action", action);
  $( "#cb" + id ).attr( "checked", true);
  $( "#" + form ).submit();
}

function deleteSystemNotice() {
	$('#system_notice').fadeOut('slow', function() {
		$('#system_notice').remove();
	});
}

// focus on the first text input field in the first field on the page
function setFocusOnForm() {
	$(':input:enabled:visible:first', "div.filtros").focus();
  $(':input:enabled:visible:first', "div.mdwa_new").focus();
  $(':input:enabled:visible:first', "div.mdwa_edit").focus();
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mdd-3.1.1 lib/generators/mdwa/sandbox/templates/app/assets/javascripts/mdwa/template/all_pages.js