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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
b3100589
Commit
b3100589
authored
Mar 29, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new dropdowns for MR compare
parent
7fe19046
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
32 deletions
+82
-32
app/assets/javascripts/compare.js.coffee
app/assets/javascripts/compare.js.coffee
+22
-21
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+1
-1
app/assets/stylesheets/pages/merge_requests.scss
app/assets/stylesheets/pages/merge_requests.scss
+10
-0
app/views/projects/merge_requests/_new_compare.html.haml
app/views/projects/merge_requests/_new_compare.html.haml
+47
-8
features/steps/project/source/browse_files.rb
features/steps/project/source/browse_files.rb
+2
-2
No files found.
app/assets/javascripts/compare.js.coffee
View file @
b3100589
...
...
@@ -2,26 +2,27 @@ class @Compare
constructor
:
(
@
opts
)
->
@
source_loading
=
$
".js-source-loading"
@
target_loading
=
$
".js-target-loading"
@
source_branch
=
$
"#merge_request_source_branch"
@
target_branch
=
$
"#merge_request_target_branch"
@
target_project
=
$
"#merge_request_target_project_id"
@
initialState
()
@
cleanBinding
()
@
addBinding
()
$
(
'.js-compare-dropdown'
).
each
(
i
,
dropdown
)
=>
$dropdown
=
$
(
dropdown
)
cleanBinding
:
->
@
source_branch
.
off
"change"
@
target_branch
.
off
"change"
@
target_project
.
off
"change"
$dropdown
.
glDropdown
(
selectable
:
true
fieldName
:
$dropdown
.
data
'field-name'
id
:
(
obj
,
$el
)
->
$el
.
data
'id'
toggleLabel
:
(
obj
,
$el
)
->
$el
.
text
().
trim
()
clicked
:
(
e
,
el
)
=>
if
$dropdown
.
is
'.js-target-branch'
@
getTargetHtml
()
else
if
$dropdown
.
is
'.js-source-branch'
@
getSourceHtml
()
else
if
$dropdown
.
is
'.js-target-project'
@
getTargetProject
()
)
addBinding
:
->
@
source_branch
.
on
"change"
,
=>
@
getSourceHtml
()
@
target_branch
.
on
"change"
,
=>
@
getTargetHtml
()
@
target_project
.
on
"change"
,
=>
@
getTargetProject
()
@
initialState
()
initialState
:
->
@
getSourceHtml
()
...
...
@@ -29,13 +30,13 @@ class @Compare
getTargetProject
:
->
$
.
get
@
opts
.
targetProjectUrl
,
target_project_id
:
@
target_project
.
val
()
target_project_id
:
$
(
"input[name='merge_request[source_project]']"
)
.
val
()
getSourceHtml
:
->
$
.
ajax
(
url
:
@
opts
.
sourceBranchUrl
data
:
ref
:
@
source_branch
.
val
()
ref
:
$
(
"input[name='merge_request[source_branch]']"
)
.
val
()
beforeSend
:
=>
@
source_loading
.
show
()
$
(
".mr_source_commit"
).
html
""
...
...
@@ -49,8 +50,8 @@ class @Compare
$
.
ajax
(
url
:
@
opts
.
targetBranchUrl
data
:
target_project_id
:
@
target_project
.
val
()
ref
:
@
target_branch
.
val
()
target_project_id
:
$
(
"input[name='merge_request[target_project_id]']"
)
.
val
()
ref
:
$
(
"input[name='merge_request[target_branch]']"
)
.
val
()
beforeSend
:
=>
@
target_loading
.
show
()
$
(
".mr_target_commit"
).
html
""
...
...
app/assets/javascripts/gl_dropdown.js.coffee
View file @
b3100589
...
...
@@ -373,7 +373,7 @@ class GitLabDropdown
# Toggle the dropdown label
if
@
options
.
toggleLabel
$
(
@
el
).
find
(
".dropdown-toggle-text"
).
text
@
options
.
toggleLabel
(
selectedObject
)
$
(
@
el
).
find
(
".dropdown-toggle-text"
).
text
@
options
.
toggleLabel
(
selectedObject
,
el
)
if
value
?
if
!
field
.
length
# Create hidden input for form
...
...
app/assets/stylesheets/pages/merge_requests.scss
View file @
b3100589
...
...
@@ -242,4 +242,14 @@
width
:
50%
;
padding-left
:
5px
;
padding-right
:
5px
;
.dropdown-menu-toggle
{
width
:
100%
;
}
.dropdown-menu
{
left
:
5px
;
right
:
5px
;
width
:
auto
;
}
}
app/views/projects/merge_requests/_new_compare.html.haml
View file @
b3100589
...
...
@@ -9,10 +9,29 @@
.panel-heading
Source branch
.panel-body.clearfix
.merge-request-select
=
f
.
select
(
:source_project_id
,
[[
@merge_request
.
source_project_path
,
@merge_request
.
source_project
.
id
]]
,
{},
{
class:
'source_project select2'
,
disabled:
@merge_request
.
persisted?
,
required:
true
})
.merge-request-select
=
f
.
select
(
:source_branch
,
@merge_request
.
source_branches
,
{
include_blank:
true
},
{
class:
'source_branch select2'
,
required:
true
,
data:
{
placeholder:
"Select source branch"
}
})
.merge-request-select.dropdown
=
f
.
hidden_field
:source_project_id
=
dropdown_toggle
@merge_request
.
source_project_path
,
{
toggle:
"dropdown"
,
field_name:
"
#{
f
.
object_name
}
[source_project_id]"
,
disabled:
@merge_request
.
persisted?
},
{
toggle_class:
"js-compare-dropdown js-source-project"
}
.dropdown-menu
=
dropdown_title
(
"Select source project"
)
=
dropdown_filter
(
"Search projects"
)
=
dropdown_content
do
%ul
%li
%a
{
href:
"#"
,
data:
{
id:
@merge_request
.
source_project
.
id
}
}
=
@merge_request
.
source_project_path
.merge-request-select.dropdown
=
f
.
hidden_field
:source_branch
=
dropdown_toggle
"Select source branch"
,
{
toggle:
"dropdown"
,
field_name:
"
#{
f
.
object_name
}
[source_branch]"
},
{
toggle_class:
"js-compare-dropdown js-source-branch"
}
.dropdown-menu
=
dropdown_title
(
"Select source branch"
)
=
dropdown_filter
(
"Search branches"
)
=
dropdown_content
do
%ul
-
@merge_request
.
source_branches
.
each
do
|
branch
|
%li
%a
{
href:
"#"
,
data:
{
id:
branch
}
}
=
branch
.panel-footer
=
icon
(
'spinner spin'
,
class:
"js-source-loading"
)
%ul
.list-unstyled.mr_source_commit
...
...
@@ -23,10 +42,30 @@
Target branch
.panel-body.clearfix
-
projects
=
@project
.
forked_from_project
.
nil?
?
[
@project
]
:
[
@project
,
@project
.
forked_from_project
]
.merge-request-select
=
f
.
select
(
:target_project_id
,
options_from_collection_for_select
(
projects
,
'id'
,
'path_with_namespace'
,
f
.
object
.
target_project_id
),
{},
{
class:
'target_project select2'
,
disabled:
@merge_request
.
persisted?
,
required:
true
})
.merge-request-select
=
f
.
select
(
:target_branch
,
@merge_request
.
target_branches
,
{
include_blank:
true
},
{
class:
'target_branch select2'
,
required:
true
,
data:
{
placeholder:
"Select target branch"
}
})
.merge-request-select.dropdown
=
f
.
hidden_field
:target_project_id
=
dropdown_toggle
projects
.
first
.
path_with_namespace
,
{
toggle:
"dropdown"
,
field_name:
"
#{
f
.
object_name
}
[target_project_id]"
,
disabled:
@merge_request
.
persisted?
},
{
toggle_class:
"js-compare-dropdown js-target-project"
}
.dropdown-menu
=
dropdown_title
(
"Select target project"
)
=
dropdown_filter
(
"Search projects"
)
=
dropdown_content
do
%ul
-
projects
.
each
do
|
project
|
%li
%a
{
href:
"#"
}
=
project
.
path_with_namespace
.merge-request-select.dropdown
=
f
.
hidden_field
:target_branch
=
dropdown_toggle
"Select target branch"
,
{
toggle:
"dropdown"
,
field_name:
"
#{
f
.
object_name
}
[target_branch]"
},
{
toggle_class:
"js-compare-dropdown js-target-branch"
}
.dropdown-menu.dropdown-menu-selectable
=
dropdown_title
(
"Select target branch"
)
=
dropdown_filter
(
"Search branches"
)
=
dropdown_content
do
%ul
-
@merge_request
.
target_branches
.
each
do
|
branch
|
%li
%a
{
href:
"#"
,
class:
"#{("
is
-
active
" if :target_branch == branch)}"
,
data:
{
id:
branch
}
}
=
branch
.panel-footer
=
icon
(
'spinner spin'
,
class:
"js-target-loading"
)
%ul
.list-unstyled.mr_target_commit
...
...
features/steps/project/source/browse_files.rb
View file @
b3100589
...
...
@@ -218,8 +218,8 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
step
'I see Browse code link'
do
expect
(
page
).
to
have_link
'Browse Files
»
'
expect
(
page
).
not_to
have_link
'Browse File
»
'
expect
(
page
).
to
have_link
'Browse Files'
expect
(
page
).
not_to
have_link
'Browse File'
expect
(
page
).
not_to
have_link
'Browse Directory »'
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