mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-28 19:24:10 +08:00
Improve dropdown and side panel
This commit is contained in:
parent
163a17d6d9
commit
b1c32d9a30
6 changed files with 78 additions and 32 deletions
|
@ -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}
|
||||
</div>
|
||||
</div>`).appendTo('.ga-top .ga-tags');
|
||||
<i class="fas fa-times"></i>
|
||||
</div>`).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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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 = $(`<div class="ds-tags" >
|
||||
<div class="tag-label"
|
||||
data-ds-tag-group="${data.group}"
|
||||
data-ds-tag-id=${data.value}>
|
||||
data-ds-tag-id="${data.value}">
|
||||
${customLabel ? customLabel(data) : data.label}
|
||||
</div>
|
||||
<i class="fas fa-times"></i>
|
||||
</div>`).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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
data-period-label="<%= t('global_activities.index.period_label') %>"
|
||||
data-period-select="">
|
||||
<h4 class="title"><%= t('global_activities.index.activity') %></h4>
|
||||
|
||||
<h6 class="date clear"><%= t('global_activities.index.clear') %></h6>
|
||||
<div class="date-selector">
|
||||
<div class="hot-buttons">
|
||||
<div class="hot-button btn btn-default" data-period="today"><%= t('global_activities.index.today') %></div>
|
||||
|
|
Loading…
Reference in a new issue