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
Tatuya Kamada
gitlab-ce
Commits
e945ec02
Commit
e945ec02
authored
Nov 17, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add "Start a new merge request" option to every commit form
parent
0b540a0f
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
168 additions
and
157 deletions
+168
-157
app/assets/javascripts/blob/blob_file_dropzone.js.coffee
app/assets/javascripts/blob/blob_file_dropzone.js.coffee
+3
-14
app/assets/javascripts/blob/edit_blob.js.coffee
app/assets/javascripts/blob/edit_blob.js.coffee
+0
-7
app/assets/javascripts/blob/new_blob.js.coffee
app/assets/javascripts/blob/new_blob.js.coffee
+0
-7
app/assets/javascripts/new_commit_form.js.coffee
app/assets/javascripts/new_commit_form.js.coffee
+21
-0
app/assets/stylesheets/pages/editor.scss
app/assets/stylesheets/pages/editor.scss
+0
-4
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+0
-30
app/controllers/concerns/creates_merge_request_for_commit.rb
app/controllers/concerns/creates_merge_request_for_commit.rb
+28
-0
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+29
-24
app/controllers/projects/tree_controller.rb
app/controllers/projects/tree_controller.rb
+12
-1
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+20
-0
app/views/projects/blob/_actions.html.haml
app/views/projects/blob/_actions.html.haml
+1
-1
app/views/projects/blob/_new_dir.html.haml
app/views/projects/blob/_new_dir.html.haml
+6
-8
app/views/projects/blob/_remove.html.haml
app/views/projects/blob/_remove.html.haml
+8
-8
app/views/projects/blob/_upload.html.haml
app/views/projects/blob/_upload.html.haml
+7
-11
app/views/projects/blob/edit.html.haml
app/views/projects/blob/edit.html.haml
+3
-16
app/views/projects/blob/new.html.haml
app/views/projects/blob/new.html.haml
+5
-19
app/views/projects/blob/show.html.haml
app/views/projects/blob/show.html.haml
+1
-3
app/views/projects/tree/_tree_content.html.haml
app/views/projects/tree/_tree_content.html.haml
+1
-1
app/views/shared/_commit_message_container.html.haml
app/views/shared/_commit_message_container.html.haml
+5
-3
app/views/shared/_new_commit_form.html.haml
app/views/shared/_new_commit_form.html.haml
+18
-0
No files found.
app/assets/javascripts/blob/blob_file_dropzone.js.coffee
View file @
e945ec02
...
@@ -23,18 +23,6 @@ class @BlobFileDropzone
...
@@ -23,18 +23,6 @@ class @BlobFileDropzone
init
:
->
init
:
->
this
.
on
'addedfile'
,
(
file
)
->
this
.
on
'addedfile'
,
(
file
)
->
$
(
'.dropzone-alerts'
).
html
(
''
).
hide
()
$
(
'.dropzone-alerts'
).
html
(
''
).
hide
()
commit_message
=
form
.
find
(
'#commit_message'
)[
0
]
if
/^Upload/
.
test
(
commit_message
.
placeholder
)
commit_message
.
placeholder
=
'Upload '
+
file
.
name
return
this
.
on
'removedfile'
,
(
file
)
->
commit_message
=
form
.
find
(
'#commit_message'
)[
0
]
if
/^Upload/
.
test
(
commit_message
.
placeholder
)
commit_message
.
placeholder
=
'Upload new file'
return
return
...
@@ -47,8 +35,9 @@ class @BlobFileDropzone
...
@@ -47,8 +35,9 @@ class @BlobFileDropzone
return
return
this
.
on
'sending'
,
(
file
,
xhr
,
formData
)
->
this
.
on
'sending'
,
(
file
,
xhr
,
formData
)
->
formData
.
append
(
'new_branch'
,
form
.
find
(
'#new_branch'
).
val
())
formData
.
append
(
'new_branch'
,
form
.
find
(
'.js-new-branch'
).
val
())
formData
.
append
(
'commit_message'
,
form
.
find
(
'#commit_message'
).
val
())
formData
.
append
(
'create_merge_request'
,
form
.
find
(
'.js-create-merge-request'
).
val
())
formData
.
append
(
'commit_message'
,
form
.
find
(
'.js-commit-message'
).
val
())
return
return
# Override behavior of adding error underneath preview
# Override behavior of adding error underneath preview
...
...
app/assets/javascripts/blob/edit_blob.js.coffee
View file @
e945ec02
...
@@ -11,13 +11,6 @@ class @EditBlob
...
@@ -11,13 +11,6 @@ class @EditBlob
if
ace_mode
if
ace_mode
editor
.
getSession
().
setMode
"ace/mode/"
+
ace_mode
editor
.
getSession
().
setMode
"ace/mode/"
+
ace_mode
$
(
'#new_branch'
).
keyup
->
if
$
(
this
).
val
()
!=
$
(
'#original_branch'
).
val
()
$
(
'.form-group.destination'
).
show
()
else
$
(
'.form-group.destination'
).
hide
()
$
(
'#create_merge_request'
).
prop
(
'checked'
,
false
)
# Before a form submission, move the content from the Ace editor into the
# Before a form submission, move the content from the Ace editor into the
# submitted textarea
# submitted textarea
$
(
'form'
).
submit
->
$
(
'form'
).
submit
->
...
...
app/assets/javascripts/blob/new_blob.js.coffee
View file @
e945ec02
...
@@ -11,13 +11,6 @@ class @NewBlob
...
@@ -11,13 +11,6 @@ class @NewBlob
if
ace_mode
if
ace_mode
editor
.
getSession
().
setMode
"ace/mode/"
+
ace_mode
editor
.
getSession
().
setMode
"ace/mode/"
+
ace_mode
$
(
'#new_branch'
).
keyup
->
if
$
(
this
).
val
()
!=
$
(
'#original_branch'
).
val
()
$
(
'.form-group.destination'
).
show
()
else
$
(
'.form-group.destination'
).
hide
()
$
(
'#create_merge_request'
).
prop
(
'checked'
,
false
)
# Before a form submission, move the content from the Ace editor into the
# Before a form submission, move the content from the Ace editor into the
# submitted textarea
# submitted textarea
$
(
'form'
).
submit
->
$
(
'form'
).
submit
->
...
...
app/assets/javascripts/new_commit_form.js.coffee
0 → 100644
View file @
e945ec02
class
@
NewCommitForm
constructor
:
(
form
)
->
@
newBranch
=
form
.
find
(
'.js-new-branch'
)
@
originalBranch
=
form
.
find
(
'.js-original-branch'
)
@
createMergeRequest
=
form
.
find
(
'.js-create-merge-request'
)
@
createMergeRequestFormGroup
=
form
.
find
(
'.js-create-merge-request-form-group'
)
@
renderDestination
()
@
newBranch
.
keyup
@
renderDestination
renderDestination
:
=>
different
=
@
newBranch
.
val
()
!=
@
originalBranch
.
val
()
if
different
@
createMergeRequestFormGroup
.
show
()
@
createMergeRequest
.
prop
(
'checked'
,
true
)
unless
@
wasDifferent
else
@
createMergeRequestFormGroup
.
hide
()
@
createMergeRequest
.
prop
(
'checked'
,
false
)
@
wasDifferent
=
different
app/assets/stylesheets/pages/editor.scss
View file @
e945ec02
...
@@ -63,8 +63,4 @@
...
@@ -63,8 +63,4 @@
margin-top
:
0
;
margin-top
:
0
;
padding
:
$gl-padding
padding
:
$gl-padding
}
}
.destination
{
display
:
none
;
}
}
}
app/controllers/application_controller.rb
View file @
e945ec02
...
@@ -22,7 +22,6 @@ class ApplicationController < ActionController::Base
...
@@ -22,7 +22,6 @@ class ApplicationController < ActionController::Base
helper_method
:abilities
,
:can?
,
:current_application_settings
helper_method
:abilities
,
:can?
,
:current_application_settings
helper_method
:import_sources_enabled?
,
:github_import_enabled?
,
:github_import_configured?
,
:gitlab_import_enabled?
,
:gitlab_import_configured?
,
:bitbucket_import_enabled?
,
:bitbucket_import_configured?
,
:gitorious_import_enabled?
,
:google_code_import_enabled?
,
:fogbugz_import_enabled?
,
:git_import_enabled?
helper_method
:import_sources_enabled?
,
:github_import_enabled?
,
:github_import_configured?
,
:gitlab_import_enabled?
,
:gitlab_import_configured?
,
:bitbucket_import_enabled?
,
:bitbucket_import_configured?
,
:gitorious_import_enabled?
,
:google_code_import_enabled?
,
:fogbugz_import_enabled?
,
:git_import_enabled?
helper_method
:new_mr_from_push_event
,
:new_mr_path_for_fork_from_push_event
,
:new_mr_path_from_push_event
rescue_from
Encoding
::
CompatibilityError
do
|
exception
|
rescue_from
Encoding
::
CompatibilityError
do
|
exception
|
log_exception
(
exception
)
log_exception
(
exception
)
...
@@ -343,35 +342,6 @@ class ApplicationController < ActionController::Base
...
@@ -343,35 +342,6 @@ class ApplicationController < ActionController::Base
current_application_settings
.
import_sources
.
include?
(
'git'
)
current_application_settings
.
import_sources
.
include?
(
'git'
)
end
end
# new merge requests routing helpers
def
new_mr_path_from_push_event
(
event
,
target_branch
=
nil
)
target_project
=
event
.
project
.
forked_from_project
||
event
.
project
new_namespace_project_merge_request_path
(
event
.
project
.
namespace
,
event
.
project
,
new_mr_from_push_event
(
event
,
target_project
,
target_branch
)
)
end
def
new_mr_path_for_fork_from_push_event
(
event
,
target_branch
=
nil
)
new_namespace_project_merge_request_path
(
event
.
project
.
namespace
,
event
.
project
,
new_mr_from_push_event
(
event
,
event
.
project
.
forked_from_project
,
target_branch
)
)
end
def
new_mr_from_push_event
(
event
,
target_project
,
target_branch
)
{
merge_request:
{
source_project_id:
event
.
project
.
id
,
target_project_id:
target_project
.
id
,
source_branch:
event
.
branch_name
,
target_branch:
target_branch
||
target_project
.
repository
.
root_ref
}
}
end
def
redirect_to_home_page_url?
def
redirect_to_home_page_url?
# If user is not signed-in and tries to access root_path - redirect him to landing page
# If user is not signed-in and tries to access root_path - redirect him to landing page
# Don't redirect to the default URL to prevent endless redirections
# Don't redirect to the default URL to prevent endless redirections
...
...
app/controllers/concerns/creates_merge_request_for_commit.rb
0 → 100644
View file @
e945ec02
module
CreatesMergeRequestForCommit
extend
ActiveSupport
::
Concern
def
new_merge_request_path
if
@project
.
forked?
target_project
=
@project
.
forked_from_project
||
@project
target_branch
=
target_project
.
repository
.
root_ref
else
target_project
=
@project
target_branch
=
@ref
end
new_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
merge_request:
{
source_project_id:
@project
.
id
,
target_project_id:
target_project
.
id
,
source_branch:
@new_branch
,
target_branch:
target_branch
}
)
end
def
create_merge_request?
params
[
:create_merge_request
]
&&
@new_branch
!=
@ref
end
end
app/controllers/projects/blob_controller.rb
View file @
e945ec02
# Controller for viewing a file's blame
# Controller for viewing a file's blame
class
Projects::BlobController
<
Projects
::
ApplicationController
class
Projects::BlobController
<
Projects
::
ApplicationController
include
ExtractsPath
include
ExtractsPath
include
CreatesMergeRequestForCommit
include
ActionView
::
Helpers
::
SanitizeHelper
include
ActionView
::
Helpers
::
SanitizeHelper
# Raised when given an invalid file path
# Raised when given an invalid file path
...
@@ -27,15 +28,8 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -27,15 +28,8 @@ class Projects::BlobController < Projects::ApplicationController
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
flash
[
:notice
]
=
"The changes have been successfully committed"
flash
[
:notice
]
=
"The changes have been successfully committed"
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
{
redirect_to
after_create_path
}
url
=
if
params
[
:create_merge_request
]
format
.
json
{
render
json:
{
message:
"success"
,
filePath:
after_create_path
}
}
new_mr_path_from_push_event
(
current_user
.
recent_push
(
@project
.
id
),
@ref
)
else
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@target_branch
,
@file_path
))
end
redirect_to
url
end
format
.
json
{
render
json:
{
message:
"success"
,
filePath:
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@target_branch
,
@file_path
))
}
}
end
end
else
else
flash
[
:alert
]
=
result
[
:message
]
flash
[
:alert
]
=
result
[
:message
]
...
@@ -59,14 +53,7 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -59,14 +53,7 @@ class Projects::BlobController < Projects::ApplicationController
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
flash
[
:notice
]
=
"Your changes have been successfully committed"
flash
[
:notice
]
=
"Your changes have been successfully committed"
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
{
redirect_to
after_edit_path
}
url
=
if
params
[
:create_merge_request
]
new_mr_path_from_push_event
(
current_user
.
recent_push
(
@project
.
id
),
@ref
)
else
after_edit_path
end
redirect_to
url
end
format
.
json
{
render
json:
{
message:
"success"
,
filePath:
after_edit_path
}
}
format
.
json
{
render
json:
{
message:
"success"
,
filePath:
after_edit_path
}
}
end
end
else
else
...
@@ -91,7 +78,7 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -91,7 +78,7 @@ class Projects::BlobController < Projects::ApplicationController
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
flash
[
:notice
]
=
"Your changes have been successfully committed"
flash
[
:notice
]
=
"Your changes have been successfully committed"
redirect_to
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@target_branch
)
redirect_to
after_destroy_path
else
else
flash
[
:alert
]
=
result
[
:message
]
flash
[
:alert
]
=
result
[
:message
]
render
:show
render
:show
...
@@ -145,15 +132,33 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -145,15 +132,33 @@ class Projects::BlobController < Projects::ApplicationController
render_404
render_404
end
end
def
after_create_path
@after_create_path
||=
if
create_merge_request?
new_merge_request_path
else
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@new_branch
,
@file_path
))
end
end
def
after_edit_path
def
after_edit_path
@after_edit_path
||=
@after_edit_path
||=
if
from_merge_request
if
create_merge_request?
new_merge_request_path
elsif
from_merge_request
&&
@new_branch
==
@ref
diffs_namespace_project_merge_request_path
(
from_merge_request
.
target_project
.
namespace
,
from_merge_request
.
target_project
,
from_merge_request
)
+
diffs_namespace_project_merge_request_path
(
from_merge_request
.
target_project
.
namespace
,
from_merge_request
.
target_project
,
from_merge_request
)
+
"#file-path-
#{
hexdigest
(
@path
)
}
"
"#file-path-
#{
hexdigest
(
@path
)
}
"
elsif
@target_branch
.
present?
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@target_branch
,
@path
))
else
else
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
@id
)
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@new_branch
,
@path
))
end
end
def
after_destroy_path
@after_destroy_path
||=
if
create_merge_request?
new_merge_request_path
else
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@new_branch
)
end
end
end
end
...
@@ -168,7 +173,7 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -168,7 +173,7 @@ class Projects::BlobController < Projects::ApplicationController
def
editor_variables
def
editor_variables
@current_branch
=
@ref
@current_branch
=
@ref
@
target
_branch
=
params
[
:new_branch
].
present?
?
sanitized_new_branch_name
:
@ref
@
new
_branch
=
params
[
:new_branch
].
present?
?
sanitized_new_branch_name
:
@ref
@file_path
=
@file_path
=
if
action_name
.
to_s
==
'create'
if
action_name
.
to_s
==
'create'
...
@@ -188,7 +193,7 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -188,7 +193,7 @@ class Projects::BlobController < Projects::ApplicationController
@commit_params
=
{
@commit_params
=
{
file_path:
@file_path
,
file_path:
@file_path
,
current_branch:
@current_branch
,
current_branch:
@current_branch
,
target_branch:
@
target
_branch
,
target_branch:
@
new
_branch
,
commit_message:
params
[
:commit_message
],
commit_message:
params
[
:commit_message
],
file_content:
params
[
:content
],
file_content:
params
[
:content
],
file_content_encoding:
params
[
:encoding
]
file_content_encoding:
params
[
:encoding
]
...
...
app/controllers/projects/tree_controller.rb
View file @
e945ec02
# Controller for viewing a repository's file structure
# Controller for viewing a repository's file structure
class
Projects::TreeController
<
Projects
::
ApplicationController
class
Projects::TreeController
<
Projects
::
ApplicationController
include
ExtractsPath
include
ExtractsPath
include
CreatesMergeRequestForCommit
include
ActionView
::
Helpers
::
SanitizeHelper
include
ActionView
::
Helpers
::
SanitizeHelper
before_action
:require_non_empty_project
,
except:
[
:new
,
:create
]
before_action
:require_non_empty_project
,
except:
[
:new
,
:create
]
...
@@ -43,7 +44,7 @@ class Projects::TreeController < Projects::ApplicationController
...
@@ -43,7 +44,7 @@ class Projects::TreeController < Projects::ApplicationController
if
result
&&
result
[
:status
]
==
:success
if
result
&&
result
[
:status
]
==
:success
flash
[
:notice
]
=
"The directory has been successfully created"
flash
[
:notice
]
=
"The directory has been successfully created"
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@new_branch
,
@dir_name
))
}
format
.
html
{
redirect_to
after_create_dir_path
}
end
end
else
else
flash
[
:alert
]
=
message
flash
[
:alert
]
=
message
...
@@ -53,6 +54,8 @@ class Projects::TreeController < Projects::ApplicationController
...
@@ -53,6 +54,8 @@ class Projects::TreeController < Projects::ApplicationController
end
end
end
end
private
def
assign_dir_vars
def
assign_dir_vars
@new_branch
=
params
[
:new_branch
].
present?
?
sanitize
(
strip_tags
(
params
[
:new_branch
]))
:
@ref
@new_branch
=
params
[
:new_branch
].
present?
?
sanitize
(
strip_tags
(
params
[
:new_branch
]))
:
@ref
@dir_name
=
File
.
join
(
@path
,
params
[
:dir_name
])
@dir_name
=
File
.
join
(
@path
,
params
[
:dir_name
])
...
@@ -63,4 +66,12 @@ class Projects::TreeController < Projects::ApplicationController
...
@@ -63,4 +66,12 @@ class Projects::TreeController < Projects::ApplicationController
commit_message:
params
[
:commit_message
],
commit_message:
params
[
:commit_message
],
}
}
end
end
def
after_create_dir_path
if
create_merge_request?
new_merge_request_path
else
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@new_branch
,
@dir_name
))
end
end
end
end
app/helpers/merge_requests_helper.rb
View file @
e945ec02
module
MergeRequestsHelper
module
MergeRequestsHelper
def
new_mr_path_from_push_event
(
event
)
target_project
=
event
.
project
.
forked_from_project
||
event
.
project
new_namespace_project_merge_request_path
(
event
.
project
.
namespace
,
event
.
project
,
new_mr_from_push_event
(
event
,
target_project
)
)
end
def
new_mr_from_push_event
(
event
,
target_project
)
{
merge_request:
{
source_project_id:
event
.
project
.
id
,
target_project_id:
target_project
.
id
,
source_branch:
event
.
branch_name
,
target_branch:
target_project
.
repository
.
root_ref
}
}
end
def
mr_css_classes
(
mr
)
def
mr_css_classes
(
mr
)
classes
=
"merge-request"
classes
=
"merge-request"
classes
<<
" closed"
if
mr
.
closed?
classes
<<
" closed"
if
mr
.
closed?
...
...
app/views/projects/blob/_actions.html.haml
View file @
e945ec02
...
@@ -19,4 +19,4 @@
...
@@ -19,4 +19,4 @@
-
if
allowed_tree_edit?
-
if
allowed_tree_edit?
.btn-group
{
role:
"group"
}
.btn-group
{
role:
"group"
}
%button
.btn.btn-default
{
'data-target'
=>
'#modal-upload-blob'
,
'data-toggle'
=>
'modal'
}
Replace
%button
.btn.btn-default
{
'data-target'
=>
'#modal-upload-blob'
,
'data-toggle'
=>
'modal'
}
Replace
%button
.btn.btn-remove
{
'data-target'
=>
'#modal-remove-blob'
,
'data-toggle'
=>
'modal'
}
Remov
e
%button
.btn.btn-remove
{
'data-target'
=>
'#modal-remove-blob'
,
'data-toggle'
=>
'modal'
}
Delet
e
app/views/projects/blob/_new_dir.html.haml
View file @
e945ec02
...
@@ -5,21 +5,19 @@
...
@@ -5,21 +5,19 @@
%a
.close
{
href:
"#"
,
"data-dismiss"
=>
"modal"
}
×
%a
.close
{
href:
"#"
,
"data-dismiss"
=>
"modal"
}
×
%h3
.page-title
Create New Directory
%h3
.page-title
Create New Directory
.modal-body
.modal-body
=
form_tag
namespace_project_create_dir_path
(
@project
.
namespace
,
@project
,
@id
),
method: :post
,
remote:
false
,
id:
'dir-create-form'
,
class:
'form-horizontal
'
do
=
form_tag
namespace_project_create_dir_path
(
@project
.
namespace
,
@project
,
@id
),
method: :post
,
remote:
false
,
class:
'form-horizontal js-create-dir-form
'
do
.form-group
.form-group
=
label_tag
:dir_name
,
'Directory Name'
,
class:
'control-label'
=
label_tag
:dir_name
,
'Directory Name'
,
class:
'control-label'
.col-sm-10
.col-sm-10
=
text_field_tag
:dir_name
,
params
[
:dir_name
],
placeholder:
"Directory name"
,
required:
true
,
class:
'form-control'
=
text_field_tag
:dir_name
,
params
[
:dir_name
],
placeholder:
"Directory name"
,
required:
true
,
class:
'form-control'
=
render
'shared/commit_message_container'
,
params:
params
,
placeholder:
''
-
unless
@project
.
empty_repo?
=
render
'shared/new_commit_form'
,
placeholder:
"Add new directory"
.form-group
=
label_tag
:branch_name
,
'Branch'
,
class:
'control-label'
.col-sm-10
=
text_field_tag
'new_branch'
,
@ref
,
class:
"form-control"
.form-group
.form-group
.col-sm-offset-2.col-sm-10
.col-sm-offset-2.col-sm-10
=
submit_tag
"Create directory"
,
class:
'btn btn-primary btn-create'
=
submit_tag
"Create directory"
,
class:
'btn btn-primary btn-create'
=
link_to
"Cancel"
,
'#'
,
class:
"btn btn-cancel"
,
"data-dismiss"
=>
"modal"
=
link_to
"Cancel"
,
'#'
,
class:
"btn btn-cancel"
,
"data-dismiss"
=>
"modal"
:javascript
:javascript
disableButtonIfAnyEmptyField
(
$
(
"
#dir-create-form
"
),
"
.form-control
"
,
"
.btn-create
"
);
disableButtonIfAnyEmptyField
(
$
(
"
.js-create-dir-form
"
),
"
.form-control
"
,
"
.btn-create
"
);
new
NewCommitForm
(
$
(
'
.js-create-dir-form
'
))
app/views/projects/blob/_remove.html.haml
View file @
e945ec02
...
@@ -3,16 +3,16 @@
...
@@ -3,16 +3,16 @@
.modal-content
.modal-content
.modal-header
.modal-header
%a
.close
{
href:
"#"
,
"data-dismiss"
=>
"modal"
}
×
%a
.close
{
href:
"#"
,
"data-dismiss"
=>
"modal"
}
×
%h3
.page-title
Remove
#{
@blob
.
name
}
%h3
.page-title
Delete
#{
@blob
.
name
}
%p
.light
From branch
%strong
=
@ref
.modal-body
.modal-body
=
form_tag
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :delete
,
class:
'form-horizontal js-requires-input'
do
=
form_tag
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :delete
,
class:
'form-horizontal js-re
place-blob-form js-re
quires-input'
do
=
render
'shared/
commit_message_container'
,
params:
params
,
=
render
'shared/
new_commit_form'
,
placeholder:
"Delete
#{
@blob
.
name
}
"
placeholder:
'Removed this file because...'
.form-group
.form-group
.col-sm-offset-2.col-sm-10
.col-sm-offset-2.col-sm-10
=
button_tag
'
Remov
e file'
,
class:
'btn btn-remove btn-remove-file'
=
button_tag
'
Delet
e file'
,
class:
'btn btn-remove btn-remove-file'
=
link_to
"Cancel"
,
'#'
,
class:
"btn btn-cancel"
,
"data-dismiss"
=>
"modal"
=
link_to
"Cancel"
,
'#'
,
class:
"btn btn-cancel"
,
"data-dismiss"
=>
"modal"
:javascript
new
NewCommitForm
(
$
(
'
.js-replace-blob-form
'
))
app/views/projects/blob/_upload.html.haml
View file @
e945ec02
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
%a
.close
{
href:
"#"
,
"data-dismiss"
=>
"modal"
}
×
%a
.close
{
href:
"#"
,
"data-dismiss"
=>
"modal"
}
×
%h3
.page-title
#{
title
}
%h3
.page-title
#{
title
}
.modal-body
.modal-body
=
form_tag
form_path
,
method:
method
,
class:
'
blob-file-upload-form-js
form-horizontal'
do
=
form_tag
form_path
,
method:
method
,
class:
'
js-upload-blob-form
form-horizontal'
do
.dropzone
.dropzone
.dropzone-previews.blob-upload-dropzone-previews
.dropzone-previews.blob-upload-dropzone-previews
%p
.dz-message.light
%p
.dz-message.light
...
@@ -13,19 +13,15 @@
...
@@ -13,19 +13,15 @@
=
link_to
'click to upload'
,
'#'
,
class:
"markdown-selector"
=
link_to
'click to upload'
,
'#'
,
class:
"markdown-selector"
%br
%br
.dropzone-alerts
{
class:
"alert alert-danger data"
,
style:
"display:none"
}
.dropzone-alerts
{
class:
"alert alert-danger data"
,
style:
"display:none"
}
=
render
'shared/commit_message_container'
,
params:
params
,
placeholder:
placeholder
=
render
'shared/new_commit_form'
,
placeholder:
placeholder
-
unless
@project
.
empty_repo?
.form-group.branch
=
label_tag
'branch'
,
class:
'control-label'
do
Branch
.col-sm-10
=
text_field_tag
'new_branch'
,
@ref
,
class:
"form-control"
.form-group
.form-group
.col-sm-offset-2.col-sm-10
.col-sm-offset-2.col-sm-10
=
button_tag
button_title
,
class:
'btn btn-small btn-primary btn-upload-file'
,
id:
'submit-all'
=
button_tag
button_title
,
class:
'btn btn-small btn-primary btn-upload-file'
,
id:
'submit-all'
=
link_to
"Cancel"
,
'#'
,
class:
"btn btn-cancel"
,
"data-dismiss"
=>
"modal"
=
link_to
"Cancel"
,
'#'
,
class:
"btn btn-cancel"
,
"data-dismiss"
=>
"modal"
:javascript
:javascript
disableButtonIfEmptyField
(
$
(
'
.blob-file-upload-form-js
'
).
find
(
'
#commit_message
'
),
'
.btn-upload-file
'
);
disableButtonIfEmptyField
(
$
(
'
.js-upload-blob-form
'
).
find
(
'
.js-commit-message
'
),
'
.btn-upload-file
'
);
new
BlobFileDropzone
(
$
(
'
.blob-file-upload-form-js
'
),
'
#{
method
}
'
);
new
BlobFileDropzone
(
$
(
'
.js-upload-blob-form
'
),
'
#{
method
}
'
);
new
NewCommitForm
(
$
(
'
.js-upload-blob-form
'
))
app/views/projects/blob/edit.html.haml
View file @
e945ec02
...
@@ -13,28 +13,15 @@
...
@@ -13,28 +13,15 @@
%i
.fa.fa-eye
%i
.fa.fa-eye
=
editing_preview_title
(
@blob
.
name
)
=
editing_preview_title
(
@blob
.
name
)
=
form_tag
(
namespace_project_update_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :put
,
class:
'form-horizontal js-requires-input'
)
do
=
form_tag
(
namespace_project_update_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :put
,
class:
'form-horizontal js-requires-input
js-edit-blob-form
'
)
do
=
render
'projects/blob/editor'
,
ref:
@ref
,
path:
@path
,
blob_data:
@blob
.
data
=
render
'projects/blob/editor'
,
ref:
@ref
,
path:
@path
,
blob_data:
@blob
.
data
=
render
'shared/commit_message_container'
,
params:
params
,
placeholder:
"Update
#{
@blob
.
name
}
"
=
render
'shared/new_commit_form'
,
placeholder:
"Update
#{
@blob
.
name
}
"
.form-group.branch
=
label_tag
'branch'
,
class:
'control-label'
do
Branch
.col-sm-10
=
text_field_tag
'new_branch'
,
@ref
,
class:
"form-control"
.form-group.destination
.col-sm-offset-2.col-sm-10
.checkbox
=
label_tag
:create_merge_request
do
=
check_box_tag
:create_merge_request
,
1
,
false
Start a new merge request
=
hidden_field_tag
'last_commit'
,
@last_commit
=
hidden_field_tag
'last_commit'
,
@last_commit
=
hidden_field_tag
'content'
,
''
,
id:
"file-content"
=
hidden_field_tag
'content'
,
''
,
id:
"file-content"
=
hidden_field_tag
'from_merge_request_id'
,
params
[
:from_merge_request_id
]
=
hidden_field_tag
'from_merge_request_id'
,
params
[
:from_merge_request_id
]
=
hidden_field_tag
'original_branch'
,
@ref
=
render
'projects/commit_button'
,
ref:
@ref
,
cancel_path:
@after_edit_path
=
render
'projects/commit_button'
,
ref:
@ref
,
cancel_path:
@after_edit_path
:javascript
:javascript
blob
=
new
EditBlob
(
gon
.
relative_url_root
+
"
#{
Gitlab
::
Application
.
config
.
assets
.
prefix
}
"
,
"
#{
@blob
.
language
.
try
(
:ace_mode
)
}
"
)
blob
=
new
EditBlob
(
gon
.
relative_url_root
+
"
#{
Gitlab
::
Application
.
config
.
assets
.
prefix
}
"
,
"
#{
@blob
.
language
.
try
(
:ace_mode
)
}
"
)
new
NewCommitForm
(
$
(
'
.js-edit-blob-form
'
))
app/views/projects/blob/new.html.haml
View file @
e945ec02
...
@@ -2,32 +2,18 @@
...
@@ -2,32 +2,18 @@
=
render
"header_title"
=
render
"header_title"
.gray-content-block.top-block
.gray-content-block.top-block
Create a new file
%h3
.page-title
Create New File
.file-editor
.file-editor
=
form_tag
(
namespace_project_create_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :post
,
class:
'form-horizontal
form-new-file
js-requires-input'
)
do
=
form_tag
(
namespace_project_create_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :post
,
class:
'form-horizontal
js-new-blob-form
js-requires-input'
)
do
=
render
'projects/blob/editor'
,
ref:
@ref
=
render
'projects/blob/editor'
,
ref:
@ref
=
render
'shared/commit_message_container'
,
params:
params
,
=
render
'shared/new_commit_form'
,
placeholder:
"Add new file"
placeholder:
'Add new file'
-
unless
@project
.
empty_repo?
.form-group.branch
=
label_tag
'branch'
,
class:
'control-label'
do
Branch
.col-sm-10
=
text_field_tag
'new_branch'
,
@ref
,
class:
"form-control js-quick-submit"
.form-group.destination
.col-sm-offset-2.col-sm-10
.checkbox
=
label_tag
:create_merge_request
do
=
check_box_tag
:create_merge_request
,
1
,
false
Start a new merge request
=
hidden_field_tag
'content'
,
''
,
id:
'file-content'
=
hidden_field_tag
'content'
,
''
,
id:
'file-content'
=
hidden_field_tag
'original_branch'
,
@ref
=
render
'projects/commit_button'
,
ref:
@ref
,
=
render
'projects/commit_button'
,
ref:
@ref
,
cancel_path:
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@id
)
cancel_path:
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@id
)
:javascript
:javascript
blob
=
new
NewBlob
(
gon
.
relative_url_root
+
"
#{
Gitlab
::
Application
.
config
.
assets
.
prefix
}
"
,
null
)
blob
=
new
NewBlob
(
gon
.
relative_url_root
+
"
#{
Gitlab
::
Application
.
config
.
assets
.
prefix
}
"
,
null
)
new
NewCommitForm
(
$
(
'
.js-new-blob-form
'
))
app/views/projects/blob/show.html.haml
View file @
e945ec02
...
@@ -10,6 +10,4 @@
...
@@ -10,6 +10,4 @@
=
render
'projects/blob/remove'
=
render
'projects/blob/remove'
-
title
=
"Replace
#{
@blob
.
name
}
"
-
title
=
"Replace
#{
@blob
.
name
}
"
=
render
'projects/blob/upload'
,
title:
title
,
placeholder:
title
,
=
render
'projects/blob/upload'
,
title:
title
,
placeholder:
title
,
button_title:
'Replace file'
,
form_path:
namespace_project_update_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :put
button_title:
'Replace file'
,
form_path:
namespace_project_update_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :put
app/views/projects/tree/_tree_content.html.haml
View file @
e945ec02
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
=
render
"projects/tree/readme"
,
readme:
tree
.
readme
=
render
"projects/tree/readme"
,
readme:
tree
.
readme
-
if
allowed_tree_edit?
-
if
allowed_tree_edit?
=
render
'projects/blob/upload'
,
title:
'Upload'
,
placeholder:
'Upload new file'
,
button_title:
'Upload file'
,
form_path:
namespace_project_create_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :post
=
render
'projects/blob/upload'
,
title:
'Upload
New File
'
,
placeholder:
'Upload new file'
,
button_title:
'Upload file'
,
form_path:
namespace_project_create_blob_path
(
@project
.
namespace
,
@project
,
@id
),
method: :post
=
render
'projects/blob/new_dir'
=
render
'projects/blob/new_dir'
:javascript
:javascript
...
...
app/views/shared/_commit_message_container.html.haml
View file @
e945ec02
.form-group.commit_message-group
.form-group.commit_message-group
=
label_tag
'commit_message'
,
class:
'control-label'
do
-
nonce
=
SecureRandom
.
hex
=
label_tag
"commit_message-
#{
nonce
}
"
,
class:
'control-label'
do
Commit message
Commit message
.col-sm-10
.col-sm-10
.commit-message-container
.commit-message-container
.max-width-marker
.max-width-marker
=
text_area_tag
'commit_message'
,
=
text_area_tag
'commit_message'
,
(
params
[
:commit_message
]
||
local_assigns
[
:text
]),
(
params
[
:commit_message
]
||
local_assigns
[
:text
]),
class:
'form-control js-quick-submit'
,
placeholder:
local_assigns
[
:placeholder
],
class:
'form-control js-commit-message js-quick-submit'
,
placeholder:
local_assigns
[
:placeholder
],
required:
true
,
rows:
(
local_assigns
[
:rows
]
||
3
)
required:
true
,
rows:
(
local_assigns
[
:rows
]
||
3
),
id:
"commit_message-
#{
nonce
}
"
-
if
local_assigns
[
:hint
]
-
if
local_assigns
[
:hint
]
%p
.hint
%p
.hint
Try to keep the first line under 52 characters
Try to keep the first line under 52 characters
...
...
app/views/shared/_new_commit_form.html.haml
0 → 100644
View file @
e945ec02
=
render
'shared/commit_message_container'
,
placeholder:
placeholder
-
unless
@project
.
empty_repo?
.form-group.branch
=
label_tag
'branch'
,
class:
'control-label'
do
Branch
.col-sm-10
=
text_field_tag
'new_branch'
,
@new_branch
||
@ref
,
class:
"form-control js-new-branch"
.form-group.js-create-merge-request-form-group
.col-sm-offset-2.col-sm-10
.checkbox
-
nonce
=
SecureRandom
.
hex
=
label_tag
"create_merge_request-
#{
nonce
}
"
do
=
check_box_tag
'create_merge_request'
,
1
,
true
,
class:
'js-create-merge-request'
,
id:
"create_merge_request-
#{
nonce
}
"
Start a
<strong>
new merge request
</strong>
with this commit
=
hidden_field_tag
'original_branch'
,
@ref
,
class:
'js-original-branch'
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