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
Boxiang Sun
gitlab-ce
Commits
b3b9a80d
Commit
b3b9a80d
authored
Sep 10, 2019
by
Etienne Baqué
Committed by
Lin Jen-Shin
Sep 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide urls for Merge Requests and Issue links
parent
8db75fec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
1 deletion
+85
-1
app/helpers/releases_helper.rb
app/helpers/releases_helper.rb
+38
-0
app/views/projects/releases/index.html.haml
app/views/projects/releases/index.html.haml
+1
-1
spec/helpers/releases_helper_spec.rb
spec/helpers/releases_helper_spec.rb
+46
-0
No files found.
app/helpers/releases_helper.rb
0 → 100644
View file @
b3b9a80d
# frozen_string_literal: true
module
ReleasesHelper
IMAGE_PATH
=
'illustrations/releases.svg'
DOCUMENTATION_PATH
=
'user/project/releases/index'
def
illustration
image_path
(
IMAGE_PATH
)
end
def
help_page
help_page_path
(
DOCUMENTATION_PATH
)
end
def
url_for_merge_requests
project_merge_requests_url
(
@project
,
params_for_issue_and_mr_paths
)
end
def
url_for_issues
project_issues_url
(
@project
,
params_for_issue_and_mr_paths
)
end
def
data_for_releases_page
{
project_id:
@project
.
id
,
illustration_path:
illustration
,
documentation_path:
help_page
,
merge_requests_url:
url_for_merge_requests
,
issues_url:
url_for_issues
}
end
private
def
params_for_issue_and_mr_paths
{
scope:
'all'
,
state:
'opened'
}
end
end
app/views/projects/releases/index.html.haml
View file @
b3b9a80d
-
page_title
_
(
'Releases'
)
#js-releases-page
{
data:
{
project_id:
@project
.
id
,
illustration_path:
image_path
(
'illustrations/releases.svg'
),
documentation_path:
help_page_path
(
'user/project/releases/index'
)
}
}
#js-releases-page
{
data:
data_for_releases_page
}
spec/helpers/releases_helper_spec.rb
0 → 100644
View file @
b3b9a80d
# frozen_string_literal: true
require
'spec_helper'
describe
ReleasesHelper
do
describe
'#illustration'
do
it
'returns the correct image path'
do
expect
(
helper
.
illustration
).
to
match
(
/illustrations\/releases-(\w+)\.svg/
)
end
end
describe
'#help_page'
do
it
'returns the correct link to the help page'
do
expect
(
helper
.
help_page
).
to
include
(
'user/project/releases/index'
)
end
end
context
'url helpers'
do
let
(
:project
)
{
build
(
:project
,
namespace:
create
(
:group
))
}
before
do
helper
.
instance_variable_set
(
:@project
,
project
)
end
describe
'#url_for_merge_requests'
do
it
'returns the the correct link with the correct parameters'
do
path
=
"
#{
project
.
group
.
path
}
/
#{
project
.
path
}
/merge_requests?scope=all&state=opened"
expect
(
helper
.
url_for_merge_requests
).
to
include
(
path
)
end
end
describe
'#url_for_issues'
do
it
'returns the the correct link with the correct parameters'
do
path
=
"
#{
project
.
group
.
path
}
/
#{
project
.
path
}
/issues?scope=all&state=opened"
expect
(
helper
.
url_for_issues
).
to
include
(
path
)
end
end
describe
'#data_for_releases_page'
do
it
'has the needed data to display release blocks'
do
keys
=
%i(project_id illustration_path documentation_path merge_requests_url issues_url)
expect
(
helper
.
data_for_releases_page
.
keys
).
to
eq
(
keys
)
end
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