scinote-web/app/views/reports/index.html.erb

88 lines
3.8 KiB
Text
Raw Normal View History

2016-07-21 19:11:15 +08:00
<% provide(:head_title, raw(t("projects.reports.index.head_title", project: @project.name))) %>
2016-02-12 23:52:43 +08:00
<%= render partial: "shared/sidebar" %>
<%= render partial: "shared/secondary_navigation" %>
2016-07-21 19:11:15 +08:00
<div id="content"
data-reports-click-new-report-step-text="<%=t 'tutorial.reports_index_click_new_report_html' %>">
2016-02-12 23:52:43 +08:00
<div>
<% if can_create_new_report(@project) %>
<%= link_to new_project_reports_path(@project), class: 'btn btn-primary', id: 'new-report-btn', 'data-no-turbolink' => true do %>
2016-02-12 23:52:43 +08:00
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
<span class="hidden-xs"><%=t "projects.reports.index.new" %></span>
<% end %>
<%= link_to "", remote: true, class: "btn btn-default", id: "edit-report-btn" do %>
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
<span class="hidden-xs"><%=t "projects.reports.index.edit" %></span>
<% end %>
<% if can_delete_reports(@project) %>
<%= link_to "", remote: true, class: "btn btn-default", id: "delete-reports-btn" do %>
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
<span class="hidden-xs"><%=t "projects.reports.index.delete" %></span>
<% end %>
<% end %>
<% end %>
</div>
<table class="table report-table" data-project-id="<%= @project.id %>">
<thead>
<tr>
<th><input type="checkbox" class="check-all-reports"></th>
<th><%=t "projects.reports.index.thead_name" %></th>
<th><%=t "projects.reports.index.thead_created_by" %></th>
<th><%=t "projects.reports.index.thead_last_modified_by" %></th>
<th><%=t "projects.reports.index.thead_created_at" %></th>
<th><%=t "projects.reports.index.thead_updated_at" %></th>
<th></th>
</tr>
</thead>
<tbody>
<% if @project.reports.count > 0 %>
<% @project.reports.each do |report| %>
<tr
class="report-row"
data-id="<%= report.id %>"
data-edit-link="<%= edit_project_report_path(@project, report) %>"
>
<th><input type="checkbox" class="check-report"></th>
<td><%= report.name %></td>
<td><%= report.user.full_name %></td>
<td><%= report.last_modified_by ? report.last_modified_by.full_name : report.user.full_name %></td>
<td><%=l report.created_at, format: :full %></td>
<td><%=l report.updated_at, format: :full %></td>
</tr>
<% end %>
<% else %>
<tr><td colspan="5"><%=t "projects.reports.index.no_reports" %></td></tr>
<% end %>
</tbody>
</table>
</div>
<!-- Save report modal -->
<div class="modal" id="delete-reports-modal" tabindex="-1" role="dialog" aria-labelledby="delete-reports-modal-label">
<%= bootstrap_form_tag url: destroy_project_reports_path, method: :post, id: "delete-reports-form" do |f| %>
<input type="hidden" name="report_ids" id="report-ids">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="delete-reports-modal-label"><%=t "projects.reports.index.modal_delete.head_title" %></h4>
</div>
<div class="modal-body">
<%=t "projects.reports.index.modal_delete.message" %>
</div>
<div class="modal-footer">
2016-08-02 22:30:07 +08:00
<%= f.button t("projects.reports.index.modal_delete.delete"), class: "btn btn-primary", id: "confirm-delete-reports-btn", name: nil %>
2016-02-12 23:52:43 +08:00
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
</div>
</div>
</div>
<% end %>
</div>
<%= javascript_include_tag("reports/index") %>