parent
20ce52c4a1
commit
fea6353350
@ -0,0 +1,22 @@
|
||||
class Admins::ShixunRecyclesController < Admins::BaseController
|
||||
|
||||
def index
|
||||
sort_by = params[:sort_by].presence || 'created_at'
|
||||
sort_direction = params[:sort_direction].presence || 'desc'
|
||||
search = params[:search].to_s.strip
|
||||
shixuns = Shixun.where(status: -1).where("name like ?", "%#{search}%").order("#{sort_by} #{sort_direction}")
|
||||
@shixuns = paginate shixuns.preload(:user, :laboratory)
|
||||
end
|
||||
|
||||
def destroy
|
||||
Shixun.find(params[:id]).destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def resume
|
||||
Shixun.find(params[:id]).update!(status: 0)
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('实训回收站') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container shixun-recycles-list-form">
|
||||
<%= form_tag(admins_shixun_recycles_path, method: :get, class: 'form-inline search-form',id:"shixun-recycles-search-form",remote:true) do %>
|
||||
<%= text_field_tag(:search, params[:search], class: 'form-control col-sm-2 ml-3', placeholder: '输入名称关键字搜索') %>
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with': '搜索中...') %>
|
||||
<%= link_to "清除",admins_shixun_recycles_path,class: "btn btn-default",id:"shixun-recycles-clear-search",'data-disable-with': '清除中...' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container shixun-recycles-list-container">
|
||||
<%= render partial: 'admins/shixun_recycles/shared/list', locals: { shixuns: @shixuns } %>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
$(".shixun-recycles-list-container").html("<%= j render partial: "admins/shixun_recycles/shared/list",locals: {shixuns: @shixuns} %>")
|
@ -0,0 +1,31 @@
|
||||
<table class="table table-hover text-center shixuns-list-table">
|
||||
<thead class="thead-light">
|
||||
<th width="8%">ID</th>
|
||||
<th width="32%" class="text-left">实训名称</th>
|
||||
<th width="20%">子站源</th>
|
||||
<th width="10%">创建者</th>
|
||||
<th width="20%"><%= sort_tag('创建于', name: 'created_at', path: admins_shixun_recycles_path) %></th>
|
||||
<th width="10%">操作</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if shixuns.present? %>
|
||||
<% shixuns.each do |shixun| %>
|
||||
<tr id="shixun_recycle_item_<%= shixun.id %>">
|
||||
<td><%= shixun.identifier %></td>
|
||||
<td class="text-left"><span><%= link_to overflow_hidden_span(shixun.name), "/shixuns/#{shixun.identifier}", :target => "_blank", :title => shixun.name %></span></td>
|
||||
<td><%= shixun.laboratory&.school&.name %></td>
|
||||
<td><%= link_to shixun.user.try(:real_name),"/users/#{shixun.user.try(:login)}",target:'_blank' %></td>
|
||||
<td><%= format_time shixun.created_at %></td>
|
||||
<td class="operate">
|
||||
<%= delete_link '删除', admins_shixun_recycle_path(shixun, element: ".shixun-recycle-item-#{shixun.id}"), class: 'delete-shixun-recyle-action' %>
|
||||
<%= link_to('恢复', resume_admins_shixun_recycle_path(shixun), :method => :post, :remote => true, :data => { confirm: "您确定要恢复吗?" } ) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: shixuns } %>
|
Loading…
Reference in new issue