Sha256: e35edb687445945610e85b78bb8f875ab8b617bc88613d2b7ab1574fd6c31f61

Contents?: true

Size: 1.77 KB

Versions: 3

Compression:

Stored size: 1.77 KB

Contents

var relations;

function checkBoxId(id) {
  return id.match(/\d+$/)[0];
}

function checkBoxType(id) {
  return id.match(/(.*)_\d+$/)[1]
}

function checkBoxValue(id) {
  return $('label[for$=' + id +']').html(); 
}

function checkBoxOrder(id) {
  return parseInt($('label[for$=' + id +']').attr("order"));
}

function checkBoxIdByOrder(order) {
  return $('label[order$=' + order +']').attr("for");
}


function checkBoxEnable(id) {
	$('div[contain$='+id+']').addClass("checked-option");

        switch (checkBoxType(id)) {

	case "relation_custom":
		$(':checkbox[id^="relation_custom"]:checked:not(#' + id + ')').checkBox('changeCheckStatus', false);

		$.ajax({
			url: "<%= permissions_path %>",
			context: document.body,
			data: { relation_id: checkBoxId(id) },
                        dataType: "script"
		});

                break;

	case "permission":
                $('input[id="relation_custom_permission_ids_' + checkBoxId(id) + '"]').attr('checked', 'checked');
                $('label[for="relation_custom_permission_ids_' + checkBoxId(id) + '"]').parent().show();

                break;

        default:
          alert("Unknown type of checkBox: " + checkBoxType(id));
        }
}

function checkBoxDisable(id) {
	$('div[contain$='+id+']').removeClass("checked-option");

        switch (checkBoxType(id)) {

	case "relation_custom":
                $("#permissions").html("");
		$("#permissions").hide();

                break;

	case "permission":
                $('input[id="relation_custom_permission_ids_' + checkBoxId(id) + '"]').removeAttr('checked');
                $('label[for="relation_custom_permission_ids_' + checkBoxId(id) + '"]').parent().hide();

                break;
        default:
          alert("Unknown type of checkBox: " + checkBoxType(id));

        }
} 

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
social_stream-base-0.6.8 app/views/relation/customs/_jquery.erb
social_stream-base-0.6.6 app/views/relation/customs/_jquery.erb
social_stream-base-0.6.5 app/views/relation/customs/_jquery.erb