Finish full view repository

This commit is contained in:
aignatov-bio 2020-04-08 15:13:21 +02:00
parent 087f71a82f
commit e4b65aaf6f
5 changed files with 109 additions and 24 deletions

View file

@ -1,5 +1,5 @@
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
/* global DataTableHelpers PerfectScrollbar */ /* global DataTableHelpers PerfectScrollbar FilePreviewModal */
var MyModuleRepositories = (function() { var MyModuleRepositories = (function() {
var SIMPLE_TABLE; var SIMPLE_TABLE;
@ -70,6 +70,7 @@ var MyModuleRepositories = (function() {
FULL_VIEW_TABLE = $(tableContainer).DataTable({ FULL_VIEW_TABLE = $(tableContainer).DataTable({
dom: "R<'main-actions hidden'<'toolbar'><'filter-container'f>>t<'pagination-row hidden'<'pagination-info'li><'pagination-actions'p>>", dom: "R<'main-actions hidden'<'toolbar'><'filter-container'f>>t<'pagination-row hidden'<'pagination-info'li><'pagination-actions'p>>",
processing: true, processing: true,
stateSave: true,
serverSide: true, serverSide: true,
order: $(tableContainer).data('default-order'), order: $(tableContainer).data('default-order'),
pageLength: 25, pageLength: 25,
@ -119,6 +120,7 @@ var MyModuleRepositories = (function() {
drawCallback: function() { drawCallback: function() {
FULL_VIEW_TABLE.columns.adjust(); FULL_VIEW_TABLE.columns.adjust();
FilePreviewModal.init();
if (FULL_VIEW_TABLE_SCROLLBAR) { if (FULL_VIEW_TABLE_SCROLLBAR) {
FULL_VIEW_TABLE_SCROLLBAR.update(); FULL_VIEW_TABLE_SCROLLBAR.update();
} else { } else {
@ -130,6 +132,12 @@ var MyModuleRepositories = (function() {
} }
); );
} }
},
stateLoadCallback: function(settings, callback) {
var loadStateUrl = $(tableContainer).data('load-state-url');
$.post(loadStateUrl, function(json) {
callback(json.state);
});
} }
}); });
} }
@ -147,6 +155,11 @@ var MyModuleRepositories = (function() {
function initRepositoryFullView() { function initRepositoryFullView() {
$('#assigned-items-container').on('click', '.action-buttons .full-screen', function(e) { $('#assigned-items-container').on('click', '.action-buttons .full-screen', function(e) {
var fullViewModal = $('#my-module-repository-full-view-modal'); var fullViewModal = $('#my-module-repository-full-view-modal');
var repositoryNameObject = $(this).closest('.assigned-repository-caret')
.find('.assigned-repository-title')
.clone();
fullViewModal.find('.repository-name').html(repositoryNameObject);
fullViewModal.modal('show'); fullViewModal.modal('show');
$.get($(this).data('table-url'), (data) => { $.get($(this).data('table-url'), (data) => {
fullViewModal.find('.modal-body').html(data.html); fullViewModal.find('.modal-body').html(data.html);

View file

@ -1,6 +1,27 @@
// scss-lint:disable SelectorDepth SelectorFormat QualifyingElement // scss-lint:disable SelectorDepth SelectorFormat QualifyingElement
// scss-lint:disable NestingDepth ImportantRule // scss-lint:disable NestingDepth ImportantRule
@mixin my-module-repository-title {
@include font-h3;
line-height: 22px;
overflow: hidden;
padding-right: 55px;
position: relative;
text-overflow: ellipsis;
white-space: nowrap;
&::after {
color: $color-alto;
content: attr(data-rows-count);
display: inline-block;
line-height: 22px;
padding-left: 5px;
position: absolute;
right: 0;
width: 55px;
}
}
.my-module-inventories { .my-module-inventories {
.main-actions { .main-actions {
@ -89,10 +110,10 @@
padding: 0 18px; padding: 0 18px;
text-decoration: none; text-decoration: none;
&:hover, &.collapsed:hover,
&:active { &.collapsed:active {
text-decoration: none;
background: $color-concrete; background: $color-concrete;
text-decoration: none;
} }
&:not(.collapsed) .fa-caret-right { &:not(.collapsed) .fa-caret-right {
@ -105,23 +126,7 @@
} }
.assigned-repository-title { .assigned-repository-title {
@include font-h3; @include my-module-repository-title;
overflow: hidden;
padding-right: 55px;
position: relative;
text-overflow: ellipsis;
white-space: nowrap;
&::after {
color: $color-alto;
content: attr(data-rows-count);
display: inline-block;
line-height: 22px;
padding-left: 5px;
position: absolute;
right: 0;
width: 55px;
}
} }
.action-buttons { .action-buttons {
@ -177,22 +182,76 @@
flex-direction: column; flex-direction: column;
height: inherit; height: inherit;
.modal-header {
align-items: center;
display: flex;
height: 55px;
padding: 10px 24px;
.close {
flex-shrink: 0;
}
.header-container {
flex-grow: 1;
.assigned-repository-title {
@include my-module-repository-title;
@include font-h2;
}
.breadcrumbs {
@include font-small;
align-items: center;
color: $color-silver-chalice;
display: flex;
height: 20px;
width: 100%;
.my-module,
.project,
.experiment {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.slash {
flex-basis: 20px;
text-align: center;
}
}
}
}
.modal-body { .modal-body {
flex-grow: 1; flex-grow: 1;
padding: 0;
} }
.dataTables_wrapper { .dataTables_wrapper {
height: calc(100% - 30px); height: 100%;
position: absolute; position: absolute;
width: calc(100% - 30px); width: 100%;
.dataTables_scroll { .dataTables_scroll {
height: calc(100% - 104px); height: calc(100% - 146px);
padding: 0 24px;
.dataTables_scrollBody { .dataTables_scrollBody {
height: calc(100% - 44px); height: calc(100% - 44px);
} }
} }
.main-actions {
padding: 16px 24px 10px;
}
.pagination-row {
border-top: $border-default;
height: 84px;
padding: 0 24px;
}
} }
} }
} }

View file

@ -86,3 +86,4 @@
<%= stylesheet_link_tag 'datatables' %> <%= stylesheet_link_tag 'datatables' %>
<%= javascript_include_tag("my_modules/protocols") %> <%= javascript_include_tag("my_modules/protocols") %>
<%= javascript_pack_tag 'emoji_button' %>

View file

@ -2,6 +2,17 @@
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<div class="header-container">
<div class="breadcrumbs">
<span class="project" title="<%= @project.name %>"><%= @project.name %></span>
<span class="slash">/</span>
<span class="experiment" title="<%= @experiment.name %>"><%= @experiment.name %></span>
<span class="slash">/</span>
<span class="my-module" title="<%= @my_module.name %>"><%= @my_module.name %></span>
</div>
<div class="repository-name">
</div>
</div>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View file

@ -2,6 +2,7 @@
data-source="<%= my_module_my_module_repository_path(@my_module, @repository) %>" data-source="<%= my_module_my_module_repository_path(@my_module, @repository) %>"
data-default-order="<%= default_table_order_as_js_array %>" data-default-order="<%= default_table_order_as_js_array %>"
data-default-table-columns="<%= default_table_columns %>" data-default-table-columns="<%= default_table_columns %>"
data-load-state-url="<%= repository_load_table_state_path(@repository) %>"
> >
<thead> <thead>
<tr> <tr>