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
83982b92
Commit
83982b92
authored
Nov 06, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restructure Epic data map structure for refactored Epic app
parent
b5527d26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
16 deletions
+34
-16
ee/app/helpers/epics_helper.rb
ee/app/helpers/epics_helper.rb
+18
-8
ee/spec/helpers/epics_helper_spec.rb
ee/spec/helpers/epics_helper_spec.rb
+16
-8
No files found.
ee/app/helpers/epics_helper.rb
View file @
83982b92
module
EpicsHelper
def
epic_show_app_data
(
epic
,
opts
)
author
=
epic
.
author
group
=
epic
.
group
todo
=
issuable_todo
(
epic
)
epic_meta
=
{
epic_id:
epic
.
id
,
created:
epic
.
created_at
,
author:
{
name:
author
.
name
,
url:
user_path
(
author
),
username:
"@
#{
author
.
username
}
"
,
src:
opts
[
:author_icon
]
},
author:
epic_author
(
epic
,
opts
),
todo_exists:
todo
.
present?
,
todo_path:
group_todos_path
(
group
),
start_date:
epic
.
start_date
,
...
...
@@ -34,7 +28,12 @@ module EpicsHelper
due_date:
epic
.
due_date_sourcing_milestone
&
.
due_date
},
end_date:
epic
.
end_date
,
state:
epic
.
state
state:
epic
.
state
,
namespace:
group
.
path
,
labels_path:
group_labels_path
(
group
,
format: :json
,
only_group_labels:
true
,
include_ancestor_groups:
true
),
toggle_subscription_path:
toggle_subscription_group_epic_path
(
group
,
epic
),
labels_web_url:
group_labels_path
(
group
),
epics_web_url:
group_epics_path
(
group
)
}
epic_meta
[
:todo_delete_path
]
=
dashboard_todo_path
(
todo
)
if
todo
.
present?
...
...
@@ -44,6 +43,8 @@ module EpicsHelper
participants:
participants
,
subscribed:
epic
.
subscribed?
(
current_user
))
# TODO: Remove from `namespace` to epics_web_url
# from below as it is already included in `epic_meta`
{
initial:
initial
.
to_json
,
meta:
epic_meta
.
to_json
,
...
...
@@ -55,6 +56,15 @@ module EpicsHelper
}
end
def
epic_author
(
epic
,
opts
)
{
name:
epic
.
author
.
name
,
url:
user_path
(
epic
.
author
),
username:
"@
#{
epic
.
author
.
username
}
"
,
src:
opts
[
:author_icon
]
}
end
def
epic_endpoint_query_params
(
opts
)
opts
[
:data
]
||=
{}
opts
[
:data
][
:endpoint_query_params
]
=
{
...
...
ee/spec/helpers/epics_helper_spec.rb
View file @
83982b92
...
...
@@ -30,10 +30,12 @@ describe EpicsHelper do
expected_keys
=
%i(initial meta namespace labels_path toggle_subscription_path labels_web_url epics_web_url)
expect
(
data
.
keys
).
to
match_array
(
expected_keys
)
expect
(
meta_data
.
keys
).
to
match_array
(
%w[
created author epic_id todo_exists todo_path state
start_date start_date_fixed start_date_is_fixed start_date_from_milestones start_date_sourcing_milestone_title
end_date due_date due_date_fixed due_date_is_fixed due_date_from_milestones due_date_sourcing_milestone_title
start_date_sourcing_milestone_dates due_date_sourcing_milestone_dates
epic_id created author todo_exists todo_path start_date
start_date_is_fixed start_date_fixed start_date_from_milestones
start_date_sourcing_milestone_title start_date_sourcing_milestone_dates
due_date due_date_is_fixed due_date_fixed due_date_from_milestones due_date_sourcing_milestone_title
due_date_sourcing_milestone_dates end_date state namespace labels_path toggle_subscription_path
labels_web_url epics_web_url
]
)
expect
(
meta_data
[
'author'
]).
to
eq
({
'name'
=>
user
.
name
,
...
...
@@ -74,15 +76,21 @@ describe EpicsHelper do
meta_data
=
JSON
.
parse
(
data
[
:meta
])
expect
(
meta_data
.
keys
).
to
match_array
(
%w[
created author epic_id todo_exists todo_path state
start_date start_date_fixed start_date_is_fixed start_date_from_milestones start_date_sourcing_milestone_title
end_date due_date due_date_fixed due_date_is_fixed due_date_from_milestones due_date_sourcing_milestone_title
start_date_sourcing_milestone_dates due_date_sourcing_milestone_dates
epic_id created author todo_exists todo_path start_date
start_date_is_fixed start_date_fixed start_date_from_milestones
start_date_sourcing_milestone_title start_date_sourcing_milestone_dates
due_date due_date_is_fixed due_date_fixed due_date_from_milestones due_date_sourcing_milestone_title
due_date_sourcing_milestone_dates end_date state namespace labels_path toggle_subscription_path
labels_web_url epics_web_url
]
)
expect
(
meta_data
[
'start_date'
]).
to
eq
(
'2000-01-01'
)
expect
(
meta_data
[
'start_date_sourcing_milestone_title'
]).
to
eq
(
milestone1
.
title
)
expect
(
meta_data
[
'start_date_sourcing_milestone_dates'
][
'start_date'
]).
to
eq
(
milestone1
.
start_date
.
to_s
)
expect
(
meta_data
[
'start_date_sourcing_milestone_dates'
][
'due_date'
]).
to
eq
(
milestone1
.
due_date
.
to_s
)
expect
(
meta_data
[
'due_date'
]).
to
eq
(
'2000-01-02'
)
expect
(
meta_data
[
'due_date_sourcing_milestone_title'
]).
to
eq
(
milestone2
.
title
)
expect
(
meta_data
[
'due_date_sourcing_milestone_dates'
][
'start_date'
]).
to
eq
(
milestone2
.
start_date
.
to_s
)
expect
(
meta_data
[
'due_date_sourcing_milestone_dates'
][
'due_date'
]).
to
eq
(
milestone2
.
due_date
.
to_s
)
end
end
end
...
...
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