<%- shixun = laboratory_shixun.shixun -%>

<td class="text-left">
  <%= link_to "/shixuns/#{shixun.identifier}", target: '_blank' do %>
    <%= shixun.name %>
    <span class="badge badge-pill badge-success homepage-badge" style="<%= laboratory_shixun.homepage? ? '' : 'display:none' %>">首页</span>
    <span class="badge badge-pill badge-info ownership-badge" style="<%= laboratory_shixun.ownership ? '' : 'display:none' %>">自建</span>
  <% end %>
</td>
<td><%= shixun.shixun_main_name %></td>
<td class="text-left">
  <% shixun.tag_repertoires.each do |tag| %>
    <span class="badge badge-secondary"><%= tag.name %></span>
  <% end %>
</td>
<td class="image-preview-container">
  <% imageExists = Util::FileManage.exists?(shixun) %>
  <%= image_tag(imageExists ? Util::FileManage.source_disk_file_url(shixun) : '', height: 40, class: "preview-image shixun-image-#{shixun.id}", data: { toggle: 'tooltip', title: '点击预览' }, style: imageExists ? '' : 'display:none') %>
  <% if laboratory_shixun.ownership? %>
    <%= javascript_void_link imageExists ? '重新上传' : '上传图片', class: 'action upload-shixun-image-action', data: { source_id: shixun.id, source_type: 'Shixun', toggle: 'modal', target: '.cooperative-upload-file-modal' } %>
  <% end %>
</td>
<td><%= link_to shixun.user&.real_name, "/users/#{shixun.user&.login}", target:'_blank' %></td>
<td><span class="<%= shixun_status_class(shixun) %>"><%= t("shixun.status.#{shixun.status}") %></span></td>
<td><%= shixun.excute_time %></td>
<td class="action-container">
  <% if laboratory_shixun.ownership? %>
    <%#= link_to('修改', cooperative_laboratory_subjects_path(laboratory_shixun)) %>
  <% end %>
  <%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? 'display:none' : '') %>
  <%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? '' : 'display:none') %>

  <% unless laboratory_shixun.ownership? %>
    <%= delete_link '删除', cooperative_laboratory_shixun_path(laboratory_shixun, element: ".laboratory-shixun-item-#{laboratory_shixun.id}") %>
  <% end %>
</td>