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
b38c74d6
Commit
b38c74d6
authored
Jun 08, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert 'New file from interface on existing branch'
parent
ce37a209
Changes
28
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
24 additions
and
720 deletions
+24
-720
app/assets/javascripts/blob/blob_file_dropzone.js
app/assets/javascripts/blob/blob_file_dropzone.js
+1
-1
app/assets/javascripts/blob/create_branch_dropdown.js
app/assets/javascripts/blob/create_branch_dropdown.js
+0
-88
app/assets/javascripts/blob/target_branch_dropdown.js
app/assets/javascripts/blob/target_branch_dropdown.js
+0
-152
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+0
-11
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-4
app/assets/javascripts/new_commit_form.js
app/assets/javascripts/new_commit_form.js
+4
-7
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+1
-2
app/controllers/concerns/creates_commit.rb
app/controllers/concerns/creates_commit.rb
+0
-5
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+0
-2
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+1
-6
app/controllers/projects/tree_controller.rb
app/controllers/projects/tree_controller.rb
+0
-1
app/views/projects/blob/_remove.html.haml
app/views/projects/blob/_remove.html.haml
+2
-2
app/views/projects/commit/_change.html.haml
app/views/projects/commit/_change.html.haml
+5
-9
app/views/shared/_branch_switcher.html.haml
app/views/shared/_branch_switcher.html.haml
+0
-8
app/views/shared/_new_commit_form.html.haml
app/views/shared/_new_commit_form.html.haml
+1
-1
app/views/shared/projects/blob/_branch_page_create.html.haml
app/views/shared/projects/blob/_branch_page_create.html.haml
+0
-8
app/views/shared/projects/blob/_branch_page_default.html.haml
...views/shared/projects/blob/_branch_page_default.html.haml
+0
-10
changelogs/unreleased/dm-revert-mr-8427.yml
changelogs/unreleased/dm-revert-mr-8427.yml
+4
-0
features/steps/project/source/browse_files.rb
features/steps/project/source/browse_files.rb
+1
-4
spec/controllers/projects/branches_controller_spec.rb
spec/controllers/projects/branches_controller_spec.rb
+0
-14
spec/features/projects/blobs/edit_spec.rb
spec/features/projects/blobs/edit_spec.rb
+3
-3
spec/features/projects/blobs/user_create_spec.rb
spec/features/projects/blobs/user_create_spec.rb
+0
-94
spec/features/projects/user_create_dir_spec.rb
spec/features/projects/user_create_dir_spec.rb
+1
-15
spec/javascripts/blob/create_branch_dropdown_spec.js
spec/javascripts/blob/create_branch_dropdown_spec.js
+0
-106
spec/javascripts/blob/target_branch_dropdown_spec.js
spec/javascripts/blob/target_branch_dropdown_spec.js
+0
-118
spec/javascripts/fixtures/project_branches.json
spec/javascripts/fixtures/project_branches.json
+0
-5
spec/javascripts/fixtures/target_branch_dropdown.html.haml
spec/javascripts/fixtures/target_branch_dropdown.html.haml
+0
-28
spec/support/target_branch_helpers.rb
spec/support/target_branch_helpers.rb
+0
-16
No files found.
app/assets/javascripts/blob/blob_file_dropzone.js
View file @
b38c74d6
...
@@ -35,7 +35,7 @@ export default class BlobFileDropzone {
...
@@ -35,7 +35,7 @@ export default class BlobFileDropzone {
this
.
removeFile
(
file
);
this
.
removeFile
(
file
);
});
});
this
.
on
(
'
sending
'
,
function
(
file
,
xhr
,
formData
)
{
this
.
on
(
'
sending
'
,
function
(
file
,
xhr
,
formData
)
{
formData
.
append
(
'
branch_name
'
,
form
.
find
(
'
input[name="branch_name"]
'
).
val
());
formData
.
append
(
'
branch_name
'
,
form
.
find
(
'
.js-branch-name
'
).
val
());
formData
.
append
(
'
create_merge_request
'
,
form
.
find
(
'
.js-create-merge-request
'
).
val
());
formData
.
append
(
'
create_merge_request
'
,
form
.
find
(
'
.js-create-merge-request
'
).
val
());
formData
.
append
(
'
commit_message
'
,
form
.
find
(
'
.js-commit-message
'
).
val
());
formData
.
append
(
'
commit_message
'
,
form
.
find
(
'
.js-commit-message
'
).
val
());
});
});
...
...
app/assets/javascripts/blob/create_branch_dropdown.js
deleted
100644 → 0
View file @
ce37a209
class
CreateBranchDropdown
{
constructor
(
el
,
targetBranchDropdown
)
{
this
.
targetBranchDropdown
=
targetBranchDropdown
;
this
.
el
=
el
;
this
.
dropdownBack
=
this
.
el
.
closest
(
'
.dropdown
'
).
querySelector
(
'
.dropdown-menu-back
'
);
this
.
cancelButton
=
this
.
el
.
querySelector
(
'
.js-cancel-branch-btn
'
);
this
.
newBranchField
=
this
.
el
.
querySelector
(
'
#new_branch_name
'
);
this
.
newBranchCreateButton
=
this
.
el
.
querySelector
(
'
.js-new-branch-btn
'
);
this
.
newBranchCreateButton
.
setAttribute
(
'
disabled
'
,
''
);
this
.
addBindings
();
this
.
cleanupWrapper
=
this
.
cleanup
.
bind
(
this
);
document
.
addEventListener
(
'
beforeunload
'
,
this
.
cleanupWrapper
);
}
cleanup
()
{
this
.
cleanBindings
();
document
.
removeEventListener
(
'
beforeunload
'
,
this
.
cleanupWrapper
);
}
cleanBindings
()
{
this
.
newBranchField
.
removeEventListener
(
'
keyup
'
,
this
.
enableBranchCreateButtonWrapper
);
this
.
newBranchField
.
removeEventListener
(
'
change
'
,
this
.
enableBranchCreateButtonWrapper
);
this
.
newBranchField
.
removeEventListener
(
'
keydown
'
,
this
.
handleNewBranchKeydownWrapper
);
this
.
dropdownBack
.
removeEventListener
(
'
click
'
,
this
.
resetFormWrapper
);
this
.
cancelButton
.
removeEventListener
(
'
click
'
,
this
.
handleCancelClickWrapper
);
this
.
newBranchCreateButton
.
removeEventListener
(
'
click
'
,
this
.
createBranchWrapper
);
}
addBindings
()
{
this
.
enableBranchCreateButtonWrapper
=
this
.
enableBranchCreateButton
.
bind
(
this
);
this
.
handleNewBranchKeydownWrapper
=
this
.
handleNewBranchKeydown
.
bind
(
this
);
this
.
resetFormWrapper
=
this
.
resetForm
.
bind
(
this
);
this
.
handleCancelClickWrapper
=
this
.
handleCancelClick
.
bind
(
this
);
this
.
createBranchWrapper
=
this
.
createBranch
.
bind
(
this
);
this
.
newBranchField
.
addEventListener
(
'
keyup
'
,
this
.
enableBranchCreateButtonWrapper
);
this
.
newBranchField
.
addEventListener
(
'
change
'
,
this
.
enableBranchCreateButtonWrapper
);
this
.
newBranchField
.
addEventListener
(
'
keydown
'
,
this
.
handleNewBranchKeydownWrapper
);
this
.
dropdownBack
.
addEventListener
(
'
click
'
,
this
.
resetFormWrapper
);
this
.
cancelButton
.
addEventListener
(
'
click
'
,
this
.
handleCancelClickWrapper
);
this
.
newBranchCreateButton
.
addEventListener
(
'
click
'
,
this
.
createBranchWrapper
);
}
handleCancelClick
(
e
)
{
e
.
preventDefault
();
e
.
stopPropagation
();
this
.
resetForm
();
this
.
dropdownBack
.
click
();
}
handleNewBranchKeydown
(
e
)
{
const
keyCode
=
e
.
which
;
const
ENTER_KEYCODE
=
13
;
if
(
keyCode
===
ENTER_KEYCODE
)
{
this
.
createBranch
(
e
);
}
}
enableBranchCreateButton
()
{
if
(
this
.
newBranchField
.
value
!==
''
)
{
this
.
newBranchCreateButton
.
removeAttribute
(
'
disabled
'
);
}
else
{
this
.
newBranchCreateButton
.
setAttribute
(
'
disabled
'
,
''
);
}
}
resetForm
()
{
this
.
newBranchField
.
value
=
''
;
this
.
enableBranchCreateButtonWrapper
();
}
createBranch
(
e
)
{
e
.
preventDefault
();
if
(
this
.
newBranchCreateButton
.
getAttribute
(
'
disabled
'
)
===
''
)
{
return
;
}
const
newBranchName
=
this
.
newBranchField
.
value
;
this
.
targetBranchDropdown
.
setNewBranch
(
newBranchName
);
this
.
resetForm
();
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
CreateBranchDropdown
=
CreateBranchDropdown
;
app/assets/javascripts/blob/target_branch_dropdown.js
deleted
100644 → 0
View file @
ce37a209
/* eslint-disable class-methods-use-this */
const
SELECT_ITEM_MSG
=
'
Select
'
;
class
TargetBranchDropDown
{
constructor
(
dropdown
)
{
this
.
dropdown
=
dropdown
;
this
.
$dropdown
=
$
(
dropdown
);
this
.
fieldName
=
this
.
dropdown
.
getAttribute
(
'
data-field-name
'
);
this
.
form
=
this
.
dropdown
.
closest
(
'
form
'
);
this
.
createDropdown
();
}
static
bootstrap
()
{
const
dropdowns
=
document
.
querySelectorAll
(
'
.js-project-branches-dropdown
'
);
[].
forEach
.
call
(
dropdowns
,
dropdown
=>
new
TargetBranchDropDown
(
dropdown
));
}
createDropdown
()
{
const
self
=
this
;
this
.
$dropdown
.
glDropdown
({
selectable
:
true
,
filterable
:
true
,
search
:
{
fields
:
[
'
title
'
],
},
data
:
(
term
,
callback
)
=>
$
.
ajax
({
url
:
self
.
dropdown
.
getAttribute
(
'
data-refs-url
'
),
data
:
{
ref
:
self
.
dropdown
.
getAttribute
(
'
data-ref
'
),
show_all
:
true
,
},
dataType
:
'
json
'
,
}).
done
(
refs
=>
callback
(
self
.
dropdownData
(
refs
))),
toggleLabel
(
item
,
el
)
{
if
(
el
.
is
(
'
.is-active
'
))
{
return
item
.
text
;
}
return
SELECT_ITEM_MSG
;
},
clicked
(
options
)
{
options
.
e
.
preventDefault
();
self
.
onClick
.
call
(
self
);
},
fieldName
:
self
.
fieldName
,
});
return
new
gl
.
CreateBranchDropdown
(
this
.
form
.
querySelector
(
'
.dropdown-new-branch
'
),
this
);
}
onClick
()
{
this
.
enableSubmit
();
this
.
$dropdown
.
trigger
(
'
change.branch
'
);
}
enableSubmit
()
{
const
submitBtn
=
this
.
form
.
querySelector
(
'
[type="submit"]
'
);
if
(
this
.
branchInput
&&
this
.
branchInput
.
value
)
{
submitBtn
.
removeAttribute
(
'
disabled
'
);
}
else
{
submitBtn
.
setAttribute
(
'
disabled
'
,
''
);
}
}
dropdownData
(
refs
)
{
const
branchList
=
this
.
dropdownItems
(
refs
);
this
.
cachedRefs
=
refs
;
this
.
addDefaultBranch
(
branchList
);
this
.
addNewBranch
(
branchList
);
return
{
Branches
:
branchList
};
}
dropdownItems
(
refs
)
{
return
refs
.
map
(
this
.
dropdownItem
);
}
dropdownItem
(
ref
)
{
return
{
id
:
ref
,
text
:
ref
,
title
:
ref
};
}
addDefaultBranch
(
branchList
)
{
// when no branch is selected do nothing
if
(
!
this
.
branchInput
)
{
return
;
}
const
branchInputVal
=
this
.
branchInput
.
value
;
const
currentBranchIndex
=
this
.
searchBranch
(
branchList
,
branchInputVal
);
if
(
currentBranchIndex
===
-
1
)
{
this
.
unshiftBranch
(
branchList
,
this
.
dropdownItem
(
branchInputVal
));
}
}
addNewBranch
(
branchList
)
{
if
(
this
.
newBranch
)
{
this
.
unshiftBranch
(
branchList
,
this
.
newBranch
);
}
}
searchBranch
(
branchList
,
branchName
)
{
return
_
.
findIndex
(
branchList
,
el
=>
branchName
===
el
.
id
);
}
unshiftBranch
(
branchList
,
branch
)
{
const
branchIndex
=
this
.
searchBranch
(
branchList
,
branch
.
id
);
if
(
branchIndex
===
-
1
)
{
branchList
.
unshift
(
branch
);
}
}
setNewBranch
(
newBranchName
)
{
this
.
newBranch
=
this
.
dropdownItem
(
newBranchName
);
this
.
refreshData
();
this
.
selectBranch
(
this
.
searchBranch
(
this
.
glDropdown
.
fullData
.
Branches
,
newBranchName
));
}
refreshData
()
{
this
.
glDropdown
.
fullData
=
this
.
dropdownData
(
this
.
cachedRefs
);
this
.
clearFilter
();
}
clearFilter
()
{
// apply an empty filter in order to refresh the data
this
.
glDropdown
.
filter
.
filter
(
''
);
this
.
dropdown
.
closest
(
'
.dropdown
'
).
querySelector
(
'
.dropdown-page-one .dropdown-input-field
'
).
value
=
''
;
}
selectBranch
(
index
)
{
const
branch
=
this
.
dropdown
.
closest
(
'
.dropdown
'
).
querySelectorAll
(
'
li a
'
)[
index
];
if
(
!
branch
.
classList
.
contains
(
'
is-active
'
))
{
branch
.
click
();
}
else
{
this
.
closeDropdown
();
}
}
closeDropdown
()
{
this
.
dropdown
.
closest
(
'
.dropdown
'
).
querySelector
(
'
.dropdown-menu-close
'
).
click
();
}
get
branchInput
()
{
return
this
.
form
.
querySelector
(
`input[name="
${
this
.
fieldName
}
"]`
);
}
get
glDropdown
()
{
return
this
.
$dropdown
.
data
(
'
glDropdown
'
);
}
}
window
.
gl
=
window
.
gl
||
{};
gl
.
TargetBranchDropDown
=
TargetBranchDropDown
;
app/assets/javascripts/dispatcher.js
View file @
b38c74d6
...
@@ -329,25 +329,14 @@ import initSettingsPanels from './settings_panels';
...
@@ -329,25 +329,14 @@ import initSettingsPanels from './settings_panels';
shortcut_handler
=
new
ShortcutsNavigation
();
shortcut_handler
=
new
ShortcutsNavigation
();
new
TreeView
();
new
TreeView
();
new
BlobViewer
();
new
BlobViewer
();
gl
.
TargetBranchDropDown
.
bootstrap
();
break
;
break
;
case
'
projects:find_file:show
'
:
case
'
projects:find_file:show
'
:
shortcut_handler
=
true
;
shortcut_handler
=
true
;
break
;
break
;
case
'
projects:blob:new
'
:
gl
.
TargetBranchDropDown
.
bootstrap
();
break
;
case
'
projects:blob:create
'
:
gl
.
TargetBranchDropDown
.
bootstrap
();
break
;
case
'
projects:blob:show
'
:
case
'
projects:blob:show
'
:
new
BlobViewer
();
new
BlobViewer
();
gl
.
TargetBranchDropDown
.
bootstrap
();
initBlob
();
initBlob
();
break
;
break
;
case
'
projects:blob:edit
'
:
gl
.
TargetBranchDropDown
.
bootstrap
();
break
;
case
'
projects:blame:show
'
:
case
'
projects:blame:show
'
:
initBlob
();
initBlob
();
break
;
break
;
...
...
app/assets/javascripts/main.js
View file @
b38c74d6
...
@@ -39,10 +39,6 @@ import './shortcuts_network';
...
@@ -39,10 +39,6 @@ import './shortcuts_network';
// behaviors
// behaviors
import
'
./behaviors/
'
;
import
'
./behaviors/
'
;
// blob
import
'
./blob/create_branch_dropdown
'
;
import
'
./blob/target_branch_dropdown
'
;
// templates
// templates
import
'
./templates/issuable_template_selector
'
;
import
'
./templates/issuable_template_selector
'
;
import
'
./templates/issuable_template_selectors
'
;
import
'
./templates/issuable_template_selectors
'
;
...
...
app/assets/javascripts/new_commit_form.js
View file @
b38c74d6
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-return-assign, max-len */
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-return-assign, max-len */
(
function
()
{
(
function
()
{
this
.
NewCommitForm
=
(
function
()
{
this
.
NewCommitForm
=
(
function
()
{
function
NewCommitForm
(
form
,
targetBranchName
=
'
target_branch
'
)
{
function
NewCommitForm
(
form
)
{
this
.
form
=
form
;
this
.
form
=
form
;
this
.
targetBranchName
=
targetBranchName
;
this
.
renderDestination
=
this
.
renderDestination
.
bind
(
this
);
this
.
renderDestination
=
this
.
renderDestination
.
bind
(
this
);
this
.
targetBranchDropdown
=
form
.
find
(
'
button.js-target-branch
'
);
this
.
branchName
=
form
.
find
(
'
.js-branch-name
'
);
this
.
originalBranch
=
form
.
find
(
'
.js-original-branch
'
);
this
.
originalBranch
=
form
.
find
(
'
.js-original-branch
'
);
this
.
createMergeRequest
=
form
.
find
(
'
.js-create-merge-request
'
);
this
.
createMergeRequest
=
form
.
find
(
'
.js-create-merge-request
'
);
this
.
createMergeRequestContainer
=
form
.
find
(
'
.js-create-merge-request-container
'
);
this
.
createMergeRequestContainer
=
form
.
find
(
'
.js-create-merge-request-container
'
);
this
.
targetBranchDropdown
.
on
(
'
change.branch
'
,
this
.
renderDestination
);
this
.
branchName
.
keyup
(
this
.
renderDestination
);
this
.
renderDestination
();
this
.
renderDestination
();
}
}
NewCommitForm
.
prototype
.
renderDestination
=
function
()
{
NewCommitForm
.
prototype
.
renderDestination
=
function
()
{
var
different
;
var
different
;
var
targetBranch
=
this
.
form
.
find
(
`input[name="
${
this
.
targetBranchName
}
"]`
);
different
=
this
.
branchName
.
val
()
!==
this
.
originalBranch
.
val
();
different
=
targetBranch
.
val
()
!==
this
.
originalBranch
.
val
();
if
(
different
)
{
if
(
different
)
{
this
.
createMergeRequestContainer
.
show
();
this
.
createMergeRequestContainer
.
show
();
if
(
!
this
.
wasDifferent
)
{
if
(
!
this
.
wasDifferent
)
{
...
...
app/assets/stylesheets/pages/projects.scss
View file @
b38c74d6
...
@@ -769,8 +769,7 @@ pre.light-well {
...
@@ -769,8 +769,7 @@ pre.light-well {
}
}
.project-refs-form
.dropdown-menu
,
.project-refs-form
.dropdown-menu
,
.dropdown-menu-projects
,
.dropdown-menu-projects
{
.dropdown-menu-branches
{
width
:
300px
;
width
:
300px
;
@media
(
min-width
:
$screen-sm-min
)
{
@media
(
min-width
:
$screen-sm-min
)
{
...
...
app/controllers/concerns/creates_commit.rb
View file @
b38c74d6
module
CreatesCommit
module
CreatesCommit
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
def
set_start_branch_to_branch_name
branch_exists
=
@repository
.
find_branch
(
@branch_name
)
@start_branch
=
@branch_name
if
branch_exists
end
def
create_commit
(
service
,
success_path
:,
failure_path
:,
failure_view:
nil
,
success_notice:
nil
)
def
create_commit
(
service
,
success_path
:,
failure_path
:,
failure_view:
nil
,
success_notice:
nil
)
if
can?
(
current_user
,
:push_code
,
@project
)
if
can?
(
current_user
,
:push_code
,
@project
)
@project_to_commit_into
=
@project
@project_to_commit_into
=
@project
...
...
app/controllers/projects/blob_controller.rb
View file @
b38c74d6
...
@@ -26,8 +26,6 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -26,8 +26,6 @@ class Projects::BlobController < Projects::ApplicationController
end
end
def
create
def
create
set_start_branch_to_branch_name
create_commit
(
Files
::
CreateService
,
success_notice:
"The file has been successfully created."
,
create_commit
(
Files
::
CreateService
,
success_notice:
"The file has been successfully created."
,
success_path:
->
{
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@branch_name
,
@file_path
))
},
success_path:
->
{
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@branch_name
,
@file_path
))
},
failure_view: :new
,
failure_view: :new
,
...
...
app/controllers/projects/branches_controller.rb
View file @
b38c74d6
...
@@ -10,10 +10,10 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -10,10 +10,10 @@ class Projects::BranchesController < Projects::ApplicationController
def
index
def
index
@sort
=
params
[
:sort
].
presence
||
sort_value_name
@sort
=
params
[
:sort
].
presence
||
sort_value_name
@branches
=
BranchesFinder
.
new
(
@repository
,
params
).
execute
@branches
=
BranchesFinder
.
new
(
@repository
,
params
).
execute
@branches
=
Kaminari
.
paginate_array
(
@branches
).
page
(
params
[
:page
])
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
paginate_branches
@refs_pipelines
=
@project
.
pipelines
.
latest_successful_for_refs
(
@branches
.
map
(
&
:name
))
@refs_pipelines
=
@project
.
pipelines
.
latest_successful_for_refs
(
@branches
.
map
(
&
:name
))
@max_commits
=
@branches
.
reduce
(
0
)
do
|
memo
,
branch
|
@max_commits
=
@branches
.
reduce
(
0
)
do
|
memo
,
branch
|
...
@@ -22,7 +22,6 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -22,7 +22,6 @@ class Projects::BranchesController < Projects::ApplicationController
end
end
end
end
format
.
json
do
format
.
json
do
paginate_branches
unless
params
[
:show_all
]
render
json:
@branches
.
map
(
&
:name
)
render
json:
@branches
.
map
(
&
:name
)
end
end
end
end
...
@@ -106,10 +105,6 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -106,10 +105,6 @@ class Projects::BranchesController < Projects::ApplicationController
end
end
end
end
def
paginate_branches
@branches
=
Kaminari
.
paginate_array
(
@branches
).
page
(
params
[
:page
])
end
def
url_to_autodeploy_setup
(
project
,
branch_name
)
def
url_to_autodeploy_setup
(
project
,
branch_name
)
namespace_project_new_blob_path
(
namespace_project_new_blob_path
(
project
.
namespace
,
project
.
namespace
,
...
...
app/controllers/projects/tree_controller.rb
View file @
b38c74d6
...
@@ -36,7 +36,6 @@ class Projects::TreeController < Projects::ApplicationController
...
@@ -36,7 +36,6 @@ class Projects::TreeController < Projects::ApplicationController
def
create_dir
def
create_dir
return
render_404
unless
@commit_params
.
values
.
all?
return
render_404
unless
@commit_params
.
values
.
all?
set_start_branch_to_branch_name
create_commit
(
Files
::
CreateDirService
,
success_notice:
"The directory has been successfully created."
,
create_commit
(
Files
::
CreateDirService
,
success_notice:
"The directory has been successfully created."
,
success_path:
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@branch_name
,
@dir_name
)),
success_path:
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@branch_name
,
@dir_name
)),
failure_path:
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@ref
))
failure_path:
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@ref
))
...
...
app/views/projects/blob/_remove.html.haml
View file @
b38c74d6
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
%h3
.page-title
Delete
#{
@blob
.
name
}
%h3
.page-title
Delete
#{
@blob
.
name
}
.modal-body
.modal-body
=
form_tag
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :delete
,
class:
'form-horizontal js-
replac
e-blob-form js-quick-submit js-requires-input'
do
=
form_tag
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :delete
,
class:
'form-horizontal js-
delet
e-blob-form js-quick-submit js-requires-input'
do
=
render
'shared/new_commit_form'
,
placeholder:
"Delete
#{
@blob
.
name
}
"
=
render
'shared/new_commit_form'
,
placeholder:
"Delete
#{
@blob
.
name
}
"
.form-group
.form-group
...
@@ -15,4 +15,4 @@
...
@@ -15,4 +15,4 @@
=
link_to
"Cancel"
,
'#'
,
class:
"btn btn-cancel"
,
"data-dismiss"
=>
"modal"
=
link_to
"Cancel"
,
'#'
,
class:
"btn btn-cancel"
,
"data-dismiss"
=>
"modal"
:javascript
:javascript
new
NewCommitForm
(
$
(
'
.js-
replac
e-blob-form
'
))
new
NewCommitForm
(
$
(
'
.js-
delet
e-blob-form
'
))
app/views/projects/commit/_change.html.haml
View file @
b38c74d6
...
@@ -18,10 +18,9 @@
...
@@ -18,10 +18,9 @@
=
label_tag
'start_branch'
,
branch_label
,
class:
'control-label'
=
label_tag
'start_branch'
,
branch_label
,
class:
'control-label'
.col-sm-10
.col-sm-10
=
hidden_field_tag
:start_branch
,
@project
.
default_branch
,
id:
'start_branch'
=
hidden_field_tag
:start_branch
,
@project
.
default_branch
,
id:
'start_branch'
=
dropdown_tag
(
@project
.
default_branch
,
options:
{
title:
"Switch branch"
,
filter:
true
,
placeholder:
"Search branches"
,
toggle_class:
'js-project-refs-dropdown
js-target-branch
dynamic'
,
dropdown_class:
'dropdown-menu-selectable'
,
data:
{
field_name:
"start_branch"
,
selected:
@project
.
default_branch
,
start_branch:
@project
.
default_branch
,
refs_url:
namespace_project_branches_path
(
@project
.
namespace
,
@project
),
submit_form_on_click:
false
}
})
=
dropdown_tag
(
@project
.
default_branch
,
options:
{
title:
"Switch branch"
,
filter:
true
,
placeholder:
"Search branches"
,
toggle_class:
'js-project-refs-dropdown dynamic'
,
dropdown_class:
'dropdown-menu-selectable'
,
data:
{
field_name:
"start_branch"
,
selected:
@project
.
default_branch
,
start_branch:
@project
.
default_branch
,
refs_url:
namespace_project_branches_path
(
@project
.
namespace
,
@project
),
submit_form_on_click:
false
}
})
-
if
can?
(
current_user
,
:push_code
,
@project
)
-
if
can?
(
current_user
,
:push_code
,
@project
)
.js-create-merge-request-container
.checkbox
.checkbox
=
label_tag
do
=
label_tag
do
=
check_box_tag
'create_merge_request'
,
1
,
true
,
class:
'js-create-merge-request'
,
id:
nil
=
check_box_tag
'create_merge_request'
,
1
,
true
,
class:
'js-create-merge-request'
,
id:
nil
...
@@ -35,6 +34,3 @@
...
@@ -35,6 +34,3 @@
-
unless
can?
(
current_user
,
:push_code
,
@project
)
-
unless
can?
(
current_user
,
:push_code
,
@project
)
.inline.prepend-left-10
.inline.prepend-left-10
=
commit_in_fork_help
=
commit_in_fork_help
:javascript
new
NewCommitForm
(
$
(
'
.js-
#{
type
}
-form
'
),
'
start_branch
'
)
app/views/shared/_branch_switcher.html.haml
deleted
100644 → 0
View file @
ce37a209
-
dropdown_toggle_text
=
@branch_name
||
tree_edit_branch
=
hidden_field_tag
'branch_name'
,
dropdown_toggle_text
.dropdown
=
dropdown_toggle
dropdown_toggle_text
,
{
toggle:
'dropdown'
,
selected:
dropdown_toggle_text
,
field_name:
'branch_name'
,
form_id:
'.js-edit-blob-form'
,
refs_url:
namespace_project_branches_path
(
@project
.
namespace
,
@project
)
},
{
toggle_class:
'js-project-branches-dropdown js-target-branch'
}
.dropdown-menu.dropdown-menu-selectable.dropdown-menu-paging.dropdown-menu-branches
=
render
partial:
'shared/projects/blob/branch_page_default'
=
render
partial:
'shared/projects/blob/branch_page_create'
app/views/shared/_new_commit_form.html.haml
View file @
b38c74d6
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
.form-group.branch
.form-group.branch
=
label_tag
'branch_name'
,
'Target branch'
,
class:
'control-label'
=
label_tag
'branch_name'
,
'Target branch'
,
class:
'control-label'
.col-sm-10
.col-sm-10
=
render
'shared/branch_switcher'
=
text_field_tag
'branch_name'
,
@branch_name
||
tree_edit_branch
,
required:
true
,
class:
"form-control js-branch-name ref-name"
.js-create-merge-request-container
.js-create-merge-request-container
.checkbox
.checkbox
...
...
app/views/shared/projects/blob/_branch_page_create.html.haml
deleted
100644 → 0
View file @
ce37a209
.dropdown-page-two.dropdown-new-branch
=
dropdown_title
(
'Create new branch'
,
back:
true
)
=
dropdown_content
do
%input
#new_branch_name
.default-dropdown-input.append-bottom-10
{
type:
"text"
,
placeholder:
"Name new branch"
}
%button
.btn.btn-primary.pull-left.js-new-branch-btn
{
type:
"button"
}
Create
%button
.btn.btn-default.pull-right.js-cancel-branch-btn
{
type:
"button"
}
Cancel
app/views/shared/projects/blob/_branch_page_default.html.haml
deleted
100644 → 0
View file @
ce37a209
.dropdown-page-one
=
dropdown_title
"Select branch"
=
dropdown_filter
"Search branches"
=
dropdown_content
=
dropdown_loading
=
dropdown_footer
do
%ul
.dropdown-footer-list
%li
%a
.create-new-branch.dropdown-toggle-page
{
href:
"#"
}
Create new branch
changelogs/unreleased/dm-revert-mr-8427.yml
0 → 100644
View file @
b38c74d6
---
title
:
Revert 'New file from interface on existing branch'
merge_request
:
author
:
features/steps/project/source/browse_files.rb
View file @
b38c74d6
...
@@ -89,10 +89,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
...
@@ -89,10 +89,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end
end
step
'I fill the new branch name'
do
step
'I fill the new branch name'
do
first
(
'button.js-target-branch'
,
visible:
true
).
click
fill_in
:branch_name
,
with:
'new_branch_name'
,
visible:
true
find
(
'.create-new-branch'
,
visible:
true
).
click
find
(
'#new_branch_name'
,
visible:
true
).
set
(
'new_branch_name'
)
find
(
'.js-new-branch-btn'
,
visible:
true
).
click
end
end
step
'I fill the new file name with an illegal name'
do
step
'I fill the new file name with an illegal name'
do
...
...
spec/controllers/projects/branches_controller_spec.rb
View file @
b38c74d6
...
@@ -367,19 +367,5 @@ describe Projects::BranchesController do
...
@@ -367,19 +367,5 @@ describe Projects::BranchesController do
expect
(
parsed_response
.
first
).
to
eq
'master'
expect
(
parsed_response
.
first
).
to
eq
'master'
end
end
end
end
context
'show_all = true'
do
it
'returns all the branches name'
do
get
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
,
format: :json
,
show_all:
true
parsed_response
=
JSON
.
parse
(
response
.
body
)
expect
(
parsed_response
.
length
).
to
eq
(
project
.
repository
.
branches
.
count
)
end
end
end
end
end
end
spec/features/projects/blobs/edit_spec.rb
View file @
b38c74d6
...
@@ -102,7 +102,7 @@ feature 'Editing file blob', feature: true, js: true do
...
@@ -102,7 +102,7 @@ feature 'Editing file blob', feature: true, js: true do
it
'shows blob editor with same branch'
do
it
'shows blob editor with same branch'
do
expect
(
page
).
to
have_current_path
(
namespace_project_edit_blob_path
(
project
.
namespace
,
project
,
tree_join
(
branch
,
file_path
)))
expect
(
page
).
to
have_current_path
(
namespace_project_edit_blob_path
(
project
.
namespace
,
project
,
tree_join
(
branch
,
file_path
)))
expect
(
find
(
'.js-
target-branch .dropdown-toggle-text'
).
text
).
to
eq
(
branch
)
expect
(
find
(
'.js-
branch-name'
).
value
).
to
eq
(
branch
)
end
end
end
end
...
@@ -112,7 +112,7 @@ feature 'Editing file blob', feature: true, js: true do
...
@@ -112,7 +112,7 @@ feature 'Editing file blob', feature: true, js: true do
end
end
it
'shows blob editor with patch branch'
do
it
'shows blob editor with patch branch'
do
expect
(
find
(
'.js-
target-branch .dropdown-toggle-text'
).
text
).
to
eq
(
'patch-1'
)
expect
(
find
(
'.js-
branch-name'
).
value
).
to
eq
(
'patch-1'
)
end
end
end
end
end
end
...
@@ -128,7 +128,7 @@ feature 'Editing file blob', feature: true, js: true do
...
@@ -128,7 +128,7 @@ feature 'Editing file blob', feature: true, js: true do
it
'shows blob editor with same branch'
do
it
'shows blob editor with same branch'
do
expect
(
page
).
to
have_current_path
(
namespace_project_edit_blob_path
(
project
.
namespace
,
project
,
tree_join
(
branch
,
file_path
)))
expect
(
page
).
to
have_current_path
(
namespace_project_edit_blob_path
(
project
.
namespace
,
project
,
tree_join
(
branch
,
file_path
)))
expect
(
find
(
'.js-
target-branch .dropdown-toggle-text'
).
text
).
to
eq
(
branch
)
expect
(
find
(
'.js-
branch-name'
).
value
).
to
eq
(
branch
)
end
end
end
end
end
end
...
...
spec/features/projects/blobs/user_create_spec.rb
deleted
100644 → 0
View file @
ce37a209
require
'spec_helper'
feature
'New blob creation'
,
feature:
true
,
js:
true
do
include
TargetBranchHelpers
given
(
:user
)
{
create
(
:user
)
}
given
(
:role
)
{
:developer
}
given
(
:project
)
{
create
(
:project
)
}
given
(
:content
)
{
'class NextFeature\nend\n'
}
background
do
login_as
(
user
)
project
.
team
<<
[
user
,
role
]
visit
namespace_project_new_blob_path
(
project
.
namespace
,
project
,
'master'
)
end
def
edit_file
wait_for_requests
fill_in
'file_name'
,
with:
'feature.rb'
execute_script
(
"ace.edit('editor').setValue('
#{
content
}
')"
)
end
def
commit_file
click_button
'Commit changes'
end
context
'with default target branch'
do
background
do
edit_file
commit_file
end
scenario
'creates the blob in the default branch'
do
expect
(
page
).
to
have_content
'master'
expect
(
page
).
to
have_content
'successfully created'
expect
(
page
).
to
have_content
'NextFeature'
end
end
context
'with different target branch'
do
background
do
edit_file
select_branch
(
'feature'
)
commit_file
end
scenario
'creates the blob in the different branch'
do
expect
(
page
).
to
have_content
'feature'
expect
(
page
).
to
have_content
'successfully created'
end
end
context
'with a new target branch'
do
given
(
:new_branch_name
)
{
'new-feature'
}
background
do
edit_file
create_new_branch
(
new_branch_name
)
commit_file
end
scenario
'creates the blob in the new branch'
do
expect
(
page
).
to
have_content
new_branch_name
expect
(
page
).
to
have_content
'successfully created'
end
scenario
'returns you to the mr'
do
expect
(
page
).
to
have_content
'New Merge Request'
expect
(
page
).
to
have_content
"From
#{
new_branch_name
}
into master"
expect
(
page
).
to
have_content
'Add new file'
end
end
context
'the file already exist in the source branch'
do
background
do
Files
::
CreateService
.
new
(
project
,
user
,
start_branch:
'master'
,
branch_name:
'master'
,
commit_message:
'Create file'
,
file_path:
'feature.rb'
,
file_content:
content
).
execute
edit_file
commit_file
end
scenario
'shows error message'
do
expect
(
page
).
to
have_content
(
'A file with this name already exists'
)
expect
(
page
).
to
have_content
(
'New file'
)
expect
(
page
).
to
have_content
(
'NextFeature'
)
end
end
end
spec/features/projects/user_create_dir_spec.rb
View file @
b38c74d6
require
'spec_helper'
require
'spec_helper'
feature
'New directory creation'
,
feature:
true
,
js:
true
do
feature
'New directory creation'
,
feature:
true
,
js:
true
do
include
TargetBranchHelpers
given
(
:user
)
{
create
(
:user
)
}
given
(
:user
)
{
create
(
:user
)
}
given
(
:role
)
{
:developer
}
given
(
:role
)
{
:developer
}
given
(
:project
)
{
create
(
:project
)
}
given
(
:project
)
{
create
(
:project
)
}
...
@@ -36,23 +34,11 @@ feature 'New directory creation', feature: true, js: true do
...
@@ -36,23 +34,11 @@ feature 'New directory creation', feature: true, js: true do
end
end
end
end
context
'with different target branch'
do
background
do
select_branch
(
'feature'
)
create_directory
end
scenario
'creates the directory in the different branch'
do
expect
(
page
).
to
have_content
'feature'
expect
(
page
).
to
have_content
'The directory has been successfully created'
end
end
context
'with a new target branch'
do
context
'with a new target branch'
do
given
(
:new_branch_name
)
{
'new-feature'
}
given
(
:new_branch_name
)
{
'new-feature'
}
background
do
background
do
create_new_branch
(
new_branch_name
)
fill_in
:branch_name
,
with:
new_branch_name
create_directory
create_directory
end
end
...
...
spec/javascripts/blob/create_branch_dropdown_spec.js
deleted
100644 → 0
View file @
ce37a209
import
'
~/gl_dropdown
'
;
import
'
~/blob/create_branch_dropdown
'
;
import
'
~/blob/target_branch_dropdown
'
;
describe
(
'
CreateBranchDropdown
'
,
()
=>
{
const
fixtureTemplate
=
'
static/target_branch_dropdown.html.raw
'
;
// selectors
const
createBranchSel
=
'
.js-new-branch-btn
'
;
const
backBtnSel
=
'
.dropdown-menu-back
'
;
const
cancelBtnSel
=
'
.js-cancel-branch-btn
'
;
const
branchNameSel
=
'
#new_branch_name
'
;
const
branchName
=
'
new_name
'
;
let
dropdown
;
function
createDropdown
()
{
const
dropdownEl
=
document
.
querySelector
(
'
.js-project-branches-dropdown
'
);
const
projectBranches
=
getJSONFixture
(
'
project_branches.json
'
);
dropdown
=
new
gl
.
TargetBranchDropDown
(
dropdownEl
);
dropdown
.
cachedRefs
=
projectBranches
;
return
dropdown
;
}
function
createBranchBtn
()
{
return
document
.
querySelector
(
createBranchSel
);
}
function
backBtn
()
{
return
document
.
querySelector
(
backBtnSel
);
}
function
cancelBtn
()
{
return
document
.
querySelector
(
cancelBtnSel
);
}
function
branchNameEl
()
{
return
document
.
querySelector
(
branchNameSel
);
}
function
changeBranchName
(
text
)
{
branchNameEl
().
value
=
text
;
branchNameEl
().
dispatchEvent
(
new
Event
(
'
change
'
));
}
preloadFixtures
(
fixtureTemplate
);
beforeEach
(()
=>
{
loadFixtures
(
fixtureTemplate
);
createDropdown
();
});
it
(
'
disable submit when branch name is empty
'
,
()
=>
{
expect
(
createBranchBtn
()).
toBeDisabled
();
});
it
(
'
enable submit when branch name is present
'
,
()
=>
{
changeBranchName
(
branchName
);
expect
(
createBranchBtn
()).
not
.
toBeDisabled
();
});
it
(
'
resets the form when cancel btn is clicked and triggers dropdownback
'
,
()
=>
{
const
spyBackEvent
=
spyOnEvent
(
backBtnSel
,
'
click
'
);
changeBranchName
(
branchName
);
cancelBtn
().
click
();
expect
(
branchNameEl
()).
toHaveValue
(
''
);
expect
(
spyBackEvent
).
toHaveBeenTriggered
();
});
it
(
'
resets the form when back btn is clicked
'
,
()
=>
{
changeBranchName
(
branchName
);
backBtn
().
click
();
expect
(
branchNameEl
()).
toHaveValue
(
''
);
});
describe
(
'
new branch creation
'
,
()
=>
{
beforeEach
(()
=>
{
changeBranchName
(
branchName
);
});
it
(
'
sets the new branch name and updates the dropdown
'
,
()
=>
{
spyOn
(
dropdown
,
'
setNewBranch
'
);
createBranchBtn
().
click
();
expect
(
dropdown
.
setNewBranch
).
toHaveBeenCalledWith
(
branchName
);
});
it
(
'
resets the form
'
,
()
=>
{
createBranchBtn
().
click
();
expect
(
branchNameEl
()).
toHaveValue
(
''
);
});
it
(
'
is triggered with enter keypress
'
,
()
=>
{
spyOn
(
dropdown
,
'
setNewBranch
'
);
const
enterEvent
=
new
Event
(
'
keydown
'
);
enterEvent
.
which
=
13
;
branchNameEl
().
dispatchEvent
(
enterEvent
);
expect
(
dropdown
.
setNewBranch
).
toHaveBeenCalledWith
(
branchName
);
});
});
});
spec/javascripts/blob/target_branch_dropdown_spec.js
deleted
100644 → 0
View file @
ce37a209
import
'
~/gl_dropdown
'
;
import
'
~/blob/create_branch_dropdown
'
;
import
'
~/blob/target_branch_dropdown
'
;
describe
(
'
TargetBranchDropdown
'
,
()
=>
{
const
fixtureTemplate
=
'
static/target_branch_dropdown.html.raw
'
;
let
dropdown
;
function
createDropdown
()
{
const
projectBranches
=
getJSONFixture
(
'
project_branches.json
'
);
const
dropdownEl
=
document
.
querySelector
(
'
.js-project-branches-dropdown
'
);
dropdown
=
new
gl
.
TargetBranchDropDown
(
dropdownEl
);
dropdown
.
cachedRefs
=
projectBranches
;
dropdown
.
refreshData
();
return
dropdown
;
}
function
submitBtn
()
{
return
document
.
querySelector
(
'
button[type="submit"]
'
);
}
function
searchField
()
{
return
document
.
querySelector
(
'
.dropdown-page-one .dropdown-input-field
'
);
}
function
element
()
{
return
document
.
querySelectorAll
(
'
div.dropdown-content li a
'
);
}
function
elementAtIndex
(
index
)
{
return
element
()[
index
];
}
function
clickElementAtIndex
(
index
)
{
elementAtIndex
(
index
).
click
();
}
preloadFixtures
(
fixtureTemplate
);
beforeEach
(()
=>
{
loadFixtures
(
fixtureTemplate
);
createDropdown
();
});
it
(
'
disable submit when branch is not selected
'
,
()
=>
{
document
.
querySelector
(
'
input[name="target_branch"]
'
).
value
=
null
;
clickElementAtIndex
(
1
);
expect
(
submitBtn
().
getAttribute
(
'
disabled
'
)).
toEqual
(
''
);
});
it
(
'
enable submit when a branch is selected
'
,
()
=>
{
clickElementAtIndex
(
1
);
expect
(
submitBtn
().
getAttribute
(
'
disabled
'
)).
toBe
(
null
);
});
it
(
'
triggers change.branch event on a branch click
'
,
()
=>
{
spyOnEvent
(
dropdown
.
$dropdown
,
'
change.branch
'
);
clickElementAtIndex
(
0
);
expect
(
'
change.branch
'
).
toHaveBeenTriggeredOn
(
dropdown
.
$dropdown
);
});
describe
(
'
dropdownData
'
,
()
=>
{
it
(
'
cache the refs
'
,
()
=>
{
const
refs
=
dropdown
.
cachedRefs
;
dropdown
.
cachedRefs
=
null
;
dropdown
.
dropdownData
(
refs
);
expect
(
dropdown
.
cachedRefs
).
toEqual
(
refs
);
});
it
(
'
returns the Branches with the newBranch and defaultBranch
'
,
()
=>
{
const
refs
=
dropdown
.
cachedRefs
;
dropdown
.
branchInput
.
value
=
'
master
'
;
dropdown
.
newBranch
=
{
id
:
'
new_branch
'
,
text
:
'
new_branch
'
,
title
:
'
new_branch
'
};
const
branches
=
dropdown
.
dropdownData
(
refs
).
Branches
;
expect
(
branches
.
length
).
toEqual
(
4
);
expect
(
branches
[
0
]).
toEqual
(
dropdown
.
newBranch
);
expect
(
branches
[
1
]).
toEqual
({
id
:
'
master
'
,
text
:
'
master
'
,
title
:
'
master
'
});
expect
(
branches
[
2
]).
toEqual
({
id
:
'
development
'
,
text
:
'
development
'
,
title
:
'
development
'
});
expect
(
branches
[
3
]).
toEqual
({
id
:
'
staging
'
,
text
:
'
staging
'
,
title
:
'
staging
'
});
});
});
describe
(
'
setNewBranch
'
,
()
=>
{
it
(
'
adds the new branch and select it
'
,
()
=>
{
const
branchName
=
'
new_branch
'
;
dropdown
.
setNewBranch
(
branchName
);
expect
(
elementAtIndex
(
0
)).
toHaveClass
(
'
is-active
'
);
expect
(
elementAtIndex
(
0
)).
toContainHtml
(
branchName
);
});
it
(
"
doesn't add a new branch if already exists in the list
"
,
()
=>
{
const
branchName
=
elementAtIndex
(
0
).
text
;
const
initialLength
=
element
().
length
;
dropdown
.
setNewBranch
(
branchName
);
expect
(
element
().
length
).
toEqual
(
initialLength
);
});
it
(
'
clears the search filter
'
,
()
=>
{
const
branchName
=
elementAtIndex
(
0
).
text
;
searchField
().
value
=
'
searching
'
;
dropdown
.
setNewBranch
(
branchName
);
expect
(
searchField
().
value
).
toEqual
(
''
);
});
});
});
spec/javascripts/fixtures/project_branches.json
deleted
100644 → 0
View file @
ce37a209
[
"master"
,
"development"
,
"staging"
]
spec/javascripts/fixtures/target_branch_dropdown.html.haml
deleted
100644 → 0
View file @
ce37a209
%form
.js-edit-blob-form
%input
{
type:
'hidden'
,
name:
'target_branch'
,
value:
'master'
}
%div
.dropdown
%button
.dropdown-menu-toggle.js-project-branches-dropdown.js-target-branch
{
type:
'button'
,
data:
{
toggle:
'dropdown'
,
selected:
'master'
,
field_name:
'target_branch'
,
form_id:
'.js-edit-blob-form'
}}
.dropdown-menu.dropdown-menu-selectable.dropdown-menu-paging
.dropdown-page-one
.dropdown-title
'Select branch'
.dropdown-input
%input
.dropdown-input-field
{
type:
'search'
,
value:
''
}
%i
.fa.fa-search.dropdown-input-search
%i
.fa.fa-times-dropdown-input-clear.js-dropdown-input-clear
{
role:
'button'
}
.dropdown-content
.dropdown-footer
%ul
.dropdown-footer-list
%li
%a
.create-new-branch.dropdown-toggle-page
{
href:
"#"
}
Create new branch
.dropdown-page-two.dropdown-new-branch
%button
.dropdown-title-button.dropdown-menu-back
{
type:
'button'
}
.dropdown_title
'Create new branch'
.dropdown_content
%input
#new_branch_name
.default-dropdown-input
{
type:
"text"
,
placeholder:
"Name new branch"
}
%button
.btn.btn-primary.pull-left.js-new-branch-btn
{
type:
"button"
}
Create
%button
.btn.btn-default.pull-right.js-cancel-branch-btn
{
type:
"button"
}
Cancel
%button
{
type:
'submit'
}
spec/support/target_branch_helpers.rb
deleted
100644 → 0
View file @
ce37a209
module
TargetBranchHelpers
def
select_branch
(
name
)
first
(
'button.js-target-branch'
).
click
wait_for_requests
all
(
'a[data-group="Branches"]'
).
find
do
|
el
|
el
.
text
==
name
end
.
click
end
def
create_new_branch
(
name
)
first
(
'button.js-target-branch'
).
click
click_link
'Create new branch'
fill_in
'new_branch_name'
,
with:
name
click_button
'Create'
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