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
Tatuya Kamada
gitlab-ce
Commits
024dc807
Commit
024dc807
authored
Mar 12, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add milestone sidebar update via JSON
parent
aa4da384
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
9 deletions
+83
-9
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+5
-1
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+48
-1
app/assets/javascripts/milestone_select.js.coffee
app/assets/javascripts/milestone_select.js.coffee
+3
-3
app/assets/stylesheets/pages/issuable.scss
app/assets/stylesheets/pages/issuable.scss
+1
-0
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-1
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+25
-3
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
024dc807
...
@@ -185,7 +185,8 @@ class GitLabDropdown
...
@@ -185,7 +185,8 @@ class GitLabDropdown
if
@
options
.
filterable
if
@
options
.
filterable
@
dropdown
.
find
(
".dropdown-input-field"
).
focus
()
@
dropdown
.
find
(
".dropdown-input-field"
).
focus
()
hidden
:
=>
hidden
:
(
e
)
=>
if
@
options
.
filterable
if
@
options
.
filterable
@
dropdown
@
dropdown
.
find
(
".dropdown-input-field"
)
.
find
(
".dropdown-input-field"
)
...
@@ -196,6 +197,9 @@ class GitLabDropdown
...
@@ -196,6 +197,9 @@ class GitLabDropdown
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
$
(
'.dropdown-menu'
,
@
dropdown
).
removeClass
PAGE_TWO_CLASS
$
(
'.dropdown-menu'
,
@
dropdown
).
removeClass
PAGE_TWO_CLASS
if
@
options
.
hidden
@
options
.
hidden
.
call
(
@
,
e
)
# Render the full menu
# Render the full menu
renderMenu
:
(
html
)
->
renderMenu
:
(
html
)
->
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
024dc807
...
@@ -4,6 +4,7 @@ class @LabelsSelect
...
@@ -4,6 +4,7 @@ class @LabelsSelect
$dropdown
=
$
(
dropdown
)
$dropdown
=
$
(
dropdown
)
projectId
=
$dropdown
.
data
(
'project-id'
)
projectId
=
$dropdown
.
data
(
'project-id'
)
labelUrl
=
$dropdown
.
data
(
'labels'
)
labelUrl
=
$dropdown
.
data
(
'labels'
)
issueUpdateURL
=
$dropdown
.
data
(
'issueUpdate'
)
selectedLabel
=
$dropdown
.
data
(
'selected'
)
selectedLabel
=
$dropdown
.
data
(
'selected'
)
if
selectedLabel
if
selectedLabel
selectedLabel
=
selectedLabel
.
toString
().
split
(
','
)
selectedLabel
=
selectedLabel
.
toString
().
split
(
','
)
...
@@ -12,6 +13,23 @@ class @LabelsSelect
...
@@ -12,6 +13,23 @@ class @LabelsSelect
showNo
=
$dropdown
.
data
(
'show-no'
)
showNo
=
$dropdown
.
data
(
'show-no'
)
showAny
=
$dropdown
.
data
(
'show-any'
)
showAny
=
$dropdown
.
data
(
'show-any'
)
defaultLabel
=
$dropdown
.
data
(
'default-label'
)
defaultLabel
=
$dropdown
.
data
(
'default-label'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$value
=
$block
.
find
(
'.value'
)
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
issueURLSplit
=
issueUpdateURL
.
split
(
'/'
)
labelHTMLTemplate
=
_
.
template
(
'<% _.each(labels, function(label){ %>'
+
'<a href="'
+
[
''
,
issueURLSplit
[
1
],
issueURLSplit
[
2
],
''
].
join
(
'/'
)
+
'issues?label_name=<%= label.title %>">'
+
'<span class="label color-label" '
+
'style="background-color: <%= label.color %>; '
+
'color: #FFFFFF">'
+
'<%= label.title %>'
+
'</span>'
+
'</a>'
+
'<% }); %>'
);
if
newLabelField
.
length
if
newLabelField
.
length
$newLabelCreateButton
=
$
(
'.js-new-label-btn'
)
$newLabelCreateButton
=
$
(
'.js-new-label-btn'
)
...
@@ -133,6 +151,7 @@ class @LabelsSelect
...
@@ -133,6 +151,7 @@ class @LabelsSelect
search
:
search
:
fields
:
[
'title'
]
fields
:
[
'title'
]
selectable
:
true
selectable
:
true
toggleLabel
:
(
selected
)
->
toggleLabel
:
(
selected
)
->
if
selected
and
selected
.
title
isnt
'Any Label'
if
selected
and
selected
.
title
isnt
'Any Label'
selected
.
title
selected
.
title
...
@@ -142,8 +161,15 @@ class @LabelsSelect
...
@@ -142,8 +161,15 @@ class @LabelsSelect
id
:
(
label
)
->
id
:
(
label
)
->
if
label
.
isAny
?
if
label
.
isAny
?
''
''
else
else
if
$dropdown
.
hasClass
"js-filter-submit"
label
.
title
label
.
title
else
label
.
id
hidden
:
->
$selectbox
.
hide
()
$value
.
show
()
clicked
:
->
clicked
:
->
page
=
$
(
'body'
).
data
'page'
page
=
$
(
'body'
).
data
'page'
isIssueIndex
=
page
is
'projects:issues:index'
isIssueIndex
=
page
is
'projects:issues:index'
...
@@ -153,4 +179,25 @@ class @LabelsSelect
...
@@ -153,4 +179,25 @@ class @LabelsSelect
Issues
.
filterResults
$dropdown
.
closest
(
'form'
)
Issues
.
filterResults
$dropdown
.
closest
(
'form'
)
else
if
$dropdown
.
hasClass
'js-filter-submit'
else
if
$dropdown
.
hasClass
'js-filter-submit'
$dropdown
.
closest
(
'form'
).
submit
()
$dropdown
.
closest
(
'form'
).
submit
()
else
selected
=
$dropdown
.
closest
(
'.selectbox'
)
.
find
(
'input[type="hidden"]'
)
.
val
()
# need inline-block here instead of show,
# which will default to the element's style in this case inline.
$loading
.
fadeIn
()
$
.
ajax
(
type
:
'PUT'
url
:
issueUpdateURL
data
:
issue
:
label_ids
:
[
selected
]
).
done
(
data
)
->
$loading
.
fadeOut
()
$selectbox
.
hide
()
href
=
$value
.
show
()
.
html
(
labelHTMLTemplate
(
data
))
)
)
app/assets/javascripts/milestone_select.js.coffee
View file @
024dc807
...
@@ -59,7 +59,9 @@ class @MilestoneSelect
...
@@ -59,7 +59,9 @@ class @MilestoneSelect
milestone
.
id
milestone
.
id
isSelected
:
(
milestone
)
->
isSelected
:
(
milestone
)
->
milestone
.
title
is
selectedMilestone
milestone
.
title
is
selectedMilestone
hidden
:
->
$selectbox
.
hide
()
$value
.
show
()
clicked
:
(
e
)
->
clicked
:
(
e
)
->
if
$dropdown
.
hasClass
"js-filter-submit"
if
$dropdown
.
hasClass
"js-filter-submit"
$dropdown
.
parents
(
'form'
).
submit
()
$dropdown
.
parents
(
'form'
).
submit
()
...
@@ -68,8 +70,6 @@ class @MilestoneSelect
...
@@ -68,8 +70,6 @@ class @MilestoneSelect
.
closest
(
'.selectbox'
)
.
closest
(
'.selectbox'
)
.
find
(
'input[type="hidden"]'
)
.
find
(
'input[type="hidden"]'
)
.
val
()
.
val
()
# need inline-block here instead of show,
# which will default to the element's style in this case inline.
$loading
$loading
.
fadeIn
()
.
fadeIn
()
$
.
ajax
(
$
.
ajax
(
...
...
app/assets/stylesheets/pages/issuable.scss
View file @
024dc807
...
@@ -255,6 +255,7 @@
...
@@ -255,6 +255,7 @@
.dropdown-menu-toggle
{
.dropdown-menu-toggle
{
width
:
100%
;
width
:
100%
;
padding-top
:
0
;
}
}
.open
.dropdown-menu
{
.open
.dropdown-menu
{
...
...
app/controllers/projects/issues_controller.rb
View file @
024dc807
...
@@ -108,7 +108,7 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -108,7 +108,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
end
end
format
.
json
do
format
.
json
do
render
json:
@issue
.
to_json
(
include:
:milestone
)
render
json:
@issue
.
to_json
(
include:
[
:milestone
,
:labels
]
)
end
end
end
end
end
end
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
024dc807
...
@@ -75,6 +75,7 @@
...
@@ -75,6 +75,7 @@
=
issuable
.
labels
.
count
=
issuable
.
labels
.
count
.title.hide-collapsed
.title.hide-collapsed
Labels
Labels
=
icon
(
'spinner spin'
,
class:
'block-loading'
)
-
if
can?
(
current_user
,
:"admin_
#{
issuable
.
to_ability_name
}
"
,
@project
)
-
if
can?
(
current_user
,
:"admin_
#{
issuable
.
to_ability_name
}
"
,
@project
)
=
link_to
'Edit'
,
'#'
,
class:
'edit-link pull-right'
=
link_to
'Edit'
,
'#'
,
class:
'edit-link pull-right'
.value.bold.issuable-show-labels.hide-collapsed
{
class:
(
"has-labels"
if
issuable
.
labels
.
any?
)
}
.value.bold.issuable-show-labels.hide-collapsed
{
class:
(
"has-labels"
if
issuable
.
labels
.
any?
)
}
...
@@ -84,8 +85,29 @@
...
@@ -84,8 +85,29 @@
-
else
-
else
.light
None
.light
None
.selectbox.hide-collapsed
.selectbox.hide-collapsed
=
f
.
collection_select
:label_ids
,
issuable
.
project
.
labels
.
all
,
:id
,
:name
,
.dropdown
{
selected:
issuable
.
label_ids
},
multiple:
true
,
class:
'select2 js-select2'
,
data:
{
placeholder:
"Select labels"
}
%button
.dropdown-menu-toggle.js-label-select
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"label_name"
,
show_no:
"true"
,
show_any:
"true"
,
selected:
params
[
:label_name
],
project_id:
(
@project
.
id
if
@project
),
issue_update:
namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issuable
.
id
,
:json
),
labels:
(
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
if
@project
)}}
%span
.dropdown-toggle-text
Label
=
icon
(
'chevron-down'
)
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
.dropdown-page-one
=
dropdown_title
(
"Filter by label"
)
=
dropdown_filter
(
"Search labels"
)
=
dropdown_content
-
if
@project
=
dropdown_footer
do
%ul
.dropdown-footer-list
-
if
can?
current_user
,
:admin_label
,
@project
%li
%a
.dropdown-toggle-page
{
href:
"#"
}
Create new
%li
=
link_to
namespace_project_labels_path
(
@project
.
namespace
,
@project
)
do
-
if
can?
current_user
,
:admin_label
,
@project
Manage labels
-
else
View labels
=
render
"shared/issuable/participants"
,
participants:
issuable
.
participants
(
current_user
)
=
render
"shared/issuable/participants"
,
participants:
issuable
.
participants
(
current_user
)
-
if
current_user
-
if
current_user
...
@@ -116,6 +138,6 @@
...
@@ -116,6 +138,6 @@
=
clipboard_button
(
clipboard_text:
project_ref
)
=
clipboard_button
(
clipboard_text:
project_ref
)
:javascript
:javascript
new
Subscription
(
'
.subscription
'
);
new
MilestoneSelect
();
new
MilestoneSelect
();
new
LabelsSelect
();
new
IssuableContext
();
new
IssuableContext
();
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