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
f1f0722f
Commit
f1f0722f
authored
Apr 06, 2017
by
Simon Knox
Committed by
Jose Ivan Vargas
Apr 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add approvers count to heading. change select2 style to match droplab
fix test and lint
parent
0a63d613
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
53 additions
and
30 deletions
+53
-30
app/assets/javascripts/approvers_select.js
app/assets/javascripts/approvers_select.js
+22
-5
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+2
-0
app/assets/javascripts/project_new.js
app/assets/javascripts/project_new.js
+0
-5
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+1
-1
app/assets/stylesheets/framework/selects.scss
app/assets/stylesheets/framework/selects.scss
+8
-6
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+1
-1
app/views/projects/ee/_merge_request_settings.html.haml
app/views/projects/ee/_merge_request_settings.html.haml
+9
-2
spec/features/projects/settings/ee/merge_requests_settings_spec.rb
...ures/projects/settings/ee/merge_requests_settings_spec.rb
+7
-7
spec/javascripts/project_new_spec.js
spec/javascripts/project_new_spec.js
+3
-3
No files found.
app/assets/javascripts/approvers_select.js
View file @
f1f0722f
...
@@ -25,7 +25,22 @@ export default class ApproversSelect {
...
@@ -25,7 +25,22 @@ export default class ApproversSelect {
},
},
formatResult
:
ApproversSelect
.
formatResult
,
formatResult
:
ApproversSelect
.
formatResult
,
formatSelection
:
ApproversSelect
.
formatSelection
,
formatSelection
:
ApproversSelect
.
formatSelection
,
dropdownCssClass
:
'
ajax-groups-dropdown
'
,
dropdownCss
()
{
const
$input
=
$
(
'
.js-select-user-and-group .select2-input
'
);
const
offset
=
$input
.
offset
();
const
inputRight
=
offset
.
left
+
$input
.
outerWidth
();
const
$dropdown
=
$
(
'
.select2-drop-active
'
);
let
left
=
offset
.
left
;
if
(
$dropdown
.
outerWidth
()
>
$input
.
outerWidth
())
{
left
=
`
${
inputRight
-
$dropdown
.
width
()}
px`
;
}
return
{
left
,
right
:
'
auto
'
,
width
:
'
auto
'
,
};
},
})
})
.
on
(
'
change
'
,
this
.
handleSelectChange
);
.
on
(
'
change
'
,
this
.
handleSelectChange
);
}
}
...
@@ -105,11 +120,13 @@ export default class ApproversSelect {
...
@@ -105,11 +120,13 @@ export default class ApproversSelect {
return
`
return
`
<div class="user-result">
<div class="user-result">
<div class="user-image">
<div class="user-image">
<img class="avatar s
24
" src="
${
avatar
}
">
<img class="avatar s
40
" src="
${
avatar
}
">
</div>
</div>
<div class="user-info">
<div class="user-name">
${
name
}
</div>
<div class="user-name">
${
name
}
</div>
<div class="user-username">@
${
username
}
</div>
<div class="user-username">@
${
username
}
</div>
</div>
</div>
</div>
`
;
`
;
}
}
...
@@ -174,6 +191,6 @@ export default class ApproversSelect {
...
@@ -174,6 +191,6 @@ export default class ApproversSelect {
}
}
static
updateApproverList
(
html
)
{
static
updateApproverList
(
html
)
{
$
(
'
.
approver-list
'
).
html
(
$
(
html
).
find
(
'
.approver-list
'
).
html
());
$
(
'
.
js-current-approvers
'
).
html
(
$
(
html
).
find
(
'
.js-current-approvers
'
).
html
());
}
}
}
}
app/assets/javascripts/dispatcher.js
View file @
f1f0722f
...
@@ -43,6 +43,7 @@ import BindInOut from './behaviors/bind_in_out';
...
@@ -43,6 +43,7 @@ import BindInOut from './behaviors/bind_in_out';
import
GroupName
from
'
./group_name
'
;
import
GroupName
from
'
./group_name
'
;
import
GroupsList
from
'
./groups_list
'
;
import
GroupsList
from
'
./groups_list
'
;
import
ProjectsList
from
'
./projects_list
'
;
import
ProjectsList
from
'
./projects_list
'
;
import
ApproversSelect
from
'
./approvers_select
'
;
import
MiniPipelineGraph
from
'
./mini_pipeline_graph_dropdown
'
;
import
MiniPipelineGraph
from
'
./mini_pipeline_graph_dropdown
'
;
import
BlobLinePermalinkUpdater
from
'
./blob/blob_line_permalink_updater
'
;
import
BlobLinePermalinkUpdater
from
'
./blob/blob_line_permalink_updater
'
;
import
BlobForkSuggestion
from
'
./blob/blob_fork_suggestion
'
;
import
BlobForkSuggestion
from
'
./blob/blob_fork_suggestion
'
;
...
@@ -431,6 +432,7 @@ const ShortcutsBlob = require('./shortcuts_blob');
...
@@ -431,6 +432,7 @@ const ShortcutsBlob = require('./shortcuts_blob');
case
'
edit
'
:
case
'
edit
'
:
shortcut_handler
=
new
ShortcutsNavigation
();
shortcut_handler
=
new
ShortcutsNavigation
();
new
ProjectNew
();
new
ProjectNew
();
new
ApproversSelect
();
break
;
break
;
case
'
new
'
:
case
'
new
'
:
new
ProjectNew
();
new
ProjectNew
();
...
...
app/assets/javascripts/project_new.js
View file @
f1f0722f
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-unused-vars, one-var, no-underscore-dangle, prefer-template, no-else-return, prefer-arrow-callback, max-len */
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-unused-vars, one-var, no-underscore-dangle, prefer-template, no-else-return, prefer-arrow-callback, max-len */
/* global Api */
import
ApproversSelect
from
'
./approvers_select
'
;
(
function
()
{
(
function
()
{
this
.
ProjectNew
=
(
function
()
{
this
.
ProjectNew
=
(
function
()
{
...
@@ -22,8 +19,6 @@ import ApproversSelect from './approvers_select';
...
@@ -22,8 +19,6 @@ import ApproversSelect from './approvers_select';
this
.
toggleSettings
();
this
.
toggleSettings
();
this
.
addEvents
();
this
.
addEvents
();
this
.
toggleRepoVisibility
();
this
.
toggleRepoVisibility
();
this
.
approversSelect
=
new
ApproversSelect
();
}
}
ProjectNew
.
prototype
.
bindEvents
=
function
()
{
ProjectNew
.
prototype
.
bindEvents
=
function
()
{
...
...
app/assets/javascripts/users_select.js
View file @
f1f0722f
...
@@ -388,7 +388,7 @@ import Vue from 'vue';
...
@@ -388,7 +388,7 @@ import Vue from 'vue';
}
else
{
}
else
{
avatar
=
gon
.
default_avatar_url
;
avatar
=
gon
.
default_avatar_url
;
}
}
return
"
<div class='user-result
"
+
(
!
user
.
username
?
'
no-username
'
:
void
0
)
+
"
'> <div class='user-image'><img class='avatar s
24' src='
"
+
avatar
+
"
'></div> <div class='user-name'>
"
+
user
.
name
+
"
</div> <div class='user-username'>
"
+
(
user
.
username
||
""
)
+
"
</div> </div>
"
;
return
"
<div class='user-result
"
+
(
!
user
.
username
?
'
no-username
'
:
void
0
)
+
"
'> <div class='user-image'><img class='avatar s
40' src='
"
+
avatar
+
"
'></div> <div><div class='user-name'>
"
+
user
.
name
+
"
</div> <div class='user-username'>
"
+
(
user
.
username
||
""
)
+
"
</div>
</div> </div>
"
;
};
};
UsersSelect
.
prototype
.
formatSelection
=
function
(
user
)
{
UsersSelect
.
prototype
.
formatSelection
=
function
(
user
)
{
...
...
app/assets/stylesheets/framework/selects.scss
View file @
f1f0722f
...
@@ -47,9 +47,10 @@
...
@@ -47,9 +47,10 @@
}
}
.select2-drop
{
.select2-drop
{
box-shadow
:
$select2-drop-shadow1
0
0
1px
0
,
$select2-drop-shadow2
0
2px
18px
0
;
background-color
:
$white-light
;
border-radius
:
$border-radius-default
;
border
:
1px
solid
$dropdown-border-color
;
border
:
none
;
border-radius
:
$border-radius-base
;
box-shadow
:
0
2px
4px
$dropdown-shadow-color
;
min-width
:
175px
;
min-width
:
175px
;
}
}
...
@@ -63,7 +64,7 @@
...
@@ -63,7 +64,7 @@
}
}
.select2-highlighted
{
.select2-highlighted
{
background
:
$
gl-link
-color
!
important
;
background
:
$
dropdown-hover
-color
!
important
;
}
}
.select2-results
li
.select2-result-with-children
>
.select2-result-label
{
.select2-results
li
.select2-result-with-children
>
.select2-result-label
{
...
@@ -124,8 +125,8 @@
...
@@ -124,8 +125,8 @@
&
.select2-container-active
.select2-choices
,
&
.select2-container-active
.select2-choices
,
&
.select2-dropdown-open
.select2-choices
{
&
.select2-dropdown-open
.select2-choices
{
border-color
:
$
border-white-normal
;
border-color
:
$
dropdown-input-focus-border
;
box-shadow
:
$gl-btn-active-gradient
;
box-shadow
:
0
0
4px
$search-input-focus-shadow-color
;
}
}
}
}
...
@@ -237,6 +238,7 @@
...
@@ -237,6 +238,7 @@
.user-result
{
.user-result
{
min-height
:
24px
;
min-height
:
24px
;
display
:
flex
;
.user-image
{
.user-image
{
float
:
left
;
float
:
left
;
...
...
app/assets/stylesheets/pages/projects.scss
View file @
f1f0722f
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
.load-wrapper
{
.load-wrapper
{
position
:
absolute
;
position
:
absolute
;
background
:
rgba
(
33
,
33
,
33
,
0
.2
)
;
background
:
$black-transparent
;
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
display
:
flex
;
display
:
flex
;
...
...
app/views/projects/ee/_merge_request_settings.html.haml
View file @
f1f0722f
...
@@ -64,11 +64,18 @@
...
@@ -64,11 +64,18 @@
.help-block
.help-block
Add an approver or group suggestion for each merge request
Add an approver or group suggestion for each merge request
.panel.panel-default.prepend-top-10
.panel.panel-default.prepend-top-10
.js-current-approvers
.panel-heading
.panel-heading
Approvers
Approvers
%span
.badge
%span
.badge
-# TODO: badge with project.approver_group_ids.count + project.approver_ids.count
-
ids
=
[]
-
project
.
approvers
.
each
do
|
user
|
-
ids
<<
user
.
user_id
-
project
.
approver_groups
.
each
do
|
group
|
-
group
.
users
.
each
do
|
user
|
-
unless
ids
.
include?
(
user
.
id
)
-
ids
<<
user
.
id
=
ids
.
count
%ul
.well-list.approver-list
%ul
.well-list.approver-list
.load-wrapper.hidden
.load-wrapper.hidden
=
icon
(
'spinner spin'
,
class:
'approver-list-loader'
)
=
icon
(
'spinner spin'
,
class:
'approver-list-loader'
)
...
...
spec/features/projects/settings/ee/merge_requests_settings_spec.rb
View file @
f1f0722f
...
@@ -5,7 +5,7 @@ describe 'Project settings > [EE] Merge Requests', feature: true, js: true do
...
@@ -5,7 +5,7 @@ describe 'Project settings > [EE] Merge Requests', feature: true, js: true do
include
WaitForAjax
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
,
approvals_before_merge:
1
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:approver
)
{
create
(
:user
)
}
let
(
:approver
)
{
create
(
:user
)
}
...
@@ -19,17 +19,17 @@ describe 'Project settings > [EE] Merge Requests', feature: true, js: true do
...
@@ -19,17 +19,17 @@ describe 'Project settings > [EE] Merge Requests', feature: true, js: true do
scenario
'adds approver group'
do
scenario
'adds approver group'
do
visit
edit_project_path
(
project
)
visit
edit_project_path
(
project
)
find
(
'#s2id_
project_approver
_group_ids .select2-input'
).
click
find
(
'#s2id_
approver_user_and
_group_ids .select2-input'
).
click
wait_for_ajax
wait_for_ajax
expect
(
find
(
'.select2-results'
)).
to
have_content
(
group
.
name
)
expect
(
find
(
'.select2-results'
)).
to
have_content
(
group
.
name
)
find
(
'.select2-results'
).
click
find
(
'.select2-results
.group-result
'
).
click
click_button
'Save changes'
click_button
'Save changes'
expect
(
page
).
to
have_css
(
'.
approver-list
li.approver-group'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.
js-current-approvers
li.approver-group'
,
count:
1
)
end
end
context
'with an approver group'
do
context
'with an approver group'
do
...
@@ -40,13 +40,13 @@ describe 'Project settings > [EE] Merge Requests', feature: true, js: true do
...
@@ -40,13 +40,13 @@ describe 'Project settings > [EE] Merge Requests', feature: true, js: true do
scenario
'removes approver group'
do
scenario
'removes approver group'
do
visit
edit_project_path
(
project
)
visit
edit_project_path
(
project
)
expect
(
find
(
'.
approver-list
'
)).
to
have_content
(
group
.
name
)
expect
(
find
(
'.
js-current-approvers
'
)).
to
have_content
(
group
.
name
)
within
(
'.
approver-list
'
)
do
within
(
'.
js-current-approvers
'
)
do
click_on
"Remove"
click_on
"Remove"
end
end
expect
(
find
(
'.
approver-list
'
)).
not_to
have_content
(
group
.
name
)
expect
(
find
(
'.
js-current-approvers
'
)).
not_to
have_content
(
group
.
name
)
end
end
end
end
end
end
spec/javascripts/
approvers_select
_spec.js
→
spec/javascripts/
project_new
_spec.js
View file @
f1f0722f
import
ApproversSelect
from
'
~/approvers_select
'
;
require
(
'
~/project_new
'
)
;
describe
(
'
ApproversSelect
'
,
function
()
{
describe
(
'
ApproversSelect
'
,
function
()
{
const
projectSettingsTemplate
=
'
projects/edit.html.raw
'
;
const
projectSettingsTemplate
=
'
projects/edit.html.raw
'
;
...
@@ -7,7 +7,7 @@ describe('ApproversSelect', function () {
...
@@ -7,7 +7,7 @@ describe('ApproversSelect', function () {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
loadFixtures
(
projectSettingsTemplate
);
loadFixtures
(
projectSettingsTemplate
);
this
.
$requireApprovalsToggle
=
$
(
'
.js-require-approvals-toggle
'
);
this
.
$requireApprovalsToggle
=
$
(
'
.js-require-approvals-toggle
'
);
this
.
project
=
new
ApproversSelect
();
this
.
project
=
new
window
.
ProjectNew
();
});
});
it
(
'
shows approver settings if enabled
'
,
()
=>
{
it
(
'
shows approver settings if enabled
'
,
()
=>
{
...
@@ -15,7 +15,7 @@ describe('ApproversSelect', function () {
...
@@ -15,7 +15,7 @@ describe('ApproversSelect', function () {
expect
(
$
(
'
.nested-settings
'
).
hasClass
(
'
hidden
'
)).
toBe
(
true
);
expect
(
$
(
'
.nested-settings
'
).
hasClass
(
'
hidden
'
)).
toBe
(
true
);
this
.
$requireApprovalsToggle
.
click
();
this
.
$requireApprovalsToggle
.
click
();
expect
(
$
(
'
.
nested-setting
s
'
).
hasClass
(
'
hidden
'
)).
toBe
(
false
);
expect
(
$
(
'
.
js-current-approver
s
'
).
hasClass
(
'
hidden
'
)).
toBe
(
false
);
});
});
it
(
'
hides approver settings if disabled
'
,
()
=>
{
it
(
'
hides approver settings if disabled
'
,
()
=>
{
...
...
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