mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 07:26:15 +08:00
Merge branch 'develop' into features/dashboard
This commit is contained in:
commit
f11b051715
|
@ -443,9 +443,13 @@ var RepositoryDatatable = (function(global) {
|
|||
sWidth: '1%',
|
||||
render: function(data, type, row) {
|
||||
let content = data;
|
||||
let icon = '<i class="repository-row-edit-icon fas fa-pencil-alt"></i>';
|
||||
let icon;
|
||||
if (!row.recordEditable) {
|
||||
icon = `<i class="repository-row-lock-icon fas fa-lock" title="${I18n.t('repositories.table.locked_item')}"></i>`;
|
||||
} else if (EDITABLE) {
|
||||
icon = '<i class="repository-row-edit-icon fas fa-pencil-alt"></i>';
|
||||
} else {
|
||||
icon = '';
|
||||
}
|
||||
content = icon + content;
|
||||
return content;
|
||||
|
|
|
@ -4,28 +4,29 @@
|
|||
*/
|
||||
|
||||
/* global I18n _ */
|
||||
(function(global) {
|
||||
var STORAGE_TREE_KEY = 'scinote-sidebar-tree-collapsed-ids';
|
||||
(function() {
|
||||
const SIDEBAR_ID = '#slide-panel';
|
||||
const STORAGE_TREE_KEY = 'scinote-sidebar-tree-collapsed-ids';
|
||||
|
||||
/**
|
||||
* Get all collapsed sidebar elements.
|
||||
* @return An array of sidebar element IDs.
|
||||
*/
|
||||
global.sessionGetCollapsedSidebarElements = function() {
|
||||
function sessionGetCollapsedSidebarElements() {
|
||||
var val = sessionStorage.getItem(STORAGE_TREE_KEY);
|
||||
if (val === null) {
|
||||
val = '[]';
|
||||
sessionStorage.setItem(STORAGE_TREE_KEY, val);
|
||||
}
|
||||
return JSON.parse(val);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Collapse a specified element in the sidebar.
|
||||
* @param id - The collapsed element's ID.
|
||||
*/
|
||||
global.sessionCollapseSidebarElement = function(project, id) {
|
||||
var ids = global.sessionGetCollapsedSidebarElements();
|
||||
function sessionCollapseSidebarElement(project, id) {
|
||||
var ids = sessionGetCollapsedSidebarElements();
|
||||
var item = _.findWhere(ids, { prid: project });
|
||||
var collapsed = { prid: project, ids: [] };
|
||||
var storedProjects = _.pluck(ids, 'prid');
|
||||
|
@ -39,34 +40,14 @@
|
|||
ids.push(collapsed);
|
||||
}
|
||||
sessionStorage.setItem(STORAGE_TREE_KEY, JSON.stringify(ids));
|
||||
};
|
||||
|
||||
/**
|
||||
* Expand a specified element in the sidebar.
|
||||
* @param id - The expanded element's ID.
|
||||
*/
|
||||
global.sessionExpandSidebarElement = function(project, id, elements) {
|
||||
var ids = global.sessionGetCollapsedSidebarElements();
|
||||
var item = _.findWhere(ids, { prid: project});
|
||||
var index = -1;
|
||||
|
||||
if (item) {
|
||||
index = _.indexOf(item.ids, id);
|
||||
global.recalculateElementsPositions(ids, item, elements);
|
||||
}
|
||||
|
||||
if (index !== -1) {
|
||||
item.ids.splice(index, 1);
|
||||
sessionStorage.setItem(STORAGE_TREE_KEY, JSON.stringify(ids));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalculate the position of the elements after an experiment
|
||||
* is added or archived.
|
||||
*/
|
||||
global.recalculateElementsPositions = function(ids, item, elements) {
|
||||
var diff;
|
||||
function recalculateElementsPositions(ids, item, elements) {
|
||||
let diff;
|
||||
|
||||
if (item.eleNum > elements) {
|
||||
diff = item.eleNum - elements;
|
||||
|
@ -86,10 +67,30 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand a specified element in the sidebar.
|
||||
* @param id - The expanded element's ID.
|
||||
*/
|
||||
function sessionExpandSidebarElement(project, id, elements) {
|
||||
var ids = sessionGetCollapsedSidebarElements();
|
||||
var item = _.findWhere(ids, { prid: project });
|
||||
var index = -1;
|
||||
|
||||
if (item) {
|
||||
index = _.indexOf(item.ids, id);
|
||||
recalculateElementsPositions(ids, item, elements);
|
||||
}
|
||||
|
||||
if (index !== -1) {
|
||||
item.ids.splice(index, 1);
|
||||
sessionStorage.setItem(STORAGE_TREE_KEY, JSON.stringify(ids));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the sidebar collapsing & expanding functionality.
|
||||
*/
|
||||
global.setupSidebarTree = function() {
|
||||
function setupSidebarTree() {
|
||||
$('.tree a').click(function() {
|
||||
var url = new URL($(this).attr('href'));
|
||||
url.searchParams.set('scroll', $('.tree').scrollTop());
|
||||
|
@ -122,7 +123,7 @@
|
|||
|
||||
// Make active current project/experiment/task
|
||||
function activateCurrent() {
|
||||
var sidebar = $('#slide-panel');
|
||||
var sidebar = $(SIDEBAR_ID);
|
||||
var projectId = sidebar.data('current-project');
|
||||
var experimentId = sidebar.data('current-experiment');
|
||||
var taskId = sidebar.data('current-task');
|
||||
|
@ -172,28 +173,24 @@
|
|||
);
|
||||
|
||||
// Get the session-stored elements
|
||||
var collapsedIds = global.sessionGetCollapsedSidebarElements();
|
||||
let collapsedIds = sessionGetCollapsedSidebarElements();
|
||||
|
||||
// Get the current project stored elements
|
||||
var currentProjectIds = _.findWhere(collapsedIds, { prid: project });
|
||||
if ( currentProjectIds ){
|
||||
currentProjectIds.ids = _.filter(currentProjectIds.ids,
|
||||
function(val) {
|
||||
return val !== null;
|
||||
}).join(", ");
|
||||
let currentProjectIds = _.findWhere(collapsedIds, { prid: project });
|
||||
if (currentProjectIds) {
|
||||
currentProjectIds.ids = _.filter(currentProjectIds.ids, function(val) { return val !== null; }).join(', ');
|
||||
|
||||
// Collapse session-stored elements
|
||||
_.each($('li.parent_li[data-parent="candidate"]'), function(el) {
|
||||
var id = $(el).data("toggle-id");
|
||||
var id = $(el).data('toggle-id');
|
||||
var li = $(".tree li.parent_li[data-toggle-id='" + id + "']");
|
||||
|
||||
if( li.hasClass("active") || li.find(".active").length > 0){
|
||||
if (li.hasClass('active') || li.find('.active').length > 0) {
|
||||
// Always expand the active element
|
||||
toggleLi(li,
|
||||
false,
|
||||
false);
|
||||
} else if ( $.inArray( id.toString(),
|
||||
currentProjectIds.ids.split(", ")) !== -1 ) {
|
||||
} else if ($.inArray(id.toString(), currentProjectIds.ids.split(', ')) !== -1) {
|
||||
// Expande element
|
||||
toggleLi(li,
|
||||
false,
|
||||
|
@ -208,70 +205,54 @@
|
|||
} else {
|
||||
// Collapse all
|
||||
_.each($('li.parent_li[data-parent="candidate"]'), function(el) {
|
||||
var id = $(el).data("toggle-id");
|
||||
var id = $(el).data('toggle-id');
|
||||
var li = $(".tree li.parent_li[data-toggle-id='" + id + "']");
|
||||
|
||||
if( li.hasClass("active") ){
|
||||
if (li.hasClass('active') || li.find('.active').length > 0) {
|
||||
// Always expand the active element
|
||||
toggleLi(li,
|
||||
false,
|
||||
false);
|
||||
toggleLi(li, false, false);
|
||||
sessionCollapseSidebarElement(project, id);
|
||||
} else {
|
||||
// Element collapsed by default
|
||||
toggleLi(li,
|
||||
true,
|
||||
false);
|
||||
toggleLi(li, true, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Add onclick callback to every triangle icon
|
||||
$(".tree li.parent_li ")
|
||||
.find("> span i")
|
||||
.on("click", function (e) {
|
||||
var el = $(this)
|
||||
.parent("span")
|
||||
.parent("li.parent_li");
|
||||
$('.tree li.parent_li ').find('> span i').on('click', function(e) {
|
||||
let el = $(this).parent('span').parent('li.parent_li');
|
||||
|
||||
if (el.find(" > ul > li").is(":visible")) {
|
||||
if (el.find(' > ul > li').is(':visible')) {
|
||||
toggleLi(el, true, true);
|
||||
sessionExpandSidebarElement(project,
|
||||
el.data("toggle-id"),
|
||||
$('[data-parent="candidate"]').length );
|
||||
sessionExpandSidebarElement(project, el.data('toggle-id'), $('[data-parent="candidate"]').length);
|
||||
} else {
|
||||
toggleLi(el, false, true);
|
||||
sessionCollapseSidebarElement(project, el.data("toggle-id"));
|
||||
sessionCollapseSidebarElement(project, el.data('toggle-id'));
|
||||
}
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Add bold style to all levels of selected element
|
||||
$(".tree li.active ")
|
||||
.parents('.parent_li[data-parent="candidate"]')
|
||||
.find("> span a")
|
||||
.css("font-weight", "bold");
|
||||
$('.tree li.active ').parents('.parent_li[data-parent="candidate"]').find('> span a').css('font-weight', 'bold');
|
||||
|
||||
// Add custom borders to tree links
|
||||
$(".tree li span.tree-link ").after("<div class='border-custom'></div>");
|
||||
$('.tree li span.tree-link ').after("<div class='border-custom'></div>");
|
||||
}
|
||||
|
||||
// Resize the sidebar to accomodate to the page size
|
||||
global.resizeSidebarContents = function() {
|
||||
var tree = $("#sidebar-wrapper .tree");
|
||||
function resizeSidebarContents() {
|
||||
var tree = $('#sidebar-wrapper .tree');
|
||||
|
||||
// Set vertical scrollbar on navigation tree
|
||||
if (tree.length && tree.length == 1) {
|
||||
tree.css(
|
||||
"height",
|
||||
($(window).height() - tree.position().top - 50) + "px"
|
||||
);
|
||||
if (tree.length && tree.length === 1) {
|
||||
tree.css('height', ($(window).height() - tree.position().top - 50) + 'px');
|
||||
}
|
||||
}
|
||||
|
||||
function scrollToSelectedItem() {
|
||||
$('#slide-panel .tree').scrollTo($('.tree').data('scroll'));
|
||||
$(`${SIDEBAR_ID} .tree`).scrollTo($('.tree').data('scroll'));
|
||||
}
|
||||
|
||||
// Initialize click listeners
|
||||
|
|
|
@ -196,6 +196,14 @@ function filesSizeValidator(ev, fileInputs, fileTypeEnum) {
|
|||
return filesSizeValid;
|
||||
}
|
||||
|
||||
function numberMinMaxValidator(value, min, max) {
|
||||
if(parseInt(value) < min || isNaN(value))
|
||||
return min;
|
||||
else if(parseInt(value) > max)
|
||||
return max;
|
||||
else return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Overriden in billing module for checking whether enough
|
||||
* team space is free.
|
||||
|
|
|
@ -225,6 +225,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
table[data-editable=false] {
|
||||
.assign-counter-container {
|
||||
margin-left: 30px !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.editing {
|
||||
tbody {
|
||||
tr:hover {
|
||||
|
|
|
@ -5,25 +5,36 @@
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.alert-floating {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
height: 52px;
|
||||
padding: 9px;
|
||||
#notifications {
|
||||
left: 0;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 1100;
|
||||
|
||||
.fas {
|
||||
font-size: $font-size-h2;
|
||||
margin-left: 12px;
|
||||
}
|
||||
.alert-floating {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
height: 52px;
|
||||
opacity: 1;
|
||||
padding: 9px;
|
||||
|
||||
.message {
|
||||
color: $color-volcano;
|
||||
flex-grow: 1;
|
||||
margin-left: 14px;
|
||||
}
|
||||
.fas {
|
||||
font-size: $font-size-h2;
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
.close {
|
||||
top: 0;
|
||||
.message {
|
||||
color: $color-volcano;
|
||||
flex-grow: 1;
|
||||
margin-left: 14px;
|
||||
}
|
||||
|
||||
.close {
|
||||
opacity: .3;
|
||||
right: 10px;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -367,23 +367,6 @@
|
|||
padding: 10px 0 10px 30px;
|
||||
}
|
||||
|
||||
// Alert
|
||||
.alert {
|
||||
&.alert-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
a#hide-alert {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
&.alert-floating {
|
||||
position: fixed;
|
||||
top: 50px;
|
||||
z-index: 1000;
|
||||
}
|
||||
}
|
||||
|
||||
#content-wrapper {
|
||||
margin-top: 50px;
|
||||
margin-left: 83px;
|
||||
|
|
|
@ -12,10 +12,6 @@ body,
|
|||
min-width: 320px;
|
||||
}
|
||||
|
||||
#content-wrapper .container #notifications {
|
||||
margin-left: -15px;
|
||||
}
|
||||
|
||||
// Word wrapping everywhere, except for table header of "datatables.js"
|
||||
body,
|
||||
table.dataTable td {
|
||||
|
@ -1921,18 +1917,6 @@ a.disabled-with-click-events {
|
|||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
#alert-flash {
|
||||
button {
|
||||
margin-right: 400px;
|
||||
}
|
||||
|
||||
@media(max-width:768px) {
|
||||
button {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.linkedin-signin-button {
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
|
|
@ -57,10 +57,8 @@
|
|||
<%= render partial: "/system_notifications/system_notification_modal", locals: { notification: nil} %>
|
||||
<% end %>
|
||||
|
||||
<% unless user_signed_in? %>
|
||||
<%= render partial: 'shared/flash_alerts',
|
||||
<%= render partial: 'shared/flash_alerts',
|
||||
locals: { flash: flash, notice: notice, alert: alert } %>
|
||||
<% end %>
|
||||
|
||||
<%= render "shared/left_menu_bar" if user_signed_in? %>
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<% content_for :content do %>
|
||||
<div class="container-fluid" id="wrapper">
|
||||
<%= render partial: 'shared/flash_alerts',
|
||||
locals: { flash: flash, notice: notice, alert: alert } %>
|
||||
<div id="sidebar-wrapper" class="<%= yield :sidebar_wrapper_class %>">
|
||||
<%= yield :sidebar %>
|
||||
<div id="sidebar-arrow"
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<% content_for :content do %>
|
||||
<div class="container <%= yield :container_class %>">
|
||||
<% if user_signed_in? %>
|
||||
<%= render partial: 'shared/flash_alerts',
|
||||
locals: { flash: flash, notice: notice, alert: alert } %>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
<%= t('libraries.manange_modal_column.number_type.decimals_label') %>
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<%= number_field_tag('decimals', selected_decimals, in: 0...Constants::REPOSITORY_NUMBER_TYPE_MAX_DECIMALS,
|
||||
class: 'form-control') %>
|
||||
<%= number_field_tag('decimals', selected_decimals, between: 0...Constants::REPOSITORY_NUMBER_TYPE_MAX_DECIMALS,
|
||||
class: 'form-control',
|
||||
oninput: "this.value = numberMinMaxValidator(this.value, 0, #{Constants::REPOSITORY_NUMBER_TYPE_MAX_DECIMALS})" ) %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -7,6 +7,9 @@ services:
|
|||
- scinote_development_postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
- "POSTGRES_USER=postgres"
|
||||
- "POSTGRES_PASSWORD=mysecretpassword"
|
||||
|
||||
web:
|
||||
build:
|
||||
|
|
Loading…
Reference in a new issue