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
a6218748
Commit
a6218748
authored
Nov 08, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ee into ce_upstream
parents
01c5dd81
1a33795a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
82 additions
and
47 deletions
+82
-47
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+2
-1
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+0
-27
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+51
-0
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+4
-17
app/views/shared/issuable/form/_template_selector.html.haml
app/views/shared/issuable/form/_template_selector.html.haml
+13
-0
changelogs/unreleased-ee/1118-fix-approvals-api-documentation.yml
...gs/unreleased-ee/1118-fix-approvals-api-documentation.yml
+4
-0
doc/api/merge_requests.md
doc/api/merge_requests.md
+1
-1
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+6
-0
No files found.
.gitlab-ci.yml
View file @
a6218748
...
...
@@ -325,7 +325,7 @@ trigger_docs:
cache
:
{}
artifacts
:
{}
script
:
-
"
curl
-X
POST
-F
token=${DOCS_TRIGGER_TOKEN}
-F
ref=master
-F
variables[PROJECT]=ee
https://gitlab.com/api/v3/projects/
38069
/trigger/builds"
-
"
curl
-X
POST
-F
token=${DOCS_TRIGGER_TOKEN}
-F
ref=master
-F
variables[PROJECT]=ee
https://gitlab.com/api/v3/projects/
1794617
/trigger/builds"
only
:
-
master@gitlab-org/gitlab-ee
...
...
app/assets/javascripts/application.js
View file @
a6218748
...
...
@@ -59,6 +59,7 @@
(
function
()
{
document
.
addEventListener
(
'
page:fetch
'
,
gl
.
utils
.
cleanupBeforeFetch
);
window
.
addEventListener
(
'
hashchange
'
,
gl
.
utils
.
shiftWindow
);
$
.
timeago
.
settings
.
allowFuture
=
true
;
window
.
onload
=
function
()
{
// Scroll the window to avoid the topnav bar
...
...
@@ -192,7 +193,7 @@
var
btn
=
$
(
e
.
target
);
var
form
=
btn
.
closest
(
'
form
'
);
var
text
=
btn
.
data
(
'
confirm-danger-message
'
);
var
warningMessage
=
btn
.
data
(
"
warning-message
"
);
var
warningMessage
=
btn
.
data
(
'
warning-message
'
);
e
.
preventDefault
();
return
new
ConfirmDangerModal
(
form
,
text
,
{
warningMessage
:
warningMessage
...
...
app/helpers/blob_helper.rb
View file @
a6218748
...
...
@@ -179,33 +179,6 @@ module BlobHelper
}
end
def
selected_template
(
issuable
)
templates
=
issuable_templates
(
issuable
)
params
[
:issuable_template
]
if
templates
.
include?
(
params
[
:issuable_template
])
end
def
can_add_template?
(
issuable
)
names
=
issuable_templates
(
issuable
)
names
.
empty?
&&
can?
(
current_user
,
:push_code
,
@project
)
&&
!
@project
.
private?
end
def
merge_request_template_names
@merge_request_templates
||=
Gitlab
::
Template
::
MergeRequestTemplate
.
dropdown_names
(
ref_project
)
end
def
issue_template_names
@issue_templates
||=
Gitlab
::
Template
::
IssueTemplate
.
dropdown_names
(
ref_project
)
end
def
issuable_templates
(
issuable
)
@issuable_templates
||=
if
issuable
.
is_a?
(
Issue
)
issue_template_names
elsif
issuable
.
is_a?
(
MergeRequest
)
merge_request_template_names
end
end
def
ref_project
@ref_project
||=
@target_project
||
@project
end
...
...
app/helpers/issuables_helper.rb
View file @
a6218748
...
...
@@ -30,6 +30,33 @@ module IssuablesHelper
end
end
def
can_add_template?
(
issuable
)
names
=
issuable_templates
(
issuable
)
names
.
empty?
&&
can?
(
current_user
,
:push_code
,
@project
)
&&
!
@project
.
private?
end
def
template_dropdown_tag
(
issuable
,
&
block
)
title
=
selected_template
(
issuable
)
||
"Choose a template"
options
=
{
toggle_class:
'js-issuable-selector'
,
title:
title
,
filter:
true
,
placeholder:
'Filter'
,
footer_content:
true
,
data:
{
data:
issuable_templates
(
issuable
),
field_name:
'issuable_template'
,
selected:
selected_template
(
issuable
),
project_path:
ref_project
.
path
,
namespace_path:
ref_project
.
namespace
.
path
}
}
dropdown_tag
(
title
,
options:
options
)
do
capture
(
&
block
)
end
end
def
user_dropdown_label
(
user_id
,
default_label
)
return
default_label
if
user_id
.
nil?
return
"Unassigned"
if
user_id
==
"0"
...
...
@@ -153,4 +180,28 @@ module IssuablesHelper
hexdigest
([
'issuables_count'
,
issuable_type
,
opts
.
sort
].
flatten
.
join
(
'-'
))
end
def
issuable_templates
(
issuable
)
@issuable_templates
||=
case
issuable
when
Issue
issue_template_names
when
MergeRequest
merge_request_template_names
else
raise
'Unknown issuable type!'
end
end
def
merge_request_template_names
@merge_request_templates
||=
Gitlab
::
Template
::
MergeRequestTemplate
.
dropdown_names
(
ref_project
)
end
def
issue_template_names
@issue_templates
||=
Gitlab
::
Template
::
IssueTemplate
.
dropdown_names
(
ref_project
)
end
def
selected_template
(
issuable
)
params
[
:issuable_template
]
if
issuable_templates
(
issuable
).
include?
(
params
[
:issuable_template
])
end
end
app/views/shared/issuable/_form.html.haml
View file @
a6218748
-
project
=
@target_project
||
@project
=
form_errors
(
issuable
)
-
if
@conflict
...
...
@@ -11,23 +12,9 @@
.form-group
=
f
.
label
:title
,
class:
'control-label'
-
issuable_template_names
=
issuable_templates
(
issuable
)
-
if
issuable_template_names
.
any?
.col-sm-3.col-lg-2
.js-issuable-selector-wrap
{
data:
{
issuable_type:
issuable
.
class
.
to_s
.
underscore
.
downcase
}
}
-
title
=
selected_template
(
issuable
)
||
"Choose a template"
=
dropdown_tag
(
title
,
options:
{
toggle_class:
'js-issuable-selector'
,
title:
title
,
filter:
true
,
placeholder:
'Filter'
,
footer_content:
true
,
data:
{
data:
issuable_template_names
,
field_name:
'issuable_template'
,
selected:
selected_template
(
issuable
),
project_path:
ref_project
.
path
,
namespace_path:
ref_project
.
namespace
.
path
}
}
)
do
%ul
.dropdown-footer-list
%li
%a
.no-template
No template
%a
.reset-template
Reset template
%div
{
class:
issuable_template_names
.
any?
?
'col-sm-7 col-lg-8'
:
'col-sm-10'
}
=
render
'shared/issuable/form/template_selector'
,
issuable:
issuable
%div
{
class:
issuable_templates
(
issuable
).
any?
?
'col-sm-7 col-lg-8'
:
'col-sm-10'
}
=
f
.
text_field
:title
,
maxlength:
255
,
autofocus:
true
,
autocomplete:
'off'
,
class:
'form-control pad'
,
required:
true
...
...
app/views/shared/issuable/form/_template_selector.html.haml
0 → 100644
View file @
a6218748
-
issuable
=
local_assigns
.
fetch
(
:issuable
,
nil
)
-
return
unless
issuable
&&
issuable_templates
(
issuable
).
any?
.col-sm-3.col-lg-2
.js-issuable-selector-wrap
{
data:
{
issuable_type:
issuable
.
to_ability_name
}
}
=
template_dropdown_tag
(
issuable
)
do
%ul
.dropdown-footer-list
%li
%a
.no-template
No template
%a
.reset-template
Reset template
changelogs/unreleased-ee/1118-fix-approvals-api-documentation.yml
0 → 100644
View file @
a6218748
---
title
:
Fix Approvals API documentation
merge_request
:
author
:
doc/api/merge_requests.md
View file @
a6218748
...
...
@@ -610,7 +610,7 @@ POST /projects/:id/merge_requests/:merge_request_id/approve
"updated_at"
:
"2016-06-09T21:32:14.105Z"
,
"merge_status"
:
"can_be_merged"
,
"approvals_required"
:
2
,
"approvals_
missing
"
:
0
,
"approvals_
left
"
:
0
,
"approved_by"
:
[
{
"user"
:
{
...
...
spec/requests/api/merge_requests_spec.rb
View file @
a6218748
...
...
@@ -702,12 +702,18 @@ describe API::API, api: true do
describe
'GET :id/merge_requests/:merge_request_id/approvals'
do
it
'retrieves the approval status'
do
approver
=
create
:user
project
.
update_attribute
(
:approvals_before_merge
,
2
)
project
.
team
<<
[
approver
,
:developer
]
project
.
team
<<
[
create
(
:user
),
:developer
]
merge_request
.
approvals
.
create
(
user:
approver
)
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/approvals"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'approvals_required'
]).
to
eq
2
expect
(
json_response
[
'approvals_left'
]).
to
eq
1
expect
(
json_response
[
'approved_by'
][
0
][
'user'
][
'username'
]).
to
eq
(
approver
.
username
)
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