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
727d229e
Commit
727d229e
authored
Apr 03, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix edit files since we use Gitlab::Git::Blob for files
parent
921151d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
app/controllers/edit_tree_controller.rb
app/controllers/edit_tree_controller.rb
+5
-3
app/views/edit_tree/show.html.haml
app/views/edit_tree/show.html.haml
+5
-5
No files found.
app/controllers/edit_tree_controller.rb
View file @
727d229e
...
@@ -22,7 +22,7 @@ class EditTreeController < ProjectResourceController
...
@@ -22,7 +22,7 @@ class EditTreeController < ProjectResourceController
)
)
if
updated_successfully
if
updated_successfully
redirect_to
project_
tree
_path
(
@project
,
@id
),
notice:
"Your changes have been successfully commited"
redirect_to
project_
blob
_path
(
@project
,
@id
),
notice:
"Your changes have been successfully commited"
else
else
flash
[
:notice
]
=
"Your changes could not be commited, because the file has been changed"
flash
[
:notice
]
=
"Your changes could not be commited, because the file has been changed"
render
:edit
render
:edit
...
@@ -32,8 +32,10 @@ class EditTreeController < ProjectResourceController
...
@@ -32,8 +32,10 @@ class EditTreeController < ProjectResourceController
private
private
def
edit_requirements
def
edit_requirements
unless
@tree
.
is_blob?
&&
@tree
.
text?
@blob
=
Gitlab
::
Git
::
Blob
.
new
(
@repository
,
@commit
.
id
,
@ref
,
@path
)
redirect_to
project_tree_path
(
@project
,
@id
),
notice:
"You can only edit text files"
unless
@blob
.
exists?
&&
@blob
.
text?
redirect_to
project_blob_path
(
@project
,
@id
),
notice:
"You can only edit text files"
end
end
allowed
=
if
project
.
protected_branch?
@ref
allowed
=
if
project
.
protected_branch?
@ref
...
...
app/views/edit_tree/show.html.haml
View file @
727d229e
...
@@ -4,21 +4,21 @@
...
@@ -4,21 +4,21 @@
.file_title
.file_title
%i
.icon-file
%i
.icon-file
%span
.file_name
%span
.file_name
=
@
tree
.
path
=
@path
%small
%small
on
on
%strong
=
@ref
%strong
=
@ref
%span
.options
%span
.options
.btn-group.tree-btn-group
.btn-group.tree-btn-group
=
link_to
"Cancel"
,
project_
tree
_path
(
@project
,
@id
),
class:
"btn btn-tiny btn-cancel"
,
confirm:
"Are you sure?"
=
link_to
"Cancel"
,
project_
blob
_path
(
@project
,
@id
),
class:
"btn btn-tiny btn-cancel"
,
confirm:
"Are you sure?"
.file_content.code
.file_content.code
%pre
#editor
=
@
tree
.
data
%pre
#editor
=
@
blob
.
data
.control-group.commit_message-group
.control-group.commit_message-group
=
label_tag
'commit_message'
,
class:
"control-label"
do
=
label_tag
'commit_message'
,
class:
"control-label"
do
Commit message
Commit message
.controls
.controls
=
text_area_tag
'commit_message'
,
''
,
placeholder:
"Update
#{
@
tree
.
name
}
"
,
required:
true
,
rows:
3
=
text_area_tag
'commit_message'
,
''
,
placeholder:
"Update
#{
@
blob
.
name
}
"
,
required:
true
,
rows:
3
.form-actions
.form-actions
=
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
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
=
link_to
"Cancel"
,
project_tree_path
(
@project
,
@id
),
class:
"btn btn-cancel"
,
confirm:
"Are you sure?"
=
link_to
"Cancel"
,
project_tree_path
(
@project
,
@id
),
class:
"btn btn-cancel"
,
confirm:
"Are you sure?"
:javascript
:javascript
var
ace_mode
=
"
#{
@
tree
.
language
.
try
(
:ace_mode
)
}
"
;
var
ace_mode
=
"
#{
@
blob
.
language
.
try
(
:ace_mode
)
}
"
;
var
editor
=
ace
.
edit
(
"
editor
"
);
var
editor
=
ace
.
edit
(
"
editor
"
);
if
(
ace_mode
)
{
if
(
ace_mode
)
{
editor
.
getSession
().
setMode
(
'
ace/mode/
'
+
ace_mode
);
editor
.
getSession
().
setMode
(
'
ace/mode/
'
+
ace_mode
);
...
...
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