2016-02-12 23:52:43 +08:00
|
|
|
<%= render partial: "samples/import_samples_modal" %>
|
|
|
|
<%= render partial: "samples/delete_samples_modal" %>
|
2016-12-09 18:58:10 +08:00
|
|
|
<%= render partial: "samples/delete_custom_field_modal" %>
|
2017-05-29 20:42:55 +08:00
|
|
|
<%= render partial: 'samples/export_samples_modal' %>
|
2016-12-12 22:52:25 +08:00
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
<!-- Modal for parsing sample sheets should be empty at first -->
|
|
|
|
<div class="modal fade" id="modal-parse-samples" tabindex="-1" role="dialog" aria-labelledby=="modal-parse-samples-label"></div>
|
|
|
|
|
|
|
|
<div id="alert-container"></div>
|
|
|
|
|
2017-12-07 20:35:15 +08:00
|
|
|
<% if can_read_team?(@team) %>
|
2017-05-29 20:47:05 +08:00
|
|
|
<%= bootstrap_form_tag(url: export_samples_team_path(@team),
|
2017-05-29 20:42:55 +08:00
|
|
|
html: { id: 'form-export', class: 'hidden' }) do |f| %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= form_for :sample, url: form_submit_link, html: {id: "form-samples"} do |f|%>
|
|
|
|
|
|
|
|
<div id="samples-toolbar"
|
|
|
|
<% if @my_module %>
|
|
|
|
data-module-id="<%= @my_module.id %>"
|
|
|
|
<% end %>>
|
|
|
|
|
2018-02-16 01:46:29 +08:00
|
|
|
<% if can_create_samples?(@team) %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<button type="button" class="btn btn-default editAdd" id="addSample" onclick="onClickAddSample()">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-plus"></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
<span class="hidden-xs"><%= t("samples.add_new_sample") %></span>
|
|
|
|
</button>
|
2016-07-21 19:11:15 +08:00
|
|
|
<button type="button" class="btn btn-default" id="importSamplesButton" data-toggle="modal" data-target="#modal-import-samples">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-cloud-upload-alt"></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
<span class="hidden-xs"><%= t("samples.import") %></span>
|
|
|
|
</button>
|
|
|
|
<% end %>
|
|
|
|
|
2017-12-07 20:35:15 +08:00
|
|
|
<% if can_read_team?(@team) %>
|
2018-01-15 20:54:08 +08:00
|
|
|
<a href="#" class="btn btn-default" id="exportSamplesButton" data-turbolinks="false">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-cloud-download-alt"></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
<span class="hidden-xs"><%= t("samples.export") %></span>
|
|
|
|
</a>
|
2017-06-06 18:46:56 +08:00
|
|
|
|
|
|
|
<div id="show-assigned-buttons" class="btn-group sample-assign-group" data-toggle="buttons">
|
|
|
|
<button type="button" class="active btn btn-primary" id="assignedSamples"><%= t("samples.view_assigned_samples") %></button>
|
|
|
|
<button type="button" class="btn btn-default" id="allSamples"><%= t("samples.view_all_samples") %></button>
|
|
|
|
</div>
|
2016-02-12 23:52:43 +08:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<div id="datatables-buttons" style="display: inline;">
|
2016-11-26 00:29:30 +08:00
|
|
|
<div id="samples-columns-dropdown" class="dropdown">
|
|
|
|
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
|
|
|
|
<%= t('samples.columns') %>
|
|
|
|
<span class="caret"></span>
|
|
|
|
</button>
|
|
|
|
<ul class="dropdown-menu dropdown-menu-right smart-dropdown" id="samples-columns-list">
|
2018-02-16 01:46:29 +08:00
|
|
|
<% if can_create_sample_columns?(@team) %>
|
2016-12-02 23:39:47 +08:00
|
|
|
<li class="add-new-column-form">
|
2017-01-25 19:01:23 +08:00
|
|
|
<div id="new-column-form" class="form-group" data-action="<%= team_custom_fields_path(@team) %>">
|
2016-12-02 23:39:47 +08:00
|
|
|
<div class="input-group">
|
|
|
|
<input class="form-control" id="new-column-name" placeholder="<%= t("samples.column_new_text") %>">
|
|
|
|
<span class="input-group-btn">
|
|
|
|
<a id="add-new-column-button" class="btn btn-primary">
|
|
|
|
<%= t("samples.column_create") %>
|
|
|
|
</a>
|
|
|
|
</span>
|
|
|
|
</div>
|
2016-11-25 16:03:47 +08:00
|
|
|
</div>
|
2016-12-02 23:39:47 +08:00
|
|
|
</li>
|
|
|
|
<% end %>
|
2016-11-26 00:29:30 +08:00
|
|
|
</ul>
|
|
|
|
</div>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
|
|
|
|
2018-02-16 01:46:29 +08:00
|
|
|
<% if can_manage_sample_types_and_groups?(@team) %>
|
|
|
|
<div class="dropdown pull-right" style="display: inline;">
|
|
|
|
<%= link_to(t('samples.types_and_groups'),
|
|
|
|
team_sample_types_path(@team,
|
|
|
|
project_id: (@project.id if @project),
|
|
|
|
my_module_id: (@my_module.id if @my_module),
|
|
|
|
experiment_id: (@experiment.id if @experiment)),
|
|
|
|
class: 'btn btn-default' ) %>
|
|
|
|
</div>
|
2016-12-02 16:33:09 +08:00
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="btn-group" id="saveCancel" data-toggle="buttons" style="display:none">
|
|
|
|
<button type="button" class="btn btn-primary" id="saveSample" onclick="onClickSave()">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-save"></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
<%= t("samples.save_sample") %>
|
|
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-default" id="cancelSave" onclick="onClickCancel()">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-times visible-xs-inline"></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
<span class="hidden-xs"><%= t("samples.cancel_save") %></span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
2018-02-16 01:46:29 +08:00
|
|
|
<!-- These buttons are appended to table in javascript, after table initialization -->
|
2016-02-12 23:52:43 +08:00
|
|
|
<div class="toolbarButtons" style="display:none">
|
|
|
|
<button type="button" class="btn btn-default editAdd" id="editSample" onclick="onClickEdit()" disabled>
|
2018-05-22 22:55:58 +08:00
|
|
|
<span class="fas fa-pencil-alt"></span>
|
2016-09-14 17:08:40 +08:00
|
|
|
<span class="hidden-xs-custom"><%= t("samples.edit_sample") %></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
</button>
|
|
|
|
|
2018-02-16 01:46:29 +08:00
|
|
|
<!-- Don't check if user can manage the selected samples, because the ones that he can't, will be left untouched -->
|
|
|
|
<button type="button" class="btn btn-default"
|
|
|
|
id="deleteSamplesButton" data-target="#deleteSamples" data-toggle="modal" disabled>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-trash-alt"></span>
|
2018-02-16 01:46:29 +08:00
|
|
|
<span class="hidden-xs-custom"><%= t'samples.delete_samples' %></span>
|
|
|
|
<%= submit_tag I18n.t('samples.delete_samples'), :class => "hidden
|
|
|
|
delete_samples_submit" %>
|
|
|
|
</button>
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-03-26 02:10:32 +08:00
|
|
|
<% if module_page? && can_assign_sample_to_module?(@my_module) %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<button type="button" class="btn btn-default"
|
|
|
|
id="assignSamples" onclick="$(this).next().click();" disabled>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-check-circle"></span>
|
2016-09-14 17:08:40 +08:00
|
|
|
<span class="hidden-xs-custom"><%= t'samples.assign_samples_to_module' %></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
</button>
|
|
|
|
<%= submit_tag MyModulesController::ASSIGN_SAMPLES, :class => "hidden" %>
|
|
|
|
<button type="button" class="btn btn-default"
|
|
|
|
id="unassignSamples" onclick="$(this).next().click();" disabled>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-ban"></span>
|
2016-09-14 17:08:40 +08:00
|
|
|
<span class="hidden-xs-custom"><%= t'samples.unassign_samples_to_module' %></span>
|
2016-02-12 23:52:43 +08:00
|
|
|
</button>
|
|
|
|
<%= submit_tag MyModulesController::UNASSIGN_SAMPLES, :class => "hidden" %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="samples-table">
|
|
|
|
<table id="samples" class="table"
|
2017-04-06 19:03:13 +08:00
|
|
|
data-current-uri="<%= request.original_url %>"
|
2017-01-25 19:01:23 +08:00
|
|
|
data-team-id="<%= @project.team.id %>"
|
2016-12-05 18:34:36 +08:00
|
|
|
data-user-id="<%= @current_user.id %>"
|
2016-02-12 23:52:43 +08:00
|
|
|
data-source="<%= @samples_index_link %>"
|
|
|
|
data-num-columns="<%= num_of_columns %>"
|
2017-01-25 19:01:23 +08:00
|
|
|
data-new-sample="<%= new_team_sample_path(team_id: @team) %>"
|
|
|
|
data-create-sample="<%= team_samples_path(team_id: @team) %>">
|
2016-02-12 23:52:43 +08:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th id="checkbox"><input name="select_all" value="1" type="checkbox"></th>
|
|
|
|
<th id="assigned"><%= t("samples.table.assigned") %></th>
|
|
|
|
<th id="sample-name"><%= t("samples.table.sample_name") %></th>
|
|
|
|
<th id="sample-type"><%= t("samples.table.sample_type") %></th>
|
|
|
|
<th id="sample-group"><%= t("samples.table.sample_group") %></th>
|
|
|
|
<th id="added-on"><%= t("samples.table.added_on") %></th>
|
|
|
|
<th id="added-by"><%= t("samples.table.added_by") %></th>
|
|
|
|
<% all_custom_fields.each do |cf| %>
|
2016-11-29 18:43:18 +08:00
|
|
|
<th class="custom-field"
|
|
|
|
id="<%= cf.id %>"
|
2018-02-16 01:46:29 +08:00
|
|
|
<%= 'data-editable' if can_manage_sample_column?(cf) %>
|
|
|
|
<%= 'data-deletable' if can_manage_sample_column?(cf) %>
|
2017-03-18 00:52:15 +08:00
|
|
|
<%= "data-edit-url='#{edit_team_custom_field_path(@team, cf)}'" %>
|
|
|
|
<%= "data-update-url='#{team_custom_field_path(@team, cf)}'" %>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= "data-destroy-html-url='#{team_custom_field_destroy_html_path(@team, cf)}'" %>
|
2016-11-29 18:43:18 +08:00
|
|
|
>
|
2016-12-14 20:36:10 +08:00
|
|
|
<%= display_tooltip(cf.name) %>
|
2016-11-29 18:43:18 +08:00
|
|
|
</th>
|
2016-02-12 23:52:43 +08:00
|
|
|
<% end %>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody></tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<%= stylesheet_link_tag 'datatables' %>
|
|
|
|
<%= javascript_include_tag("samples/samples") %>
|
|
|
|
<%= javascript_include_tag("samples/sample_datatable") %>
|