Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
d7379c8e
Commit
d7379c8e
authored
7 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Ensure that the dropdowns reset on clear
parent
35b69c40
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentech/static_src/src/javascript/main.js
+25
-19
25 additions, 19 deletions
opentech/static_src/src/javascript/main.js
with
25 additions
and
19 deletions
opentech/static_src/src/javascript/main.js
+
25
−
19
View file @
d7379c8e
...
@@ -69,32 +69,38 @@ import MobileSearch from './components/mobile-search';
...
@@ -69,32 +69,38 @@ import MobileSearch from './components/mobile-search';
dropdowns
.
forEach
(
dropdown
=>
{
dropdowns
.
forEach
(
dropdown
=>
{
$
(
dropdown
).
val
(
null
).
trigger
(
'
change
'
);
$
(
dropdown
).
val
(
null
).
trigger
(
'
change
'
);
$
(
'
.select2-selection.is-active
'
).
removeClass
(
'
is-active
'
);
$
(
'
.select2-selection.is-active
'
).
removeClass
(
'
is-active
'
);
mobileFilterPadding
(
dropdown
);
});
});
});
});
function
mobileFilterPadding
(
element
)
{
const
dropdown
=
$
(
element
).
closest
(
'
.select2
'
);
const
openDropdown
=
$
(
'
.select2 .expanded
'
);
let
dropdownMargin
=
0
;
if
(
openDropdown
.
length
>
0
&&
!
openDropdown
.
hasClass
(
'
select2-container--open
'
)){
openDropdown
.
removeClass
(
'
expanded
'
);
if
(
dropdown
.
position
().
top
>
openDropdown
.
position
().
top
){
dropdownMargin
=
parseInt
(
openDropdown
.
css
(
'
marginBottom
'
));
}
openDropdown
.
css
(
'
margin-bottom
'
,
'
0px
'
);
}
if
(
dropdown
.
hasClass
(
'
select2-container--open
'
)){
dropdown
.
addClass
(
'
expanded
'
);
const
id
=
$
(
element
).
closest
(
'
.select2-selection
'
).
attr
(
'
aria-owns
'
);
const
match
=
$
(
`ul#
${
id
}
`
);
const
positionalMatch
=
match
.
closest
(
'
.select2-container
'
);
const
margin
=
match
.
outerHeight
(
true
);
dropdown
.
css
(
'
margin-bottom
'
,
`
${
margin
}
px`
);
positionalMatch
.
css
(
'
top
'
,
positionalMatch
.
position
().
top
-
dropdownMargin
);
}
}
// reset mobile filters if they're open past the tablet breakpoint
// reset mobile filters if they're open past the tablet breakpoint
$
(
window
).
resize
(
function
resize
(){
$
(
window
).
resize
(
function
resize
(){
if
(
$
(
window
).
width
()
<
768
)
{
if
(
$
(
window
).
width
()
<
768
)
{
$
(
'
.select2
'
).
on
(
'
click
'
,
(
e
)
=>
{
$
(
'
.select2
'
).
on
(
'
click
'
,
(
e
)
=>
{
const
dropdown
=
$
(
e
.
target
).
closest
(
'
.select2
'
);
mobileFilterPadding
(
e
.
target
);
const
openDropdown
=
$
(
'
.select2 .expanded
'
);
let
dropdownMargin
=
0
;
if
(
openDropdown
.
length
>
0
&&
!
openDropdown
.
hasClass
(
'
select2-container--open
'
)){
openDropdown
.
removeClass
(
'
expanded
'
);
if
(
dropdown
.
position
().
top
>
openDropdown
.
position
().
top
){
dropdownMargin
=
parseInt
(
openDropdown
.
css
(
'
marginBottom
'
));
}
openDropdown
.
css
(
'
margin-bottom
'
,
'
0px
'
);
}
if
(
dropdown
.
hasClass
(
'
select2-container--open
'
)){
dropdown
.
addClass
(
'
expanded
'
);
const
id
=
$
(
e
.
target
).
closest
(
'
.select2-selection
'
).
attr
(
'
aria-owns
'
);
const
match
=
$
(
`ul#
${
id
}
`
);
const
positionalMatch
=
match
.
closest
(
'
.select2-container
'
);
const
margin
=
match
.
outerHeight
(
true
);
dropdown
.
css
(
'
margin-bottom
'
,
`
${
margin
}
px`
);
positionalMatch
.
css
(
'
top
'
,
positionalMatch
.
position
().
top
-
dropdownMargin
);
}
});
});
}
}
}).
trigger
(
'
resize
'
);
}).
trigger
(
'
resize
'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment