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
b7b49dab
Commit
b7b49dab
authored
Nov 17, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'param-view' into 'master'
See merge request !1816
parents
85102d09
e49190ca
Changes
6
Hide 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 @
b7b49dab
module
DiffHelper
module
DiffHelper
def
diff_view
params
[
:view
]
==
'parallel'
?
'parallel'
:
'inline'
end
def
allowed_diff_size
def
allowed_diff_size
if
diff_hard_limit_enabled?
if
diff_hard_limit_enabled?
Commit
::
DIFF_HARD_LIMIT_FILES
Commit
::
DIFF_HARD_LIMIT_FILES
...
@@ -137,7 +141,7 @@ module DiffHelper
...
@@ -137,7 +141,7 @@ module DiffHelper
# Always use HTML to handle case where JSON diff rendered this button
# Always use HTML to handle case where JSON diff rendered this button
params_copy
.
delete
(
:format
)
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'
'Inline'
end
end
end
end
...
@@ -148,7 +152,7 @@ module DiffHelper
...
@@ -148,7 +152,7 @@ module DiffHelper
# Always use HTML to handle case where JSON diff rendered this button
# Always use HTML to handle case where JSON diff rendered this button
params_copy
.
delete
(
:format
)
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'
'Side-by-side'
end
end
end
end
...
...
app/views/projects/commit/show.html.haml
View file @
b7b49dab
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
=
render
"commit_box"
=
render
"commit_box"
=
render
"ci_menu"
if
@ci_commit
=
render
"ci_menu"
if
@ci_commit
=
render
"projects/diffs/diffs"
,
diffs:
@diffs
,
project:
@project
=
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 @
b7b49dab
-
if
params
[
:view
]
==
'parallel'
-
if
diff_view
==
'parallel'
-
fluid_layout
true
-
fluid_layout
true
-
diff_files
=
safe_diff_files
(
diffs
)
-
diff_files
=
safe_diff_files
(
diffs
)
...
...
app/views/projects/diffs/_file.html.haml
View file @
b7b49dab
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
-# Skipp all non non-supported blobs
-# Skipp all non non-supported blobs
-
return
unless
blob
.
respond_to?
(
'text?'
)
-
return
unless
blob
.
respond_to?
(
'text?'
)
-
if
blob
.
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
=
render
"projects/diffs/parallel_view"
,
diff_file:
diff_file
,
project:
project
,
blob:
blob
,
index:
i
-
else
-
else
=
render
"projects/diffs/text_file"
,
diff_file:
diff_file
,
index:
i
=
render
"projects/diffs/text_file"
,
diff_file:
diff_file
,
index:
i
...
@@ -42,4 +42,3 @@
...
@@ -42,4 +42,3 @@
=
render
"projects/diffs/image"
,
diff_file:
diff_file
,
old_file:
old_file
,
file:
blob
,
index:
i
=
render
"projects/diffs/image"
,
diff_file:
diff_file
,
old_file:
old_file
,
file:
blob
,
index:
i
-
else
-
else
.nothing-here-block
No preview for this file type
.nothing-here-block
No preview for this file type
app/views/projects/notes/_form.html.haml
View file @
b7b49dab
=
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
|
=
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
=
hidden_field_tag
:line_type
=
note_target_fields
(
@note
)
=
note_target_fields
(
@note
)
=
f
.
hidden_field
:commit_id
=
f
.
hidden_field
:commit_id
...
...
app/views/projects/notes/_notes_with_form.html.haml
View file @
b7b49dab
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
.js-main-target-form
.js-main-target-form
-
if
can?
current_user
,
:create_note
,
@project
-
if
can?
current_user
,
:create_note
,
@project
=
render
"projects/notes/form"
,
view:
params
[
:view
]
=
render
"projects/notes/form"
,
view:
diff_view
:javascript
:javascript
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
]
}
"
)
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