personal_writing/app/views/admin/writings/index.html.erb

62 lines
2.4 KiB
Plaintext
Raw Normal View History

<% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/filter" %>
<% end -%>
<!-- filter -->
<div id="filter">
<ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-category" data-toggle="collapse" data-parent="#filter" class="accordion-toggle"><%=t(:category)%></a>
</div>
</li>
</ul>
<div class="filter-group accordion-group">
<div class="accordion-body collapse" id="collapse-category">
<%= render :partial => "filter" %>
</div>
</div>
</div>
<!-- table -->
2020-03-19 09:13:01 +00:00
<table class="table main-list">
<thead>
<tr>
2020-03-19 14:35:41 +00:00
<th class="span1"><%= t(:category) %></th>
2020-03-19 09:13:01 +00:00
<th class="span1"><%= t('personal_writing.year') %></th>
2020-03-19 14:35:41 +00:00
<th class="span1"><%= t('personal_writing.month') %></th>
<th class="span3"><%= t('personal_writing.writing_title') %></th>
2020-03-19 09:13:01 +00:00
<th class="span1"><%= t('users.name') %></th>
</tr>
</thead>
2020-03-19 14:35:41 +00:00
<tbody id="tbody_writings" class="sort-holder">
2020-03-19 09:28:07 +00:00
<%= render 'writing' %>
2020-03-19 09:13:01 +00:00
</tbody>
</table>
<div class="bottomnav clearfix">
<div class="action pull-right">
<div class="dropup upload-button">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
<i class="icon-upload-alt icon-white"></i>上傳
<span class="caret"></span>
</button>
<div class="dropdown-menu upload-box">
2020-03-19 14:35:41 +00:00
<form action="/admin/writings/import_from_excel" method="post" enctype="multipart/form-data">
2020-03-19 09:13:01 +00:00
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
<input type="file" name="import_file" >
<button class="btn btn-primary" type="submit"><%= t(:submit) %></button>
2020-03-19 14:35:41 +00:00
<a class="" href="/admin/writings/download_excel_format.xlsx">Download excel format</a>
2020-03-19 09:13:01 +00:00
</form>
</div>
</div>
2020-03-19 14:35:41 +00:00
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_admin_writing_path, :class => 'btn btn-primary' %>
2020-03-19 09:13:01 +00:00
</div>
<div class="pagination pagination-centered">
2020-03-19 14:35:41 +00:00
<%= content_tag :div, paginate(@writings), class: "pagination pagination-centered" %>
2020-03-19 09:13:01 +00:00
</div>
</div>
<% if params[:error] == "1" %>
<script type="text/javascript">
alert("File cannot be imported. File has more than 500 entries. Please seperate the entries in different files.");
2020-03-19 14:35:41 +00:00
window.location.href = "<%= admin_writings_url %>"
2020-03-19 09:13:01 +00:00
</script>
<% end %>