Skip to content

Commit

Permalink
Merge pull request #1314 from kinow/fix-search-bootstrap
Browse files Browse the repository at this point in the history
Fix sidebar search, post bootstrap
  • Loading branch information
osma authored Apr 29, 2022
2 parents 58d75db + 3ccc395 commit a54f285
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 10 deletions.
74 changes: 66 additions & 8 deletions resource/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ html,body {
font-family: var(--font-family);
}

label {
display: inline-block;
max-width: 100%;
/* replaces margin-bottom from .form-label */
margin-bottom: 5px !important;
}

ul {
list-style: none;
}
Expand All @@ -230,6 +237,12 @@ ul {
margin: 0 !important;
}

.btn-default {
color: #333;
background-color: #fff;
border-color: #ccc;
}

@media print { /* Quick style sheet for printing. */
body * {
visibility: hidden;
Expand Down Expand Up @@ -579,6 +592,11 @@ ul.dropdown-menu > li:last-child > input {
padding: 3px 20px;
}

.multiselect-selected-text::after {
content: " ";
white-space: pre;
}

.form-check-input:checked {
background-color: #398ee7;
}
Expand Down Expand Up @@ -1184,24 +1202,52 @@ span.xl-pref-label > img {
color: var(--gray-900);
}

.search-options > .input-group > .btn-group {
.search-options > .input-group > .multiselect-native-select > .btn-group {
display: block;
}

.search-options > .input-group > .btn-group > .multiselect {
.search-options > .input-group > .multiselect-native-select > .btn-group > .multiselect {
background-color: var(--white-color);
border: 1px solid var(--gray-500);
overflow-y: hidden;
}

.search-options > .input-group > .btn-group > .multiselect-container {
.search-options > .input-group > .multiselect-native-select > .btn-group > .multiselect:focus {
background-color: var(--white-color) !important;
border: 1px solid var(--gray-500);
overflow-y: hidden;
}

.search-options > .input-group > .multiselect-native-select > .btn-group > .multiselect-container {
top: 44px;
}

.search-options > .input-group > .btn-group > .multiselect-container > li:first-of-type > * {
.search-options > .input-group > .multiselect-native-select > .btn-group > .multiselect-container > li:first-of-type > * {
height: 26px;
}

.search-options > .input-group > .multiselect-native-select > .dropdown > .dropdown-toggle::after {
display: inline-block;
margin-left: .255em;
vertical-align: .255em;
content: "";
border-top: .3em solid var(--dark-color);
border-right: .3em solid var(--white-color);
border-bottom: 0 solid var(--dark-color);
border-left: .3em solid var(--white-color);
}

.search-options > .input-group > .multiselect-native-select > .dropdown > .dropdown-toggle:focus::after {
display: inline-block;
margin-left: .255em;
vertical-align: .255em;
content: "";
border-top: .3em solid var(--dark-color);
border-right: .3em solid var(--white-color);
border-bottom: 0 solid var(--dark-color);
border-left: .3em solid var(--white-color);
}

.multiselect-container li {
min-height: 26px;
}
Expand Down Expand Up @@ -1232,6 +1278,17 @@ span.xl-pref-label > img {
top: 16px;
}

.multiselect-option {
padding-top: 0 !important;
padding-bottom: 0 !important;
margin-top: 0 !important;
margin-bottom: 0 !important;
}

.multiselect-option > .form-check {
margin-bottom: 0;
}

.fixed {
height: 95%;
height: calc(100% - 2px) !important;
Expand Down Expand Up @@ -1272,9 +1329,10 @@ div#sidebar-grey > div > div > form.search-options {

.search-options {
padding-left: 15px;
padding-right: 15px;
}

.search-options > .input-group * {
.form-check-input[type="checkbox"] {
border-radius: 0;
}

Expand Down Expand Up @@ -2055,7 +2113,7 @@ span.date-info {
font-size: var(--font-size);
}

.search-options > div.input-group > .twitter-typeahead, .search-options > div.input-group > .twitter-typeahead > .tt-menu, .search-options > .input-group > .btn-group > * {
.search-options > div.input-group > .twitter-typeahead, .search-options > div.input-group > .twitter-typeahead > .tt-menu, .search-options > .input-group > .multiselect-native-select > .btn-group > * {
width: 280px;
}

Expand Down Expand Up @@ -2527,11 +2585,11 @@ body, .versal, h1, h2, h3, p, .versal-bold {
height: calc(100% - 150px) !important;
}

.sidebar-grey > .search-options > .input-group > .btn-group > .multiselect {
.sidebar-grey > .search-options > .input-group > .multiselect-native-select > .btn-group > .multiselect {
width: 370px;
}

.sidebar-grey > .search-options > .input-group > .btn-group > .multiselect-container {
.sidebar-grey > .search-options > .input-group > .multiselect-native-select > .btn-group > .multiselect-container {
width: 370px;
}

Expand Down
9 changes: 8 additions & 1 deletion resource/js/docready.js
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ $(function() { // DOCUMENT READY

$('.sidebar-grey .multiselect').multiselect({
buttonText: function(options) {
if (options.length === 0) {
if (options.length === 0 || options.length === ($('.sidebar-grey .multiselect-container li').length - 1)) {
return '';
} else {
var selected = '';
Expand All @@ -1024,6 +1024,13 @@ $(function() { // DOCUMENT READY
},
numberDisplayed: 2,
buttonWidth: 'auto',
buttonClass: 'btn btn-secondary',
buttonContainer : '<div class="dropdown btn-group" aria-role="group" aria-label="" />',
templates: {
ul: '<ul class="multiselect-container dropdown-menu p-1 m-0"></ul>',
li: '<button class="multiselect-option dropdown-item"></button>',
button: '<button type="button" class="multiselect dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><span class="multiselect-selected-text"></span></button>',
},
onDropdownShown: function(event) {
var $activeChild = $(event.currentTarget).find('.active');
$('.multiselect-container').mCustomScrollbar('scrollTo', $activeChild);
Expand Down
2 changes: 1 addition & 1 deletion view/light.twig
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
<div class="input-group">
<label for="parent-limit" class="versal form-label">{% trans "By parent" %}</label><input type="text" id="parent-limit" class="form-control" value="{{ limit_parent }}">
</div>
<button type="button submit" class="btn btn-default">{% trans "Limit search" %}</button>
<button type="submit" class="btn btn-default">{% trans "Limit search" %}</button>
</form>
{% endif %}
</div>
Expand Down

0 comments on commit a54f285

Please sign in to comment.