Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
abba4521
Commit
abba4521
authored
Dec 05, 2017
by
Luke "Jared" Bennett
Committed by
Clement Ho
Dec 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "No clues to indicate the list in Go to board dropdown is scrollable"
parent
79350ba8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
179 additions
and
7 deletions
+179
-7
app/assets/javascripts/boards/components/boards_selector.js
app/assets/javascripts/boards/components/boards_selector.js
+37
-0
app/assets/stylesheets/framework/dropdowns.scss
app/assets/stylesheets/framework/dropdowns.scss
+26
-1
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+4
-0
changelogs/unreleased-ee/3181-no-clues-to-indicate-the-list-in-go-to-board-dropdown-is-scrollable.yml
...dicate-the-list-in-go-to-board-dropdown-is-scrollable.yml
+6
-0
ee/app/views/shared/boards/_switcher.html.haml
ee/app/views/shared/boards/_switcher.html.haml
+7
-6
spec/javascripts/boards/components/boards_selector_spec.js
spec/javascripts/boards/components/boards_selector_spec.js
+99
-0
No files found.
app/assets/javascripts/boards/components/boards_selector.js
View file @
abba4521
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
throttle
}
from
'
underscore
'
;
import
BoardForm
from
'
./board_form.vue
'
;
import
BoardForm
from
'
./board_form.vue
'
;
(()
=>
{
(()
=>
{
...
@@ -10,6 +11,7 @@ import BoardForm from './board_form.vue';
...
@@ -10,6 +11,7 @@ import BoardForm from './board_form.vue';
Store
.
createNewListDropdownData
();
Store
.
createNewListDropdownData
();
gl
.
issueBoards
.
BoardsSelector
=
Vue
.
extend
({
gl
.
issueBoards
.
BoardsSelector
=
Vue
.
extend
({
name
:
'
boards-selector
'
,
components
:
{
components
:
{
BoardForm
,
BoardForm
,
},
},
...
@@ -22,13 +24,22 @@ import BoardForm from './board_form.vue';
...
@@ -22,13 +24,22 @@ import BoardForm from './board_form.vue';
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
},
},
throttleDuration
:
{
type
:
Number
,
default
:
200
,
},
},
},
data
()
{
data
()
{
return
{
return
{
open
:
false
,
open
:
false
,
loading
:
true
,
loading
:
true
,
hasScrollFade
:
false
,
scrollFadeInitialized
:
false
,
boards
:
[],
boards
:
[],
state
:
Store
.
state
,
state
:
Store
.
state
,
throttledSetScrollFade
:
throttle
(
this
.
setScrollFade
,
this
.
throttleDuration
),
contentClientHeight
:
0
,
maxPosition
:
0
,
};
};
},
},
watch
:
{
watch
:
{
...
@@ -60,6 +71,11 @@ import BoardForm from './board_form.vue';
...
@@ -60,6 +71,11 @@ import BoardForm from './board_form.vue';
showDelete
()
{
showDelete
()
{
return
this
.
boards
.
length
>
1
;
return
this
.
boards
.
length
>
1
;
},
},
scrollFadeClass
()
{
return
{
'
fade-out
'
:
!
this
.
hasScrollFade
,
};
},
},
},
methods
:
{
methods
:
{
showPage
(
page
)
{
showPage
(
page
)
{
...
@@ -81,11 +97,32 @@ import BoardForm from './board_form.vue';
...
@@ -81,11 +97,32 @@ import BoardForm from './board_form.vue';
this
.
loading
=
false
;
this
.
loading
=
false
;
this
.
boards
=
json
;
this
.
boards
=
json
;
})
})
.
then
(()
=>
this
.
$nextTick
())
// Wait for boards list in DOM
.
then
(
this
.
setScrollFade
)
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
loading
=
false
;
this
.
loading
=
false
;
});
});
}
}
},
},
isScrolledUp
()
{
const
{
content
}
=
this
.
$refs
;
const
currentPosition
=
this
.
contentClientHeight
+
content
.
scrollTop
;
return
content
&&
currentPosition
<
this
.
maxPosition
;
},
initScrollFade
()
{
this
.
scrollFadeInitialized
=
true
;
const
{
content
}
=
this
.
$refs
;
this
.
contentClientHeight
=
content
.
clientHeight
;
this
.
maxPosition
=
content
.
scrollHeight
;
},
setScrollFade
()
{
if
(
!
this
.
scrollFadeInitialized
)
this
.
initScrollFade
();
this
.
hasScrollFade
=
this
.
isScrolledUp
();
},
},
},
created
()
{
created
()
{
this
.
state
.
currentBoard
=
this
.
currentBoard
;
this
.
state
.
currentBoard
=
this
.
currentBoard
;
...
...
app/assets/stylesheets/framework/dropdowns.scss
View file @
abba4521
...
@@ -608,7 +608,7 @@
...
@@ -608,7 +608,7 @@
}
}
.dropdown-content
{
.dropdown-content
{
max-height
:
215px
;
max-height
:
$dropdown-max-height
;
overflow-y
:
auto
;
overflow-y
:
auto
;
}
}
...
@@ -1059,3 +1059,28 @@ header.header-content .dropdown-menu.projects-dropdown-menu {
...
@@ -1059,3 +1059,28 @@ header.header-content .dropdown-menu.projects-dropdown-menu {
margin
:
0
;
margin
:
0
;
}
}
}
}
.dropdown-content-faded-mask
{
position
:
relative
;
.dropdown-list
{
max-height
:
$dropdown-max-height
;
overflow-y
:
auto
;
position
:
relative
;
}
&
:
:
after
{
height
:
$dropdown-fade-mask-height
;
width
:
100%
;
position
:
absolute
;
bottom
:
0
;
background
:
linear-gradient
(
to
top
,
$white-light
0
,
rgba
(
$white-light
,
0
));
transition
:
opacity
$fade-mask-transition-duration
$fade-mask-transition-curve
;
content
:
''
;
pointer-events
:
none
;
}
&.
fade-out
:
:
after
{
opacity
:
0
;
}
}
app/assets/stylesheets/framework/variables.scss
View file @
abba4521
...
@@ -344,6 +344,7 @@ $regular_font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-San
...
@@ -344,6 +344,7 @@ $regular_font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-San
* Dropdowns
* Dropdowns
*/
*/
$dropdown-width
:
300px
;
$dropdown-width
:
300px
;
$dropdown-max-height
:
215px
;
$dropdown-vertical-offset
:
4px
;
$dropdown-vertical-offset
:
4px
;
$dropdown-link-color
:
#555
;
$dropdown-link-color
:
#555
;
$dropdown-link-hover-bg
:
$row-hover
;
$dropdown-link-hover-bg
:
$row-hover
;
...
@@ -360,6 +361,7 @@ $dropdown-loading-bg: rgba(#fff, .6);
...
@@ -360,6 +361,7 @@ $dropdown-loading-bg: rgba(#fff, .6);
$dropdown-chevron-size
:
10px
;
$dropdown-chevron-size
:
10px
;
$dropdown-toggle-active-border-color
:
darken
(
$border-color
,
14%
);
$dropdown-toggle-active-border-color
:
darken
(
$border-color
,
14%
);
$dropdown-item-hover-bg
:
$gray-darker
;
$dropdown-item-hover-bg
:
$gray-darker
;
$dropdown-fade-mask-height
:
32px
;
/*
/*
* Filtered Search
* Filtered Search
...
@@ -571,6 +573,8 @@ $label-border-radius: 100px;
...
@@ -571,6 +573,8 @@ $label-border-radius: 100px;
* Animation
* Animation
*/
*/
$fade-in-duration
:
200ms
;
$fade-in-duration
:
200ms
;
$fade-mask-transition-duration
:
.1s
;
$fade-mask-transition-curve
:
ease-in-out
;
/*
/*
* Lint
* Lint
...
...
changelogs/unreleased-ee/3181-no-clues-to-indicate-the-list-in-go-to-board-dropdown-is-scrollable.yml
0 → 100644
View file @
abba4521
---
title
:
Add fade mask to the bottom of the boards selector dropdown list if it can
be scrolled down
merge_request
:
3384
author
:
type
:
other
ee/app/views/shared/boards/_switcher.html.haml
View file @
abba4521
...
@@ -2,25 +2,26 @@
...
@@ -2,25 +2,26 @@
-
milestone_filter_opts
=
{
format: :json
}
-
milestone_filter_opts
=
{
format: :json
}
-
milestone_filter_opts
=
milestone_filter_opts
.
merge
(
only_group_milestones:
true
)
if
board
.
group_board?
-
milestone_filter_opts
=
milestone_filter_opts
.
merge
(
only_group_milestones:
true
)
if
board
.
group_board?
%boards-selector
{
"inline-template"
=>
true
,
%boards-selector
.js-boards-selector
{
"inline-template"
=>
true
,
":current-board"
=>
current_board_json
,
":current-board"
=>
current_board_json
,
"milestone-path"
=>
milestones_filter_path
(
milestone_filter_opts
)
}
"milestone-path"
=>
milestones_filter_path
(
milestone_filter_opts
)
}
%span
.boards-selector-wrapper
%span
.boards-selector-wrapper
.js-boards-selector-wrapper
.dropdown
.dropdown
%button
.dropdown-menu-toggle
{
"v-on:click"
=>
"loadBoards"
,
%button
.dropdown-menu-toggle
.js-dropdown-toggle
{
"v-on:click"
=>
"loadBoards"
,
data:
{
toggle:
"dropdown"
}
}
data:
{
toggle:
"dropdown"
}
}
{{ board.name }}
{{ board.name }}
=
icon
(
"chevron-down"
)
=
icon
(
"chevron-down"
)
.dropdown-menu
{
":class"
=>
"{ 'is-loading': loading }"
}
.dropdown-menu
{
":class"
=>
"{ 'is-loading': loading }"
}
.dropdown-content
.dropdown-content
-faded-mask.js-scroll-fade
{
":class"
=>
"scrollFadeClass"
}
%ul
{
"v-if"
=>
"!loading
"
}
%ul
.dropdown-list.js-dropdown-list
{
"v-if"
=>
"!loading"
,
"v-on:scroll.passive"
=>
"throttledSetScrollFade"
,
ref:
"content
"
}
%li
{
"v-for"
=>
"board in boards"
}
%li
.dropdown-item.js-dropdown-item
{
"v-for"
=>
"board in boards"
}
%a
{
":href"
=>
"'#{board_base_url}/' + board.id"
}
%a
{
":href"
=>
"'#{board_base_url}/' + board.id"
}
{{ board.name }}
{{ board.name }}
-
if
!
multiple_boards_available?
&&
current_board_parent
.
boards
.
size
>
1
-
if
!
multiple_boards_available?
&&
current_board_parent
.
boards
.
size
>
1
%li
%li
.small.unclickable
.small.unclickable
Some of your boards are hidden, activate a license to see them again.
Some of your boards are hidden, activate a license to see them again.
.dropdown-loading
{
"v-if"
=>
"loading"
}
.dropdown-loading
{
"v-if"
=>
"loading"
}
=
icon
(
"spin spinner"
)
=
icon
(
"spin spinner"
)
...
...
spec/javascripts/boards/components/boards_selector_spec.js
0 → 100644
View file @
abba4521
/* global BoardService */
import
Vue
from
'
vue
'
;
import
BoardService
from
'
~/boards/services/board_service
'
;
import
'
~/boards/components/boards_selector
'
;
import
setTimeoutPromiseHelper
from
'
../../helpers/set_timeout_promise_helper
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
const
throttleDuration
=
1
;
function
waitForScroll
()
{
return
Vue
.
nextTick
()
.
then
(()
=>
setTimeoutPromiseHelper
(
throttleDuration
))
.
then
(()
=>
Vue
.
nextTick
());
}
describe
(
'
BoardsSelector
'
,
()
=>
{
let
vm
;
let
scrollContainer
;
let
scrollFade
;
let
boardServiceResponse
;
const
boards
=
new
Array
(
20
).
fill
()
.
map
((
board
,
id
)
=>
{
const
name
=
`board
${
id
}
`
;
return
{
id
,
name
,
};
});
beforeEach
((
done
)
=>
{
loadFixtures
(
'
boards/show.html.raw
'
);
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
boardService
=
new
BoardService
({
boardsEndpoint
:
''
,
listsEndpoint
:
''
,
bulkUpdatePath
:
''
,
boardId
:
''
,
});
boardServiceResponse
=
Promise
.
resolve
({
json
()
{
return
boards
;
},
});
spyOn
(
BoardService
.
prototype
,
'
allBoards
'
).
and
.
returnValue
(
boardServiceResponse
);
vm
=
mountComponent
(
gl
.
issueBoards
.
BoardsSelector
,
{
throttleDuration
,
currentBoard
:
{},
milestonePath
:
''
,
},
document
.
querySelector
(
'
.js-boards-selector
'
));
vm
.
$el
.
querySelector
(
'
.js-dropdown-toggle
'
).
click
();
boardServiceResponse
.
then
(()
=>
vm
.
$nextTick
())
.
then
(()
=>
{
scrollFade
=
vm
.
$el
.
querySelector
(
'
.js-scroll-fade
'
);
scrollContainer
=
scrollFade
.
querySelector
(
'
.js-dropdown-list
'
);
scrollContainer
.
style
.
maxHeight
=
'
100px
'
;
scrollContainer
.
style
.
overflowY
=
'
scroll
'
;
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
window
.
gl
.
boardService
=
undefined
;
});
it
(
'
shows the scroll fade if isScrolledUp
'
,
(
done
)
=>
{
scrollContainer
.
scrollTop
=
0
;
waitForScroll
()
.
then
(()
=>
{
expect
(
scrollFade
.
classList
.
contains
(
'
fade-out
'
)).
toEqual
(
false
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
hides the scroll fade if not isScrolledUp
'
,
(
done
)
=>
{
scrollContainer
.
scrollTop
=
scrollContainer
.
scrollHeight
;
waitForScroll
()
.
then
(()
=>
{
expect
(
scrollFade
.
classList
.
contains
(
'
fade-out
'
)).
toEqual
(
true
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment