dragPage.ejs 7.6 KB
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<meta content="" name="keywords">
<meta content="" name="description">
<meta content="" name="apple-mobile-web-app-title">
<meta content="no-cache" http-equiv="Cache-Control">
<meta content="telephone=no" name="format-detection">
<meta content="email=no" name="format-detection">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<title>&mdash;&mdash; dragPage</title>  
<link href="/imgs/favicon.ico" rel="shortcut icon"> 
<script src="/js/libs/jquery.js"></script>
<% include ../chatUtils.ejs %>
<script src="/js/app/formeditor.js"></script> 
<style>  
	.parent {
	  background-color: rgba(255, 255, 255, 0.2);
	  margin: 50px 0;
	  padding: 20px;
	}

	input {
	  border: none;
	  outline: none;
	  background-color: #ecf0f1;
	  padding: 10px;
	  color: #942A57;
	  border: 0;
	  margin: 5px 0;
	  display: block;
	  width: 100%;
	} 

	/* dragula-specific example page styles */
	.wrapper {
	  display: table;
	}
	.container {
	  display: table-cell;
	  background-color: rgba(255, 255, 255, 0.2);
	  width: 50%;
	}
	.container:nth-child(odd) {
	  background-color: rgba(0, 0, 0, 0.2);
	}
	/*
	 * note that styling gu-mirror directly is a bad practice because it's too generic.
	 * you're better off giving the draggable elements a unique class and styling that directly!
	 */
	.container > div,
	.gu-mirror {
	  margin: 10px;
	  padding: 10px;
	  background-color: rgba(0, 0, 0, 0.2);
	  transition: opacity 0.4s ease-in-out;
	}
	.container > div {
	  cursor: move;
	  cursor: grab;
	  cursor: -moz-grab;
	  cursor: -webkit-grab;
	}
	.gu-mirror {
	  cursor: grabbing;
	  cursor: -moz-grabbing;
	  cursor: -webkit-grabbing;
	}
	.container .ex-moved {
	  background-color: #e74c3c;
	}
	.container.ex-over {
	  background-color: rgba(255, 255, 255, 0.3);
	}
	#left-lovehandles > div,
	#right-lovehandles > div {
	  cursor: initial;
	}
	.handle {
	  padding: 0 5px;
	  margin-right: 5px;
	  background-color: rgba(0, 0, 0, 0.4);
	  cursor: move;
	}
	.image-thing {
	  margin: 20px 0;
	  display: block;
	  text-align: center;
	}
	


</style>
</head>
<body class="">
	<div class="form-tools-wrap">
		<div class="form-tools form-tools-row"  id='left-defaults' >
			<div class="fields-wrap">
				<i class="tool-icon singleline"></i>
				<div class="tool-title">单行</div>
				<div class="field-target"></div>
			</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon email"></i>
	      		<div class="tool-title">电子邮件</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon number"></i>
	      		<div class="tool-title">数字</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon currency"></i>
	      		<div class="tool-title">货币</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon dropdown"></i>
	      		<div class="tool-title">下拉</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon date"></i>
	      		<div class="tool-title">日期</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon image"></i>
	      		<div class="tool-title">图片</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon dcheckbox"></i>
	      		<div class="tool-title">复选框</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon country"></i>
	      		<div class="tool-title">国家</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon gender"></i>
	      		<div class="tool-title">性别</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon lookup"></i>
	      		<div class="tool-title">查找</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon multiline"></i>
	      		<div class="tool-title">多行</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
				<i class="tool-icon url"></i>
				<div class="tool-title">Url</div>
				<div class="field-target"></div>
			</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon decimal"></i>
	      		<div class="tool-title">小数</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon radiobutton"></i>
	      		<div class="tool-title">单选按钮</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon datetime"></i>
	      		<div class="tool-title">日期-时间</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon upload"></i>
	      		<div class="tool-title">文件上传</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon addnotes"></i>
	      		<div class="tool-title">添加备注</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon bloodgroup"></i>
	      		<div class="tool-title">血型</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon phone"></i>
	      		<div class="tool-title">电话</div>
				<div class="field-target"></div>
	      	</div>
	      	<div class="fields-wrap">
	      		<i class="tool-icon formula"></i>
	      		<div class="tool-title">公式</div>
				<div class="field-target"></div>
	      	</div> 
		</div>
		<div class="add-section-btn">
      		<a class="add-form-section">添加表单单元</a>
      		<a class="add-form-table-section">添加表格单元</a>
      	</div> 
	</div>
 	<div class='parent'> 
	    <div class='wrapper'> 
	      <div id='right-defaults' class='container'>
	        <div class="left">There's also the possibility of moving elements around in the same container, changing their position</div>
	        <div class="right">This is the default use case. You only need to specify the containers you want to use</div>
	        <div>More interactive use cases lie ahead</div>
	        <div>Moving <code>&lt;input/&gt;</code> elements works just fine. You can still focus them, too. <input placeholder='See?' /></div>
	        <div>Make sure to check out the <a href='#'>documentation on GitHub!</a></div>
	      </div>  
	    </div> 
  	</div> 
<script>
	// console.log($('#left-defaults')[0]);
	// console.log($('#right-defaults')[0]);
	// dragula([$('#left-defaults')[0], $('#right-defaults')[0]],{
	// 	copy: function (el, source) {		//console.log(source === $('#left-defaults')[0]);
	// 	    return source === $('#left-defaults')[0];
	// 	},
	// 	accepts: function (el, target) {	//console.log(target !== $('#left-defaults')[0]);
	// 	    return target !== $('#left-defaults')[0];
	// 	}
	// }).on('drag', function (el) {
	//     el.className = el.className.replace('ex-moved', '');
	// }).on('drop', function (el) {
	//     el.className += ' ex-moved';
	// }).on('over', function (el, container) {
	//     container.className += ' ex-over';
	// }).on('out', function (el, container) {
	//     container.className = container.className.replace('ex-over', '');
	// });   

	var formEditor= new HRFormEditor({
		toolsWrapId:'#left-defaults',
		targetWrapId:'#right-defaults',
	});
	formEditor.init();
</script> 
</body>
</html>