Sha256: bc0af65d1a4ad23ec8def492a4c3bfd13bb46b6d93402c7035ec5bcaf3ef1cc5

Contents?: true

Size: 1.85 KB

Versions: 3

Compression:

Stored size: 1.85 KB

Contents

<%= render_crud do %>
	<div>
		<%= render "/crud/links" %>
	</div>
	<div class="dataTables_wrapper form-inline">
		<table class="table table-striped table-bordered table-hover dataTables-example dataTable">
			<thead>
				<tr>
					<%@crud_helper.index_fields.each do |att|  %>
					<% if !att[:visible_if].nil?%>
						<% if ((att[:visible_if].class == Proc && !att[:visible_if].call(att)) || (att[:visible_if].class != Proc && !att[:visible_if])) %>
							<% next %>
						<% end %>
					<% end %>
					<th>
						<% if att[:sort_field].present? %>
							<%= sort_link @q, att[:sort_field], att[:label], {},data: {push: 'partial', target: "#form"}%>
						<% else %>
							<%= sort_link @q, att[:attribute], att[:label], {},data: {push: 'partial', target: "#form"}%>
						<% end %>
					</th>
					<%end%>
					<%if @crud_helper.view_action || @crud_helper.edit_action || @crud_helper.destroy_action || @crud_helper.actions.present?%>
						<td>Opções</td>
					<% end %>
				</tr>
			</thead>
			<tbody id="records-body">
				<% @records.each do |record| %>
					<%= render '/crud/record', record: record %>
				<% end %>
			</tbody>
		</table>
		<%= paginate @records, target: '#form', theme: 'templus'%>
	</div>
<% end %>
<script type="text/javascript">
	var theadtxt = [];
	var headers = document.querySelectorAll("thead");
	var tablebody = document.querySelectorAll("tbody");
	for (var x = 0; x < headers.length; x++) {
		theadtxt[x]=[];
		for (var j = 0, headrow; headrow = headers[x].rows[0].cells[j]; j++) {
		  var current = headrow;
		  theadtxt[x].push(current.innerHTML);
		}
	} 
	for (var v = 0, tbody; tbody = tablebody[v]; v++) {
		for (var x = 0, row; row = tbody.rows[x]; x++) {
		  for (var j = 0, col; col = row.cells[j]; j++) {
            col.insertAdjacentHTML('afterbegin', '<div class="col-xs-3 no-padding">' + theadtxt[v][j] + '</div>');
		  } 
		}
	}
</script>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
templus_models-1.6.9 app/views/crud/_records.html.erb
templus_models-1.6.8 app/views/crud/_records.html.erb
templus_models-1.6.7 app/views/crud/_records.html.erb