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
7bd9a702
Commit
7bd9a702
authored
Jul 08, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7222 from jhund/fix-5936
Don't remove trailing newline when editing a file in web UI editor
parents
715b8181
df3c466e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
app/controllers/projects/edit_tree_controller.rb
app/controllers/projects/edit_tree_controller.rb
+0
-2
app/views/projects/edit_tree/show.html.haml
app/views/projects/edit_tree/show.html.haml
+2
-1
No files found.
app/controllers/projects/edit_tree_controller.rb
View file @
7bd9a702
...
...
@@ -28,8 +28,6 @@ class Projects::EditTreeController < Projects::BaseTreeController
def
preview
@content
=
params
[
:content
]
#FIXME workaround https://github.com/gitlabhq/gitlabhq/issues/5936
@content
+=
"
\n
"
if
@blob
.
data
.
end_with?
(
"
\n
"
)
diffy
=
Diffy
::
Diff
.
new
(
@blob
.
data
,
@content
,
diff:
'-U 3'
,
include_diff_info:
true
)
...
...
app/views/projects/edit_tree/show.html.haml
View file @
7bd9a702
...
...
@@ -16,7 +16,7 @@
.btn-group.tree-btn-group
=
link_to
"Cancel"
,
@after_edit_path
,
class:
"btn btn-tiny btn-cancel"
,
data:
{
confirm:
leave_edit_message
}
.file-content.code
%pre
.js-edit-mode-pane
#editor
=
@blob
.
data
%pre
.js-edit-mode-pane
#editor
.js-edit-mode-pane
#preview
.hide
.center
%h2
...
...
@@ -43,6 +43,7 @@
ace
.
config
.
set
(
"
modePath
"
,
gon
.
relative_url_root
+
"
#{
Gitlab
::
Application
.
config
.
assets
.
prefix
}
/ace
"
)
var
ace_mode
=
"
#{
@blob
.
language
.
try
(
:ace_mode
)
}
"
;
var
editor
=
ace
.
edit
(
"
editor
"
);
editor
.
setValue
(
"
#{
escape_javascript
(
@blob
.
data
)
}
"
);
if
(
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