
{%load static%}

<form id = "for_saving" class = "hidden"  action = "/group/{{group.id}}/save_config" method = "post">
	{% csrf_token %}
</form>

<!--工具栏事件。比较适合在-->
<script>

	function save_config() {

		var sep_token = "__FITTERLOG__SEP__"
		config = {
			hide_columns: get_hide_headers().join(sep_token) , 
			hide_ids    : Array.from(deleted_ids).join(sep_token) , 
			intro       : document.getElementById("group_intro").value , 
			show_order  : get_show_headers().join(sep_token) , 
		}

		var for_saving = document.getElementById("for_saving");

		for (var x in config) {
			var opt = document.createElement("textarea");
			opt.name = x;

			opt.value = config[x];
			for_saving.appendChild(opt);
		}

		for_saving.submit();
	}

	
	function get_toolbar_event_func(table){
		return function(obj) {
			var checkStatus = table.checkStatus(obj.config.id)
			switch(obj.event){
				case "go-back":
					window.location.href = "/project/{{group.project.id}}"
				break
				case "save":
					save_config()
				break
				case "delete":
					hide_checked_rows()
				break

			}
		}
	}

</script>
