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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
1956bd5e
Commit
1956bd5e
authored
Oct 04, 2016
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add position menu above ability to glDropdown.
parent
a04378a5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
39 deletions
+41
-39
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+13
-0
app/assets/javascripts/labels_select.js
app/assets/javascripts/labels_select.js
+8
-2
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestone_select.js
+8
-2
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+8
-3
app/assets/stylesheets/pages/issuable.scss
app/assets/stylesheets/pages/issuable.scss
+0
-28
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+3
-3
app/views/shared/issuable/_milestone_dropdown.html.haml
app/views/shared/issuable/_milestone_dropdown.html.haml
+1
-1
No files found.
app/assets/javascripts/gl_dropdown.js
View file @
1956bd5e
...
...
@@ -443,6 +443,7 @@
var
contentHtml
;
this
.
resetRows
();
this
.
addArrowKeyEvent
();
if
(
this
.
options
.
setIndeterminateIds
)
{
this
.
options
.
setIndeterminateIds
.
call
(
this
);
}
...
...
@@ -460,9 +461,21 @@
if
(
this
.
options
.
filterable
)
{
this
.
filterInput
.
focus
();
}
if
(
this
.
options
.
showMenuAbove
)
{
this
.
positionMenuAbove
();
}
return
this
.
dropdown
.
trigger
(
'
shown.gl.dropdown
'
);
};
GitLabDropdown
.
prototype
.
positionMenuAbove
=
function
()
{
var
$button
=
$
(
this
.
el
);
var
$menu
=
this
.
dropdown
.
find
(
'
.dropdown-menu
'
);
$menu
.
css
(
'
top
'
,
(
$button
.
height
()
+
$menu
.
height
())
*
-
1
);
};
GitLabDropdown
.
prototype
.
hidden
=
function
(
e
)
{
var
$input
;
this
.
resetRows
();
...
...
app/assets/javascripts/labels_select.js
View file @
1956bd5e
...
...
@@ -4,7 +4,7 @@
var
_this
;
_this
=
this
;
$
(
'
.js-label-select
'
).
each
(
function
(
i
,
dropdown
)
{
var
$block
,
$colorPreview
,
$dropdown
,
$form
,
$loading
,
$selectbox
,
$sidebarCollapsedValue
,
$value
,
abilityName
,
defaultLabel
,
enableLabelCreateButton
,
issueURLSplit
,
issueUpdateURL
,
labelHTMLTemplate
,
labelNoneHTMLTemplate
,
labelUrl
,
projectId
,
saveLabelData
,
selectedLabel
,
showAny
,
showNo
,
$sidebarLabelTooltip
,
initialSelected
,
$toggleText
,
fieldName
,
useId
,
propertyName
;
var
$block
,
$colorPreview
,
$dropdown
,
$form
,
$loading
,
$selectbox
,
$sidebarCollapsedValue
,
$value
,
abilityName
,
defaultLabel
,
enableLabelCreateButton
,
issueURLSplit
,
issueUpdateURL
,
labelHTMLTemplate
,
labelNoneHTMLTemplate
,
labelUrl
,
projectId
,
saveLabelData
,
selectedLabel
,
showAny
,
showNo
,
$sidebarLabelTooltip
,
initialSelected
,
$toggleText
,
fieldName
,
useId
,
propertyName
,
showMenuAbove
;
$dropdown
=
$
(
dropdown
);
$toggleText
=
$dropdown
.
find
(
'
.dropdown-toggle-text
'
);
projectId
=
$dropdown
.
data
(
'
project-id
'
);
...
...
@@ -16,6 +16,7 @@
}
showNo
=
$dropdown
.
data
(
'
show-no
'
);
showAny
=
$dropdown
.
data
(
'
show-any
'
);
showMenuAbove
=
$dropdown
.
data
(
'
showMenuAbove
'
);
defaultLabel
=
$dropdown
.
data
(
'
default-label
'
);
abilityName
=
$dropdown
.
data
(
'
ability-name
'
);
$selectbox
=
$dropdown
.
closest
(
'
.selectbox
'
);
...
...
@@ -120,6 +121,7 @@
});
};
return
$dropdown
.
glDropdown
({
showMenuAbove
:
showMenuAbove
,
data
:
function
(
term
,
callback
)
{
return
$
.
ajax
({
url
:
labelUrl
...
...
@@ -157,7 +159,11 @@
data
=
extraData
.
concat
(
data
);
}
}
return
callback
(
data
);
callback
(
data
);
if
(
showMenuAbove
)
{
$dropdown
.
data
(
'
glDropdown
'
).
positionMenuAbove
();
}
});
},
renderRow
:
function
(
label
,
instance
)
{
...
...
app/assets/javascripts/milestone_select.js
View file @
1956bd5e
...
...
@@ -7,7 +7,7 @@
this
.
currentProject
=
JSON
.
parse
(
currentProject
);
}
$
(
'
.js-milestone-select
'
).
each
(
function
(
i
,
dropdown
)
{
var
$block
,
$dropdown
,
$loading
,
$selectbox
,
$sidebarCollapsedValue
,
$value
,
abilityName
,
collapsedSidebarLabelTemplate
,
defaultLabel
,
issuableId
,
issueUpdateURL
,
milestoneLinkNoneTemplate
,
milestoneLinkTemplate
,
milestonesUrl
,
projectId
,
selectedMilestone
,
showAny
,
showNo
,
showUpcoming
,
useId
;
var
$block
,
$dropdown
,
$loading
,
$selectbox
,
$sidebarCollapsedValue
,
$value
,
abilityName
,
collapsedSidebarLabelTemplate
,
defaultLabel
,
issuableId
,
issueUpdateURL
,
milestoneLinkNoneTemplate
,
milestoneLinkTemplate
,
milestonesUrl
,
projectId
,
selectedMilestone
,
showAny
,
showNo
,
showUpcoming
,
useId
,
showMenuAbove
;
$dropdown
=
$
(
dropdown
);
projectId
=
$dropdown
.
data
(
'
project-id
'
);
milestonesUrl
=
$dropdown
.
data
(
'
milestones
'
);
...
...
@@ -15,6 +15,7 @@
selectedMilestone
=
$dropdown
.
data
(
'
selected
'
);
showNo
=
$dropdown
.
data
(
'
show-no
'
);
showAny
=
$dropdown
.
data
(
'
show-any
'
);
showMenuAbove
=
$dropdown
.
data
(
'
showMenuAbove
'
);
showUpcoming
=
$dropdown
.
data
(
'
show-upcoming
'
);
useId
=
$dropdown
.
data
(
'
use-id
'
);
defaultLabel
=
$dropdown
.
data
(
'
default-label
'
);
...
...
@@ -31,6 +32,7 @@
collapsedSidebarLabelTemplate
=
_
.
template
(
'
<span class="has-tooltip" data-container="body" title="<%- remaining %>" data-placement="left"> <%- title %> </span>
'
);
}
return
$dropdown
.
glDropdown
({
showMenuAbove
:
showMenuAbove
,
data
:
function
(
term
,
callback
)
{
return
$
.
ajax
({
url
:
milestonesUrl
...
...
@@ -60,7 +62,11 @@
if
(
extraOptions
.
length
)
{
extraOptions
.
push
(
'
divider
'
);
}
return
callback
(
extraOptions
.
concat
(
data
));
callback
(
extraOptions
.
concat
(
data
));
if
(
showMenuAbove
)
{
$dropdown
.
data
(
'
glDropdown
'
).
positionMenuAbove
();
}
});
},
filterable
:
true
,
...
...
app/assets/javascripts/users_select.js
View file @
1956bd5e
...
...
@@ -14,11 +14,12 @@
$
(
'
.js-user-search
'
).
each
((
function
(
_this
)
{
return
function
(
i
,
dropdown
)
{
var
options
=
{};
var
$block
,
$collapsedSidebar
,
$dropdown
,
$loading
,
$selectbox
,
$value
,
abilityName
,
assignTo
,
assigneeTemplate
,
collapsedAssigneeTemplate
,
defaultLabel
,
firstUser
,
issueURL
,
selectedId
,
showAnyUser
,
showNullUser
;
var
$block
,
$collapsedSidebar
,
$dropdown
,
$loading
,
$selectbox
,
$value
,
abilityName
,
assignTo
,
assigneeTemplate
,
collapsedAssigneeTemplate
,
defaultLabel
,
firstUser
,
issueURL
,
selectedId
,
showAnyUser
,
showNullUser
,
showMenuAbove
;
$dropdown
=
$
(
dropdown
);
options
.
projectId
=
$dropdown
.
data
(
'
project-id
'
);
options
.
showCurrentUser
=
$dropdown
.
data
(
'
current-user
'
);
showNullUser
=
$dropdown
.
data
(
'
null-user
'
);
showMenuAbove
=
$dropdown
.
data
(
'
showMenuAbove
'
);
showAnyUser
=
$dropdown
.
data
(
'
any-user
'
);
firstUser
=
$dropdown
.
data
(
'
first-user
'
);
options
.
authorId
=
$dropdown
.
data
(
'
author-id
'
);
...
...
@@ -73,6 +74,7 @@
collapsedAssigneeTemplate
=
_
.
template
(
'
<% if( avatar ) { %> <a class="author_link" href="/u/<%- username %>"> <img width="24" class="avatar avatar-inline s24" alt="" src="<%- avatar %>"> </a> <% } else { %> <i class="fa fa-user"></i> <% } %>
'
);
assigneeTemplate
=
_
.
template
(
'
<% if (username) { %> <a class="author_link bold" href="/u/<%- username %>"> <% if( avatar ) { %> <img width="32" class="avatar avatar-inline s32" alt="" src="<%- avatar %>"> <% } %> <span class="author"><%- name %></span> <span class="username"> @<%- username %> </span> </a> <% } else { %> <span class="no-value assign-yourself"> No assignee - <a href="#" class="js-assign-yourself"> assign yourself </a> </span> <% } %>
'
);
return
$dropdown
.
glDropdown
({
showMenuAbove
:
showMenuAbove
,
data
:
function
(
term
,
callback
)
{
var
isAuthorFilter
;
isAuthorFilter
=
$
(
'
.js-author-search
'
);
...
...
@@ -116,8 +118,11 @@
if
(
showDivider
)
{
users
.
splice
(
showDivider
,
0
,
"
divider
"
);
}
// Send the data back
return
callback
(
users
);
callback
(
users
);
if
(
showMenuAbove
)
{
$dropdown
.
data
(
'
glDropdown
'
).
positionMenuAbove
();
}
});
},
filterable
:
true
,
...
...
app/assets/stylesheets/pages/issuable.scss
View file @
1956bd5e
...
...
@@ -419,31 +419,3 @@
}
}
}
.issue-form
{
.dropdown-menu-labels
{
top
:
-391px
;
&
.is-loading
{
top
:
-166px
;
}
}
.dropdown-menu-milestone
{
top
:
-310px
;
&
.is-loading
{
top
:
-166px
;
}
}
.dropdown-menu-assignee
{
top
:
-315px
;
&
.is-loading
{
top
:
-101px
;
}
}
}
app/views/shared/issuable/_form.html.haml
View file @
1956bd5e
...
...
@@ -86,19 +86,19 @@
-
if
issuable
.
assignee_id
=
f
.
hidden_field
:assignee_id
=
dropdown_tag
(
user_dropdown_label
(
issuable
.
assignee_id
,
"Assignee"
),
options:
{
toggle_class:
"js-dropdown-keep-input js-user-search js-issuable-form-dropdown js-assignee-search"
,
title:
"Filter by assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit"
,
placeholder:
"Search assignee"
,
data:
{
first_user:
current_user
.
try
(
:username
),
null_user:
true
,
current_user:
true
,
project_id:
project
.
try
(
:id
),
selected:
issuable
.
assignee_id
,
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[assignee_id]"
,
default_label:
"Assignee"
}
})
placeholder:
"Search assignee"
,
data:
{
first_user:
current_user
.
try
(
:username
),
null_user:
true
,
current_user:
true
,
project_id:
project
.
try
(
:id
),
selected:
issuable
.
assignee_id
,
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[assignee_id]"
,
default_label:
"Assignee"
,
show_menu_above:
true
}
})
.form-group.issue-milestone
=
f
.
label
:milestone_id
,
"Milestone"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
.issuable-form-select-holder
=
render
"shared/issuable/milestone_dropdown"
,
selected:
issuable
.
milestone
,
name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[milestone_id]"
,
show_any:
false
,
show_upcoming:
false
,
extra_class:
"js-issuable-form-dropdown js-dropdown-keep-input"
=
render
"shared/issuable/milestone_dropdown"
,
selected:
issuable
.
milestone
,
name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[milestone_id]"
,
show_any:
false
,
show_
menu_above:
true
,
show_
upcoming:
false
,
extra_class:
"js-issuable-form-dropdown js-dropdown-keep-input"
.form-group
-
has_labels
=
issuable
.
project
.
labels
.
any?
=
f
.
label
:label_ids
,
"Labels"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
=
f
.
hidden_field
:label_ids
,
multiple:
true
,
value:
''
.col-sm-10
{
class:
"#{"
col
-
lg
-
8
" if has_due_date} #{'issuable-form-padding-top' if !has_labels}"
}
.issuable-form-select-holder
=
render
"shared/issuable/label_dropdown"
,
classes:
[
"js-issuable-form-dropdown"
],
selected:
issuable
.
labels
,
data_options:
{
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[label_ids][]"
,
show_any:
false
}
=
render
"shared/issuable/label_dropdown"
,
classes:
[
"js-issuable-form-dropdown"
],
selected:
issuable
.
labels
,
data_options:
{
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[label_ids][]"
,
show_any:
false
,
show_menu_above:
'true'
}
-
if
has_due_date
.col-lg-6
.form-group
...
...
app/views/shared/issuable/_milestone_dropdown.html.haml
View file @
1956bd5e
...
...
@@ -4,7 +4,7 @@
-
if
selected
.
present?
=
hidden_field_tag
(
name
,
name
==
:milestone_title
?
selected
.
title
:
selected
.
id
)
=
dropdown_tag
(
milestone_dropdown_label
(
selected_text
),
options:
{
title:
"Filter by milestone"
,
toggle_class:
"js-milestone-select js-filter-submit
#{
extra_class
}
"
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable dropdown-menu-milestone"
,
placeholder:
"Search milestones"
,
footer_content:
project
.
present?
,
data:
{
show_no:
true
,
show_any:
show_any
,
show_upcoming:
show_upcoming
,
field_name:
name
,
selected:
selected
.
try
(
:title
),
project_id:
project
.
try
(
:id
),
milestones:
milestones_filter_dropdown_path
,
default_label:
"Milestone"
}
})
do
placeholder:
"Search milestones"
,
footer_content:
project
.
present?
,
data:
{
show_no:
true
,
show_
menu_above:
true
,
show_
any:
show_any
,
show_upcoming:
show_upcoming
,
field_name:
name
,
selected:
selected
.
try
(
:title
),
project_id:
project
.
try
(
:id
),
milestones:
milestones_filter_dropdown_path
,
default_label:
"Milestone"
}
})
do
-
if
project
%ul
.dropdown-footer-list
-
if
can?
current_user
,
:admin_milestone
,
project
...
...
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