BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d847db79
Commit
d847db79
authored
Mar 16, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes issue on dashboard issues
They would try to load JSON from a project even though it isn't a single project
parent
645b7a0a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
67 deletions
+92
-67
dashboard_controller.rb
app/controllers/dashboard_controller.rb
+18
-0
labels_helper.rb
app/helpers/labels_helper.rb
+7
-5
milestones_helper.rb
app/helpers/milestones_helper.rb
+8
-5
_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+2
-57
_label_dropdown.html.haml
app/views/shared/issuable/_label_dropdown.html.haml
+39
-0
_milestone_dropdown.html.haml
app/views/shared/issuable/_milestone_dropdown.html.haml
+16
-0
routes.rb
config/routes.rb
+2
-0
No files found.
app/controllers/dashboard_controller.rb
View file @
d847db79
...
...
@@ -20,6 +20,24 @@ class DashboardController < Dashboard::ApplicationController
end
end
def
labels
respond_to
do
|
format
|
format
.
json
do
projects
render
json:
view_context
.
projects_labels_options
end
end
end
def
milestones
respond_to
do
|
format
|
format
.
json
do
projects
render
json:
view_context
.
projects_milestones_options
end
end
end
protected
def
load_events
...
...
app/helpers/labels_helper.rb
View file @
d847db79
...
...
@@ -116,12 +116,14 @@ module LabelsHelper
else
Label
.
where
(
project_id:
@projects
)
end
end
grouped_labels
=
GlobalLabel
.
build_collection
(
labels
)
grouped_labels
.
unshift
(
Label
::
None
)
grouped_labels
.
unshift
(
Label
::
Any
)
options_from_collection_for_select
(
grouped_labels
,
'name'
,
'title'
,
params
[
:label_name
])
def
labels_filter_path
if
@project
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
else
labels_dashboard_path
(
:json
)
end
end
def
label_subscription_status
(
label
)
...
...
app/helpers/milestones_helper.rb
View file @
d847db79
...
...
@@ -56,12 +56,15 @@ module MilestonesHelper
epoch
=
DateTime
.
parse
(
'1970-01-01'
)
grouped_milestones
=
GlobalMilestone
.
build_collection
(
milestones
)
grouped_milestones
=
grouped_milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
grouped_milestones
.
unshift
(
Milestone
::
None
)
grouped_milestones
.
unshift
(
Milestone
::
Any
)
grouped_milestones
.
unshift
(
Milestone
::
Upcoming
)
grouped_milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
end
options_from_collection_for_select
(
grouped_milestones
,
'name'
,
'title'
,
params
[
:milestone_title
])
def
milestones_filter_dropdown_path
if
@project
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
)
else
milestones_dashboard_path
(
:json
)
end
end
def
milestone_remaining_days
(
milestone
)
...
...
app/views/shared/issuable/_filter.html.haml
View file @
d847db79
...
...
@@ -19,65 +19,10 @@
placeholder:
"Search assignee"
,
data:
{
any_user:
"Any Assignee"
,
first_user:
(
current_user
.
username
if
current_user
),
null_user:
true
,
current_user:
true
,
project_id:
(
@project
.
id
if
@project
),
selected:
params
[
:assignee_id
],
field_name:
"assignee_id"
}
})
.filter-item.inline.milestone-filter
-
if
params
[
:milestone_title
]
=
hidden_field_tag
(
:milestone_title
,
params
[
:milestone_title
])
=
dropdown_tag
(
h
(
params
[
:milestone_name
]
||
"Milestone"
),
options:
{
title:
"Filter by milestone"
,
toggle_class:
'js-milestone-select js-filter-submit'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
footer_content:
true
,
data:
{
show_no:
true
,
show_any:
true
,
field_name:
"milestone_title"
,
selected:
params
[
:milestone_title
],
project_id:
(
@project
.
id
if
@project
),
milestones:
(
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
)
if
@project
)
}
})
do
-
if
@project
%ul
.dropdown-footer-list
-
if
can?
current_user
,
:admin_milestone
,
@project
%li
=
link_to
new_namespace_project_milestone_path
(
@project
.
namespace
,
@project
),
title:
"New Milestone"
do
Create new
%li
=
link_to
namespace_project_milestones_path
(
@project
.
namespace
,
@project
)
do
-
if
can?
current_user
,
:admin_milestone
,
@project
Manage milestones
-
else
View milestones
=
render
"shared/issuable/milestone_dropdown"
.filter-item.inline.labels-filter
-
if
params
[
:label_name
]
=
hidden_field_tag
(
:label_name
,
params
[
:label_name
])
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-filter-submit
{
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
),
labels:
(
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
if
@project
)}}
%span
.dropdown-toggle-text
=
h
(
params
[
:label_name
]
||
"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
-
if
can?
current_user
,
:admin_label
,
@project
.dropdown-page-two
=
dropdown_title
(
"Create new label"
,
back:
true
)
=
dropdown_content
do
%input
#new_label_color
{
type:
"hidden"
}
%input
#new_label_name
.dropdown-input-field
{
type:
"text"
,
placeholder:
"Name new label"
}
.dropdown-label-color-preview.js-dropdown-label-color-preview
.suggest-colors.suggest-colors-dropdown
-
suggested_colors
.
each
do
|
color
|
=
link_to
'#'
,
style:
"background-color:
#{
color
}
"
,
data:
{
color:
color
}
do
&
nbsp
%button
.btn.btn-primary.js-new-label-btn
{
type:
"button"
}
Create
=
dropdown_loading
.dropdown-loading
=
icon
(
'spinner spin'
)
=
render
"shared/issuable/label_dropdown"
.pull-right
=
render
'shared/sort_dropdown'
...
...
app/views/shared/issuable/_label_dropdown.html.haml
0 → 100644
View file @
d847db79
-
if
params
[
:label_name
]
=
hidden_field_tag
(
:label_name
,
params
[
:label_name
])
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-filter-submit
{
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
),
labels:
labels_filter_path
}}
%span
.dropdown-toggle-text
=
h
(
params
[
:label_name
]
||
"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
-
if
can?
current_user
,
:admin_label
,
@project
and
@project
.dropdown-page-two
=
dropdown_title
(
"Create new label"
,
back:
true
)
=
dropdown_content
do
%input
#new_label_color
{
type:
"hidden"
}
%input
#new_label_name
.dropdown-input-field
{
type:
"text"
,
placeholder:
"Name new label"
}
.dropdown-label-color-preview.js-dropdown-label-color-preview
.suggest-colors.suggest-colors-dropdown
-
suggested_colors
.
each
do
|
color
|
=
link_to
'#'
,
style:
"background-color:
#{
color
}
"
,
data:
{
color:
color
}
do
&
nbsp
%button
.btn.btn-primary.js-new-label-btn
{
type:
"button"
}
Create
=
dropdown_loading
app/views/shared/issuable/_milestone_dropdown.html.haml
0 → 100644
View file @
d847db79
-
if
params
[
:milestone_title
]
=
hidden_field_tag
(
:milestone_title
,
params
[
:milestone_title
])
=
dropdown_tag
(
h
(
params
[
:milestone_name
]
||
"Milestone"
),
options:
{
title:
"Filter by milestone"
,
toggle_class:
'js-milestone-select js-filter-submit'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
footer_content:
true
,
data:
{
show_no:
true
,
show_any:
true
,
field_name:
"milestone_title"
,
selected:
params
[
:milestone_title
],
project_id:
(
@project
.
id
if
@project
),
milestones:
milestones_filter_dropdown_path
}
})
do
-
if
@project
%ul
.dropdown-footer-list
-
if
can?
current_user
,
:admin_milestone
,
@project
%li
=
link_to
new_namespace_project_milestone_path
(
@project
.
namespace
,
@project
),
title:
"New Milestone"
do
Create new
%li
=
link_to
namespace_project_milestones_path
(
@project
.
namespace
,
@project
)
do
-
if
can?
current_user
,
:admin_milestone
,
@project
Manage milestones
-
else
View milestones
config/routes.rb
View file @
d847db79
...
...
@@ -351,6 +351,8 @@ Rails.application.routes.draw do
get
:issues
get
:merge_requests
get
:activity
get
:labels
get
:milestones
scope
module: :dashboard
do
resources
:milestones
,
only:
[
:index
,
:show
]
...
...
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