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
da4f0f14
Commit
da4f0f14
authored
Jul 11, 2018
by
George Tsiolis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move merge requests EE helper methods
parent
4cefac10
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
40 deletions
+50
-40
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+2
-40
ee/app/helpers/ee/merge_requests_helper.rb
ee/app/helpers/ee/merge_requests_helper.rb
+43
-0
ee/changelogs/unreleased/move-merge-request-ee-helper-methods.yml
...elogs/unreleased/move-merge-request-ee-helper-methods.yml
+5
-0
No files found.
app/helpers/merge_requests_helper.rb
View file @
da4f0f14
module
MergeRequestsHelper
prepend
EE
::
MergeRequestsHelper
def
new_mr_path_from_push_event
(
event
)
target_project
=
event
.
project
.
default_merge_request_target
project_new_merge_request_path
(
...
...
@@ -59,46 +61,6 @@ module MergeRequestsHelper
)
end
def
render_items_list
(
items
,
separator
=
"and"
)
items_cnt
=
items
.
size
case
items_cnt
when
1
items
.
first
when
2
"
#{
items
.
first
}
#{
separator
}
#{
items
.
last
}
"
else
last_item
=
items
.
pop
"
#{
items
.
join
(
", "
)
}
#{
separator
}
#{
last_item
}
"
end
end
# This may be able to be removed with associated specs
def
render_require_section
(
merge_request
)
str
=
if
merge_request
.
approvals_left
==
1
"Requires one more approval"
else
"Requires
#{
merge_request
.
approvals_left
}
more approvals"
end
if
merge_request
.
approvers_left
.
any?
more_approvals
=
merge_request
.
approvals_left
-
merge_request
.
approvers_left
.
count
approvers_names
=
merge_request
.
approvers_left
.
map
(
&
:name
)
str
<<
if
more_approvals
>
0
" (from
#{
render_items_list
(
approvers_names
+
[
"
#{
more_approvals
}
more"
])
}
)"
elsif
more_approvals
<
0
" (from
#{
render_items_list
(
approvers_names
,
"or"
)
}
)"
else
" (from
#{
render_items_list
(
approvers_names
)
}
)"
end
end
str
end
def
format_mr_branch_names
(
merge_request
)
source_path
=
merge_request
.
source_project_path
target_path
=
merge_request
.
target_project_path
...
...
ee/app/helpers/ee/merge_requests_helper.rb
0 → 100644
View file @
da4f0f14
module
EE
module
MergeRequestsHelper
def
render_items_list
(
items
,
separator
=
"and"
)
items_cnt
=
items
.
size
case
items_cnt
when
1
items
.
first
when
2
"
#{
items
.
first
}
#{
separator
}
#{
items
.
last
}
"
else
last_item
=
items
.
pop
"
#{
items
.
join
(
", "
)
}
#{
separator
}
#{
last_item
}
"
end
end
# This may be able to be removed with associated specs
def
render_require_section
(
merge_request
)
str
=
if
merge_request
.
approvals_left
==
1
"Requires one more approval"
else
"Requires
#{
merge_request
.
approvals_left
}
more approvals"
end
if
merge_request
.
approvers_left
.
any?
more_approvals
=
merge_request
.
approvals_left
-
merge_request
.
approvers_left
.
count
approvers_names
=
merge_request
.
approvers_left
.
map
(
&
:name
)
str
<<
if
more_approvals
>
0
" (from
#{
render_items_list
(
approvers_names
+
[
"
#{
more_approvals
}
more"
])
}
)"
elsif
more_approvals
<
0
" (from
#{
render_items_list
(
approvers_names
,
"or"
)
}
)"
else
" (from
#{
render_items_list
(
approvers_names
)
}
)"
end
end
str
end
end
end
ee/changelogs/unreleased/move-merge-request-ee-helper-methods.yml
0 → 100644
View file @
da4f0f14
---
title
:
Move merge requests EE helper methods
merge_request
:
6461
author
:
George Tsiolis
type
:
other
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