diff --git a/app/assets/javascripts/global_activities/side_pane.js b/app/assets/javascripts/global_activities/side_pane.js index 9cc1fe4a9..48cae2679 100644 --- a/app/assets/javascripts/global_activities/side_pane.js +++ b/app/assets/javascripts/global_activities/side_pane.js @@ -102,6 +102,17 @@ var globalActivities = (function() { dropdownSelector.clearData(activityFilter); }); + $('.date-selector .date.clear').click(() => { + updateRunning = true; + $('#calendar-from-date').data('DateTimePicker').clear(); + $('#calendar-to-date').data('DateTimePicker').clear(); + $('.ga-side .date-selector.filter-block')[0].dataset.periodSelect = ''; + resetHotButtonsBackgroundColor(); + updateRunning = false; + GlobalActivitiesUpdateTopPaneTags(); + reloadActivities(); + }); + dropdownSelector.init(userFilter, { ajaxParams: ajaxParams, onChange: defaultOnChangeActions @@ -203,12 +214,17 @@ var globalActivities = (function() { ${dateContainer[0].dataset.periodLabel} ${$('.ga-side .date-selector.filter-block')[0].dataset.periodSelect} - `).appendTo('.ga-top .ga-tags'); + + `).appendTo('.ga-top .ga-tags') + .find('.fa-times').click(() => { + $('.date-selector .date.clear').click(); + }); } $.each($('.ga-side .ds-tags'), function(index, tag) { var newTag = $(tag.outerHTML).appendTo('.ga-top .ga-tags'); newTag.find('.fa-times') - .click(() => { + .click(function() { + newTag.addClass('closing'); $(tag).find('.fa-times').click(); }); }); diff --git a/app/assets/javascripts/sitewide/dropdown_selector.js b/app/assets/javascripts/sitewide/dropdown_selector.js index 6bcd45257..c48e97fb9 100644 --- a/app/assets/javascripts/sitewide/dropdown_selector.js +++ b/app/assets/javascripts/sitewide/dropdown_selector.js @@ -151,6 +151,7 @@ var dropdownSelector = (function() { if (dropdownContainer.hasClass('open')) { loadData(selectElement, dropdownContainer); updateDropdownDirection(selectElement, dropdownContainer); + dropdownContainer.find('.search-field').focus(); } }); $(window).resize(function() { updateDropdownDirection(selectElement, dropdownContainer); }); @@ -271,6 +272,7 @@ var dropdownSelector = (function() { }); updateCurrentData(container, selectArray); updateTags(selector, container); + loadData(selector, container); } // Refresh tags in input field @@ -284,18 +286,17 @@ var dropdownSelector = (function() { var tag = $(`
`).insertBefore(container.find('.input-field .search-field')); - tag.click((e) => { e.stopPropagation(); }); tag.find('.fa-times').click(function(e) { var tagLabel = $(this).prev(); var toDelete; e.stopPropagation(); - tagLabel.addClass('closing'); + $(this).parent().addClass('closing'); setTimeout(() => { if (selector.data('combine-tags')) { container.find('.data-field').val('[]'); @@ -303,13 +304,13 @@ var dropdownSelector = (function() { } else { selectedOptions = getCurrentData(container); toDelete = selectedOptions.findIndex(x => (String(x.value) === String(tagLabel.data('ds-tag-id')) - && String(x.group) === String(tagLabel.data('ds-tag-group')) + && (String(x.group) === String(tagLabel.data('ds-tag-group')) || !selector.data('select-by-group')) )); selectedOptions.splice(toDelete, 1); updateCurrentData(container, selectedOptions); updateTags(selector, container); } - }, 300); + }, 350); }); } diff --git a/app/assets/stylesheets/constants.scss b/app/assets/stylesheets/constants.scss index 8912987e7..f84fd85af 100644 --- a/app/assets/stylesheets/constants.scss +++ b/app/assets/stylesheets/constants.scss @@ -73,6 +73,7 @@ $font-family-sans-serif: "Open Sans", Arial, Helvetica, sans-serif; $font-family-serif: Georgia, "Times New Roman", Times, serif; $font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace; $font-family-base: $font-family-lato; +$font-family-icons: "Font Awesome 5 Free"; $font-size-base: 14px; $font-size-large: ceil(($font-size-base * 1.1)); //16px $font-size-small: ceil(($font-size-base * .9)); //13px diff --git a/app/assets/stylesheets/global_activities.scss b/app/assets/stylesheets/global_activities.scss index 3757d3343..4bebfbf7b 100644 --- a/app/assets/stylesheets/global_activities.scss +++ b/app/assets/stylesheets/global_activities.scss @@ -103,16 +103,24 @@ .ds-tags { align-items: center; background: $color-concrete; - border-radius: 12px; + border-radius: 5px; box-shadow: 0 0 1px 1px rgba(0, 0, 0, .1); display: flex; flex-shrink: 0; line-height: 13px; margin: 2px 3px; - max-width: calc(100% - 6px); + max-width: 250px; + overflow: hidden; padding: 5px 7px; + transition: .3s; user-select: none; + &.closing { + margin: 2px 0; + max-width: 0; + padding: 5px 0; + } + &.stretch { flex-grow: 1; flex-shrink: 1; @@ -124,13 +132,9 @@ margin-right: 5px; max-width: 500px; overflow: hidden; - transition: .3s; + text-overflow: ellipsis; white-space: nowrap; width: auto; - - &.closing { - max-width: 0; - } } .fas { @@ -294,12 +298,12 @@ } .ga-side { - flex-basis: 320px; + flex-basis: 450px; flex-shrink: 0; height: 100%; margin-right: -15px; overflow: hidden; - padding: 0 15px 20px; + padding: 15px 20px; position: relative; .filter-block { @@ -391,6 +395,24 @@ } } +@media (max-width: 1200px) { + .ga-side { + flex-basis: 350px; + } +} + +@media (max-height: 800px) { + .ga-side { + .date-selector { + .hot-buttons { + .hot-button { + margin: 5px 0; + } + } + } + } +} + @media (max-width: 900px) { .ga-main { .activities-day { diff --git a/app/assets/stylesheets/shared/dropdown_selector.scss b/app/assets/stylesheets/shared/dropdown_selector.scss index af21fab29..898112bf6 100644 --- a/app/assets/stylesheets/shared/dropdown_selector.scss +++ b/app/assets/stylesheets/shared/dropdown_selector.scss @@ -37,10 +37,10 @@ .search-field { border: 0; - flex-basis: 50px; + flex-basis: 0; flex-grow: 2000; line-height: 24px; - min-width: 50px; + min-width: 0; outline: 0; padding-left: 5px; @@ -52,30 +52,32 @@ .ds-tags { align-items: center; background: $color-concrete; - border-radius: 12px; - box-shadow: 0 0 1px 1px rgba(0, 0, 0, .1); + border-radius: 5px; display: flex; flex-shrink: 0; line-height: 13px; margin: 2px 3px; - max-width: calc(100% - 6px); + max-width: calc(100% - 11px); + overflow: hidden; padding: 5px 7px; + transition: .3s; user-select: none; + &.closing { + margin: 2px 0; + max-width: 0; + padding: 5px 0; + } + .tag-label { display: inline-block; margin-bottom: 1px; margin-right: 5px; max-width: 500px; overflow: hidden; - transition: .3s; + text-overflow: ellipsis; white-space: nowrap; width: auto; - - &.closing { - margin-right: 0; - max-width: 0; - } } .fas { @@ -127,9 +129,10 @@ .checkbox-icon { &::before { content: "\f0c8"; - font-family: "Font Awesome 5 Free"; + font-family: $font-family-icons; + font-size: 16px; font-weight: 400; - margin: 2px 5px 0 0; + margin: 0 8px 0 0; position: relative; } @@ -155,8 +158,7 @@ } &:hover { - background: $brand-primary; - color: $color-white; + background: $brand-primary-light; } @@ -211,6 +213,10 @@ border-radius: 4px 4px 0 0; z-index: 12; + .search-field { + min-width: 50px; + } + .fa-caret-down { transform: rotate(180deg); } diff --git a/app/views/global_activities/_side_filters.html.erb b/app/views/global_activities/_side_filters.html.erb index 93e245aea..15ce0f9a7 100644 --- a/app/views/global_activities/_side_filters.html.erb +++ b/app/views/global_activities/_side_filters.html.erb @@ -15,7 +15,7 @@ data-period-label="<%= t('global_activities.index.period_label') %>" data-period-select="">