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
Kazuhiko Shiozaki
gitlab-ce
Commits
e49190ca
Commit
e49190ca
authored
Nov 17, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use params[:view] directly.
parent
1c040b3f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
9 deletions
+12
-9
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+6
-2
app/views/projects/commit/show.html.haml
app/views/projects/commit/show.html.haml
+1
-1
app/views/projects/diffs/_diffs.html.haml
app/views/projects/diffs/_diffs.html.haml
+1
-1
app/views/projects/diffs/_file.html.haml
app/views/projects/diffs/_file.html.haml
+1
-2
app/views/projects/notes/_form.html.haml
app/views/projects/notes/_form.html.haml
+1
-1
app/views/projects/notes/_notes_with_form.html.haml
app/views/projects/notes/_notes_with_form.html.haml
+2
-2
No files found.
app/helpers/diff_helper.rb
View file @
e49190ca
module
DiffHelper
def
diff_view
params
[
:view
]
==
'parallel'
?
'parallel'
:
'inline'
end
def
allowed_diff_size
if
diff_hard_limit_enabled?
Commit
::
DIFF_HARD_LIMIT_FILES
...
...
@@ -137,7 +141,7 @@ module DiffHelper
# Always use HTML to handle case where JSON diff rendered this button
params_copy
.
delete
(
:format
)
link_to
url_for
(
params_copy
),
id:
"inline-diff-btn"
,
class:
(
params
[
:view
]
!=
'parallel
'
?
'btn active'
:
'btn'
)
do
link_to
url_for
(
params_copy
),
id:
"inline-diff-btn"
,
class:
(
diff_view
==
'inline
'
?
'btn active'
:
'btn'
)
do
'Inline'
end
end
...
...
@@ -148,7 +152,7 @@ module DiffHelper
# Always use HTML to handle case where JSON diff rendered this button
params_copy
.
delete
(
:format
)
link_to
url_for
(
params_copy
),
id:
"parallel-diff-btn"
,
class:
(
params
[
:view
]
==
'parallel'
?
'btn active'
:
'btn'
)
do
link_to
url_for
(
params_copy
),
id:
"parallel-diff-btn"
,
class:
(
diff_view
==
'parallel'
?
'btn active'
:
'btn'
)
do
'Side-by-side'
end
end
...
...
app/views/projects/commit/show.html.haml
View file @
e49190ca
...
...
@@ -3,4 +3,4 @@
=
render
"commit_box"
=
render
"ci_menu"
if
@ci_commit
=
render
"projects/diffs/diffs"
,
diffs:
@diffs
,
project:
@project
=
render
"projects/notes/notes_with_form"
,
view:
params
[
:view
]
=
render
"projects/notes/notes_with_form"
app/views/projects/diffs/_diffs.html.haml
View file @
e49190ca
-
if
params
[
:view
]
==
'parallel'
-
if
diff_view
==
'parallel'
-
fluid_layout
true
-
diff_files
=
safe_diff_files
(
diffs
)
...
...
app/views/projects/diffs/_file.html.haml
View file @
e49190ca
...
...
@@ -33,7 +33,7 @@
-# Skipp all non non-supported blobs
-
return
unless
blob
.
respond_to?
(
'text?'
)
-
if
blob
.
text?
-
if
params
[
:view
]
==
'parallel'
-
if
diff_view
==
'parallel'
=
render
"projects/diffs/parallel_view"
,
diff_file:
diff_file
,
project:
project
,
blob:
blob
,
index:
i
-
else
=
render
"projects/diffs/text_file"
,
diff_file:
diff_file
,
index:
i
...
...
@@ -42,4 +42,3 @@
=
render
"projects/diffs/image"
,
diff_file:
diff_file
,
old_file:
old_file
,
file:
blob
,
index:
i
-
else
.nothing-here-block
No preview for this file type
app/views/projects/notes/_form.html.haml
View file @
e49190ca
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@note
],
remote:
true
,
html:
{
:'data-type'
=>
'json'
,
multipart:
true
,
id:
nil
,
class:
"new_note js-new-note-form common-note-form gfm-form"
},
authenticity_token:
true
do
|
f
|
=
hidden_field_tag
:view
,
params
[
:view
]
=
hidden_field_tag
:view
,
diff_view
=
hidden_field_tag
:line_type
=
note_target_fields
(
@note
)
=
f
.
hidden_field
:commit_id
...
...
app/views/projects/notes/_notes_with_form.html.haml
View file @
e49190ca
...
...
@@ -4,7 +4,7 @@
.js-main-target-form
-
if
can?
current_user
,
:create_note
,
@project
=
render
"projects/notes/form"
,
view:
params
[
:view
]
=
render
"projects/notes/form"
,
view:
diff_view
:javascript
window
.
_notes
=
new
Notes
(
"
#{
namespace_project_notes_path
(
namespace_id:
@project
.
namespace
,
target_id:
@noteable
.
id
,
target_type:
@noteable
.
class
.
name
.
underscore
)
}
"
,
#{
@notes
.
map
(
&
:id
).
to_json
}
,
#{
Time
.
now
.
to_i
}
,
"
#{
params
[
:view
]
}
"
)
window
.
_notes
=
new
Notes
(
"
#{
namespace_project_notes_path
(
namespace_id:
@project
.
namespace
,
target_id:
@noteable
.
id
,
target_type:
@noteable
.
class
.
name
.
underscore
)
}
"
,
#{
@notes
.
map
(
&
:id
).
to_json
}
,
#{
Time
.
now
.
to_i
}
,
"
#{
diff_view
}
"
)
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