如何用content_tag包装数据均衡器

时间:2018-07-31 11:29:50

标签: ruby zurb-foundation ruby-on-rails-4.2

我正在尝试将div-equalizer-watch包装在content_tag中,但是div-equalizer-watch正在打印​​( {:“ data-equalizer-watch” =>“”,:class =>“ list_users”} )。有人可以指导我我做错了什么地方

下面是我正在尝试使用content_tag和capture tag在rails helper中编写的HTML

<a href="/ussers/profile" target="_blank">
  <div class="list_users" data-equalizer-watch="">
    <h2>Cost</h2>
  </div>
</a>

content_tag :a, href: "/ussers/profile", target: '_blank' do
  capture do
    concat (content_tag :div, :"data-equalizer-watch" => "",:class => 'list_users')
    concat (content_tag :h2, 'Cost')
  end
end

1 个答案:

答案 0 :(得分:0)

最终找到了解决方案

<!DOCTYPE html>
<html class="html">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script>
	<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/themes/redmond/jquery-ui.css">
	<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"> </script>
	<script>
		$(function() {
			$("#datepicker").datepicker(
			{
				dateFormat:'dd-mm-yy',
				changeMonth: true,
				changeYear: true,
			});	
		});
	</script>
	<style>
		.date-picker{
			width: 250px;
			height: 30px;
			font-size: 18px;
			padding-left: 7px;
			margin-top: 10px;
			margin-left: 145px;
			border: 1px solid grey;
			border-radius: 5px;
		}
	</style>
</head>
<body class="body">
		<div class="date-picker-container">
			<input class="date-picker" id="datepicker" placeholder="Date Of Birth" readonly='true'>
		</div>
	</form>
</body>
</html>

从此link

获取参考