Merge branch 'master' into ai-sci-3239-add-localization-team-for-objects

This commit is contained in:
aignatov-bio 2019-03-28 09:13:34 +01:00 committed by GitHub
commit 8416d1ab1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 7 deletions

View file

@ -95,7 +95,7 @@ $(function() {
var dateContainer = $('.ga-side .date-selector.filter-block');
if (updateRunning) return false;
$('.ga-top .ga-tags').children().remove();
if (dateContainer[0].dataset.periodSelect && dateContainer[0].dataset.periodSelect !== 'null') {
if (dateContainer[0].dataset.periodSelect) {
$('<li class="select2-selection__choice">'
+ dateContainer[0].dataset.periodLabel
+ $('.ga-side .date-selector.filter-block')[0].dataset.periodSelect
@ -152,6 +152,12 @@ $(function() {
return true;
}
function resetHotButtonsBackgroundColor() {
$('.date-selector .hot-button').each(function() {
$(this).removeClass('selected');
});
}
// Common selection intialize
$.each(selectors, (index, e) => {
$('.ga-side .' + e + '-selector select').select2Multiple({ singleDisplay: true })
@ -182,7 +188,8 @@ $(function() {
$('.ga-side .subject-selector select').select2MultipleClearAll();
$('#calendar-from-date').data('DateTimePicker').clear();
$('#calendar-to-date').data('DateTimePicker').clear();
$('.ga-side .date-selector.filter-block')[0].dataset.periodSelect = null;
$('.ga-side .date-selector.filter-block')[0].dataset.periodSelect = '';
updateRunning = false;
GlobalActivitiesUpdateTopPaneTags();
reloadActivities();
@ -195,6 +202,7 @@ $(function() {
dateContainer[0].dataset.periodSelect = $('#calendar-from-date').val() + ' - ' + $('#calendar-to-date').val();
GlobalActivitiesUpdateTopPaneTags();
reloadActivities();
resetHotButtonsBackgroundColor();
}
});
@ -205,6 +213,7 @@ $(function() {
dateContainer[0].dataset.periodSelect = $('#calendar-from-date').val() + ' - ' + $('#calendar-to-date').val();
GlobalActivitiesUpdateTopPaneTags();
reloadActivities();
resetHotButtonsBackgroundColor();
}
});
@ -248,5 +257,8 @@ $(function() {
dateContainer[0].dataset.periodSelect = this.innerHTML;
GlobalActivitiesUpdateTopPaneTags();
reloadActivities();
resetHotButtonsBackgroundColor();
$(this).addClass('selected');
});
});

View file

@ -16,6 +16,7 @@
var link = $(obj).data('tooltiplink');
var textData = $(obj).data('tooltipcontent');
var customStyle = $(obj).data('tooltipstyle');
obj.dataset.tooltipId = i;
$(obj)
.popover({
@ -26,7 +27,7 @@
content: 'popovers will not display if empty',
template:
'<div class="popover tooltip_' + i + '_window tooltip-open" '
+ 'role="tooltip" style="' + customStyle + '">'
+ 'role="tooltip" style="' + customStyle + '" data-popover-id="' + i + '">'
+ '<div class="popover-body" >' + textData + '</div>'
+ '<br><br><br>'
+ '<div class="popover-footer">'
@ -59,7 +60,6 @@
clearTimeout(leaveTimeout);
enterTimeout = setTimeout(function() {
var top;
if ($(obj).hover().length > 0) {
$(obj).popover('show');
$('.tooltip_' + i + '_window').removeClass('tooltip-enter');
@ -84,6 +84,33 @@
$('.help_tooltips').each(function(i, obj) {
$(obj).popover('hide');
});
$('.popover.tooltip-open').each(function(i, obj) {
if ($('*[data-tooltip-id="' + obj.dataset.popoverId + '"]').length === 0) {
$(obj).remove();
}
});
});
$(document.body).on('mousemove', function(e) {
var mouse = { x: e.clientX, y: e.clientY };
$('.popover.tooltip-open').each(function(i, obj) {
var tooltipObj = '*[data-tooltip-id="' + obj.dataset.popoverId + '"]';
var objHeight = $(tooltipObj)[0].clientHeight;
var objWidth = $(tooltipObj)[0].clientWidth;
var objLeft = $(tooltipObj)[0].offsetLeft;
var objTop = $(tooltipObj)[0].offsetTop;
var objCorners = {
tl: { x: objLeft, y: objTop },
tr: { x: (objLeft + objWidth), y: objTop },
bl: { x: objLeft, y: (objTop + objHeight) },
br: { x: (objLeft + objWidth), y: (objTop + objHeight) }
};
if (
!(mouse.x > objCorners.tl.x && mouse.x < objCorners.br.x)
|| !(mouse.y > objCorners.tl.y && mouse.y < objCorners.br.y)
) {
$(tooltipObj).popover('hide');
}
});
});
};

View file

@ -29,6 +29,7 @@ $brand-primary-light: #dcedf6;
$brand-success-light: #e2eed8;
$brand-warning-light: #fcf7e4;
$brand-danger-light: #efdfdf;
$brand-light-blue: #e3f1f9;
//==============================================================================

View file

@ -128,6 +128,11 @@
text-align: left;
width: calc(50% - 25px);
&.selected {
background: $brand-light-blue;
opacity: 1;
}
&:nth-child(even) {
margin-left: 20px;
}

View file

@ -6,13 +6,14 @@ class GlobalActivitiesController < ApplicationController
selected_teams = if request.format.html?
current_team
elsif activity_filters[:teams].present?
@teams.where(id: activity_filters[:teams])
@teams.where(id: activity_filters[:teams]).order(name: :asc)
else
@teams
@teams.order(name: :asc)
end
@activity_types = Activity.activity_types_list
@user_list = User.where(id: UserTeam.where(team: current_user.teams).select(:user_id))
.distinct
.order(full_name: :asc)
.pluck(:full_name, :id)
@grouped_activities, @more_activities =
ActivitiesService.load_activities(current_user, selected_teams, activity_filters)

View file

@ -240,4 +240,4 @@ en:
result: "Result"
protocol: "Protocol"
step: "Step"
report: "Report"
report: "Report"