add search for backend index
This commit is contained in:
parent
dfe9065916
commit
4d2007e560
|
@ -1,7 +1,12 @@
|
|||
class Admin::PageContentsController < OrbitAdminController
|
||||
def index
|
||||
@pages = Page.where(:module=>"page_content").page(params[:page]).per(10)
|
||||
@table_fields = ["Name","Version","Updated At","Last Modified By"]
|
||||
@table_fields = [:page_id, :name,:version,:update_at,:last_modified]
|
||||
@filter_fields = {}
|
||||
@pages = Page.where(:module=>"page_content").order_by(sort)
|
||||
|
||||
@pages = search_data(@pages,[:name, :page_id]).page(params[:page]).per(10)
|
||||
|
||||
render :partial => "index" if request.xhr?
|
||||
end
|
||||
|
||||
def show
|
||||
|
@ -33,6 +38,6 @@ class Admin::PageContentsController < OrbitAdminController
|
|||
private
|
||||
|
||||
def update_params
|
||||
params.require(:page_context).permit!
|
||||
params.require(:page_context).permit!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<table class="table table-striped table-hover main-list">
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<% @table_fields.each do |f| %>
|
||||
<%= thead(f) %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @pages.each do |page| %>
|
||||
<tr>
|
||||
<td><%= page.page_id %></td>
|
||||
<td>
|
||||
<a href="/<%= I18n.locale %><%= page.url %>" target="_blank"><%= page.name %></a>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<% if can_edit_or_delete?(page) %>
|
||||
<li><a href="/admin/page_contents/new?page_id=<%= page.id.to_s %>"><%= t(:edit) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><a href="/admin/page_contents/<%= page.id.to_s %>/view" ><%= page.page_contexts.last.version rescue nil %></a></td>
|
||||
<td><%= format_value page.page_contexts.last.updated_at rescue nil %></td>
|
||||
<td><%= User.find(page.page_contexts.last.update_user_id).user_name rescue nil %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%=
|
||||
content_tag :div, class: "bottomnav clearfix" do
|
||||
content_tag :div, paginate(@pages), class: "pagination pagination-centered"
|
||||
end
|
||||
%>
|
|
@ -1,34 +1,5 @@
|
|||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<% @table_fields.each do |f| %>
|
||||
<%= thead(f) %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @pages.each do |page| %>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/<%= I18n.locale %><%= page.url %>" target="_blank"><%= page.name %></a>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<% if can_edit_or_delete?(page) %>
|
||||
<li><a href="/admin/page_contents/new?page_id=<%= page.id.to_s %>"><%= t(:edit) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><a href="/admin/page_contents/<%= page.id.to_s %>/view" ><%= page.page_contexts.last.version rescue nil %></a></td>
|
||||
<td><%= format_value page.page_contexts.last.updated_at rescue nil %></td>
|
||||
<td><%= User.find(page.page_contexts.last.update_user_id).user_name rescue nil %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%=
|
||||
content_tag :div, class: "bottomnav clearfix" do
|
||||
content_tag :div, paginate(@pages), class: "pagination pagination-centered"
|
||||
end
|
||||
%>
|
||||
<%= render_filter @filter_fields, "index_table" %>
|
||||
<span id="index_table">
|
||||
<%= render 'index'%>
|
||||
</span>
|
||||
|
||||
|
|
Loading…
Reference in New Issue