Add filter to backend page.
This commit is contained in:
parent
7f14f7db5a
commit
22ab0909ad
|
@ -11,6 +11,9 @@ class Admin::PropertyHiresController < OrbitAdminController
|
||||||
.with_tags(filters("tag"))
|
.with_tags(filters("tag"))
|
||||||
|
|
||||||
@properties = search_data(@properties,[:title]).page(params[:page]).per(10)
|
@properties = search_data(@properties,[:title]).page(params[:page]).per(10)
|
||||||
|
if request.xhr?
|
||||||
|
render :partial => "index"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def fields_display_order
|
def fields_display_order
|
||||||
uid = params[:id].split("-").last
|
uid = params[:id].split("-").last
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @table_fields.each do |f| %>
|
||||||
|
<%= thead(f) %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @properties.each do |property| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<% if can_edit_or_delete?(property) %>
|
||||||
|
<a href="<%= admin_property_hire_path(property) %>"><%= property.title %></a>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li><a href="<%= edit_admin_property_hire_path(property, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
||||||
|
<li><a href="<%= custom_fields_admin_property_hire_path(property) %>"><%= t("property_hire.custom_fields") %></a></li>
|
||||||
|
<li><a href="<%= fields_display_order_admin_property_hire_path(property) %>"><%= t("property_hire.fields_display_order") %></a></li>
|
||||||
|
<li><a href="<%= admin_property_hire_path(property.id, :page => params[:page]) %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<%= property.title %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= property.category.title rescue nil %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= property.get_location_name %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% if property.can_be_hired %>
|
||||||
|
<span class="badge badge-success">Yes</span>
|
||||||
|
<% else %>
|
||||||
|
<span class="badge badge-important">No</span>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
|
<%= content_tag(:div, paginate(@properties), class: "pagination pagination-centered") %>
|
||||||
|
</div>
|
|
@ -1,46 +1,4 @@
|
||||||
<table class="table main-list">
|
<%= render_filter @filter_fields, "index_table" %>
|
||||||
<thead>
|
<span id="index_table">
|
||||||
<tr class="sort-header">
|
<%= render 'index'%>
|
||||||
<% @table_fields.each do |f| %>
|
</span>
|
||||||
<%= thead(f) %>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% @properties.each do |property| %>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<% if can_edit_or_delete?(property) %>
|
|
||||||
<a href="<%= admin_property_hire_path(property) %>"><%= property.title %></a>
|
|
||||||
<div class="quick-edit">
|
|
||||||
<ul class="nav nav-pills">
|
|
||||||
<li><a href="<%= edit_admin_property_hire_path(property, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
|
||||||
<li><a href="<%= custom_fields_admin_property_hire_path(property) %>"><%= t("property_hire.custom_fields") %></a></li>
|
|
||||||
<li><a href="<%= fields_display_order_admin_property_hire_path(property) %>"><%= t("property_hire.fields_display_order") %></a></li>
|
|
||||||
<li><a href="<%= admin_property_hire_path(property.id, :page => params[:page]) %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<%= property.title %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<%= property.category.title rescue nil %>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<%= property.get_location_name %>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<% if property.can_be_hired %>
|
|
||||||
<span class="badge badge-success">Yes</span>
|
|
||||||
<% else %>
|
|
||||||
<span class="badge badge-important">No</span>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<div class="bottomnav clearfix">
|
|
||||||
<%= content_tag(:div, paginate(@properties), class: "pagination pagination-centered") %>
|
|
||||||
</div>
|
|
Loading…
Reference in New Issue