35 lines
1.2 KiB
Plaintext
35 lines
1.2 KiB
Plaintext
|
<div id="data-table" class="ut-table">
|
||
|
<table class="table main-list">
|
||
|
<thead>
|
||
|
<tr class="sort-header">
|
||
|
<% @table_fields.each do |field| %>
|
||
|
<%
|
||
|
field_text = field.to_s.include?('.') ? t(field.to_s) : field.to_s
|
||
|
sort = field.to_s.split('.')[-1]
|
||
|
active = params[:sort].eql? sort
|
||
|
order = active ? (["asc", "desc"]-[params[:order]]).first : "asc"
|
||
|
arrow = (order.eql? "desc") ? "<b class='icons-arrow-up-3'></b>" : "<b class='icons-arrow-down-4'></b>"
|
||
|
klass = sort.eql?(:title) ? "span5" : "span2"
|
||
|
th_data = "<a href='?sort=#{sort}&order=#{order}'>#{field_text} #{active ? arrow : ""}</a>"
|
||
|
%>
|
||
|
<th class='<%= klass %> <%= active ? "active" : "" %>'><%= th_data.html_safe %></th>
|
||
|
<% end %>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody id="sortable">
|
||
|
<% @announcements.each do |annc| %>
|
||
|
<tr data-id="<%= annc.id %>">
|
||
|
<td>
|
||
|
<%= number_field_tag nil,annc.sort_number,class: 'sort_number',step: 1 %>
|
||
|
</td>
|
||
|
<td>
|
||
|
<%= annc.title %>
|
||
|
</td>
|
||
|
<td>
|
||
|
<%= format_value annc.postdate %>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<% end %>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|