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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0bde54c3
Commit
0bde54c3
authored
May 02, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve conflicts related to blob viewers
parent
2db73289
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1 addition
and
153 deletions
+1
-153
app/assets/javascripts/blob/viewer/index.js
app/assets/javascripts/blob/viewer/index.js
+0
-8
app/assets/javascripts/line_highlighter.js
app/assets/javascripts/line_highlighter.js
+0
-6
app/controllers/concerns/renders_blob.rb
app/controllers/concerns/renders_blob.rb
+0
-3
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+0
-4
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+0
-7
app/models/blob.rb
app/models/blob.rb
+1
-4
app/views/projects/blob/_header.html.haml
app/views/projects/blob/_header.html.haml
+0
-8
app/views/projects/blob/viewers/_markup.html.haml
app/views/projects/blob/viewers/_markup.html.haml
+0
-5
app/views/shared/snippets/_blob.html.haml
app/views/shared/snippets/_blob.html.haml
+0
-5
spec/features/projects/blobs/blob_show_spec.rb
spec/features/projects/blobs/blob_show_spec.rb
+0
-97
spec/helpers/blob_helper_spec.rb
spec/helpers/blob_helper_spec.rb
+0
-3
spec/views/projects/blob/_viewer.html.haml_spec.rb
spec/views/projects/blob/_viewer.html.haml_spec.rb
+0
-3
No files found.
app/assets/javascripts/blob/viewer/index.js
View file @
0bde54c3
...
@@ -6,11 +6,7 @@ export default class BlobViewer {
...
@@ -6,11 +6,7 @@ export default class BlobViewer {
this
.
copySourceBtn
=
document
.
querySelector
(
'
.js-copy-blob-source-btn
'
);
this
.
copySourceBtn
=
document
.
querySelector
(
'
.js-copy-blob-source-btn
'
);
this
.
simpleViewer
=
document
.
querySelector
(
'
.blob-viewer[data-type="simple"]
'
);
this
.
simpleViewer
=
document
.
querySelector
(
'
.blob-viewer[data-type="simple"]
'
);
this
.
richViewer
=
document
.
querySelector
(
'
.blob-viewer[data-type="rich"]
'
);
this
.
richViewer
=
document
.
querySelector
(
'
.blob-viewer[data-type="rich"]
'
);
<<<<<<<
HEAD
this
.
$blobContentHolder
=
$
(
'
#blob-content-holder
'
);
=======
this
.
$fileHolder
=
$
(
'
.file-holder
'
);
this
.
$fileHolder
=
$
(
'
.file-holder
'
);
>>>>>>>
ce
-
com
/
master
let
initialViewerName
=
document
.
querySelector
(
'
.blob-viewer:not(.hidden)
'
).
getAttribute
(
'
data-type
'
);
let
initialViewerName
=
document
.
querySelector
(
'
.blob-viewer:not(.hidden)
'
).
getAttribute
(
'
data-type
'
);
...
@@ -86,11 +82,7 @@ export default class BlobViewer {
...
@@ -86,11 +82,7 @@ export default class BlobViewer {
viewer
.
setAttribute
(
'
data-loaded
'
,
'
true
'
);
viewer
.
setAttribute
(
'
data-loaded
'
,
'
true
'
);
<<<<<<<
HEAD
this
.
$blobContentHolder
.
trigger
(
'
highlight:line
'
);
=======
this
.
$fileHolder
.
trigger
(
'
highlight:line
'
);
this
.
$fileHolder
.
trigger
(
'
highlight:line
'
);
>>>>>>>
ce
-
com
/
master
this
.
toggleCopyButtonState
();
this
.
toggleCopyButtonState
();
});
});
...
...
app/assets/javascripts/line_highlighter.js
View file @
0bde54c3
...
@@ -57,15 +57,9 @@ require('vendor/jquery.scrollTo');
...
@@ -57,15 +57,9 @@ require('vendor/jquery.scrollTo');
}
}
LineHighlighter
.
prototype
.
bindEvents
=
function
()
{
LineHighlighter
.
prototype
.
bindEvents
=
function
()
{
<<<<<<<
HEAD
const
$blobContentHolder
=
$
(
'
#blob-content-holder
'
);
$blobContentHolder
.
on
(
'
click
'
,
'
a[data-line-number]
'
,
this
.
clickHandler
);
$blobContentHolder
.
on
(
'
highlight:line
'
,
this
.
highlightHash
);
=======
const
$fileHolder
=
$
(
'
.file-holder
'
);
const
$fileHolder
=
$
(
'
.file-holder
'
);
$fileHolder
.
on
(
'
click
'
,
'
a[data-line-number]
'
,
this
.
clickHandler
);
$fileHolder
.
on
(
'
click
'
,
'
a[data-line-number]
'
,
this
.
clickHandler
);
$fileHolder
.
on
(
'
highlight:line
'
,
this
.
highlightHash
);
$fileHolder
.
on
(
'
highlight:line
'
,
this
.
highlightHash
);
>>>>>>>
ce
-
com
/
master
};
};
LineHighlighter
.
prototype
.
highlightHash
=
function
()
{
LineHighlighter
.
prototype
.
highlightHash
=
function
()
{
...
...
app/controllers/concerns/renders_blob.rb
View file @
0bde54c3
...
@@ -14,11 +14,8 @@ module RendersBlob
...
@@ -14,11 +14,8 @@ module RendersBlob
html:
view_to_html_string
(
"projects/blob/_viewer"
,
viewer:
viewer
,
load_asynchronously:
false
)
html:
view_to_html_string
(
"projects/blob/_viewer"
,
viewer:
viewer
,
load_asynchronously:
false
)
}
}
end
end
<<<<<<<
HEAD
=======
def
override_max_blob_size
(
blob
)
def
override_max_blob_size
(
blob
)
blob
.
override_max_size!
if
params
[
:override_max_size
]
==
'true'
blob
.
override_max_size!
if
params
[
:override_max_size
]
==
'true'
end
end
>>>>>>>
ce
-
com
/
master
end
end
app/controllers/projects/blob_controller.rb
View file @
0bde54c3
...
@@ -35,11 +35,7 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -35,11 +35,7 @@ class Projects::BlobController < Projects::ApplicationController
end
end
def
show
def
show
<<<<<<<
HEAD
@blob
.
override_max_size!
if
params
[
:override_max_size
]
==
'true'
=======
override_max_blob_size
(
@blob
)
override_max_blob_size
(
@blob
)
>>>>>>>
ce
-
com
/
master
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
...
...
app/helpers/blob_helper.rb
View file @
0bde54c3
...
@@ -119,9 +119,6 @@ module BlobHelper
...
@@ -119,9 +119,6 @@ module BlobHelper
end
end
def
blob_raw_url
def
blob_raw_url
<<<<<<<
HEAD
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
@id
)
=======
if
@snippet
if
@snippet
if
@snippet
.
project_id
if
@snippet
.
project_id
raw_namespace_project_snippet_path
(
@project
.
namespace
,
@project
,
@snippet
)
raw_namespace_project_snippet_path
(
@project
.
namespace
,
@project
,
@snippet
)
...
@@ -131,7 +128,6 @@ module BlobHelper
...
@@ -131,7 +128,6 @@ module BlobHelper
elsif
@blob
elsif
@blob
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
@id
)
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
@id
)
end
end
>>>>>>>
ce
-
com
/
master
end
end
# SVGs can contain malicious JavaScript; only include whitelisted
# SVGs can contain malicious JavaScript; only include whitelisted
...
@@ -221,11 +217,8 @@ module BlobHelper
...
@@ -221,11 +217,8 @@ module BlobHelper
end
end
def
copy_blob_source_button
(
blob
)
def
copy_blob_source_button
(
blob
)
<<<<<<<
HEAD
=======
return
unless
blob
.
rendered_as_text?
(
ignore_errors:
false
)
return
unless
blob
.
rendered_as_text?
(
ignore_errors:
false
)
>>>>>>>
ce
-
com
/
master
clipboard_button
(
target:
".blob-content[data-blob-id='
#{
blob
.
id
}
']"
,
class:
"btn btn-sm js-copy-blob-source-btn"
,
title:
"Copy source to clipboard"
)
clipboard_button
(
target:
".blob-content[data-blob-id='
#{
blob
.
id
}
']"
,
class:
"btn btn-sm js-copy-blob-source-btn"
,
title:
"Copy source to clipboard"
)
end
end
...
...
app/models/blob.rb
View file @
0bde54c3
...
@@ -27,11 +27,8 @@ class Blob < SimpleDelegator
...
@@ -27,11 +27,8 @@ class Blob < SimpleDelegator
BlobViewer
::
Image
,
BlobViewer
::
Image
,
BlobViewer
::
Sketch
,
BlobViewer
::
Sketch
,
<<<<<<<
HEAD
=======
BlobViewer
::
Video
,
BlobViewer
::
Video
,
>>>>>>>
ce
-
com
/
master
BlobViewer
::
PDF
,
BlobViewer
::
PDF
,
BlobViewer
::
BinarySTL
,
BlobViewer
::
BinarySTL
,
...
...
app/views/projects/blob/_header.html.haml
View file @
0bde54c3
...
@@ -15,13 +15,8 @@
...
@@ -15,13 +15,8 @@
=
render
'projects/blob/viewer_switcher'
,
blob:
blob
unless
blame
=
render
'projects/blob/viewer_switcher'
,
blob:
blob
unless
blame
.btn-group
{
role:
"group"
}
<
.btn-group
{
role:
"group"
}
<
<<<<<<<
HEAD
=
copy_blob_source_button
(
blob
)
if
!
blame
&&
blob
.
rendered_as_text?
(
ignore_errors:
false
)
=
open_raw_file_button
(
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
@id
))
==
=====
=
copy_blob_source_button
(
blob
)
unless
blame
=
copy_blob_source_button
(
blob
)
unless
blame
=
open_raw_blob_button
(
blob
)
=
open_raw_blob_button
(
blob
)
>
>>>>>> ce-com/master
=
view_on_environment_button
(
@commit
.
sha
,
@path
,
@environment
)
if
@environment
=
view_on_environment_button
(
@commit
.
sha
,
@path
,
@environment
)
if
@environment
.btn-group
{
role:
"group"
}
<
.btn-group
{
role:
"group"
}
<
...
@@ -41,12 +36,9 @@
...
@@ -41,12 +36,9 @@
tree_join
(
@commit
.
sha
,
@path
)),
class:
'btn btn-sm js-data-file-blob-permalink-url'
tree_join
(
@commit
.
sha
,
@path
)),
class:
'btn btn-sm js-data-file-blob-permalink-url'
.btn-group
{
role:
"group"
}
<
.btn-group
{
role:
"group"
}
<
<<<<<<<
HEAD
-
if
current_user
-
if
current_user
=
lock_file_link
(
html_options:
{
class:
'btn btn-sm path-lock'
})
=
lock_file_link
(
html_options:
{
class:
'btn btn-sm path-lock'
})
==
=====
>
>>>>>> ce-com/master
=
edit_blob_link
if
blob
.
readable_text?
=
edit_blob_link
if
blob
.
readable_text?
-
if
current_user
-
if
current_user
=
replace_blob_link
=
replace_blob_link
...
...
app/views/projects/blob/viewers/_markup.html.haml
View file @
0bde54c3
-
blob
=
viewer
.
blob
-
blob
=
viewer
.
blob
<
<<<<<<
HEAD
.file-content.wiki
=
markup
(
blob
.
name
,
blob
.
data
)
==
=====
-
rendered_markup
=
blob
.
rendered_markup
if
blob
.
respond_to?
(
:rendered_markup
)
-
rendered_markup
=
blob
.
rendered_markup
if
blob
.
respond_to?
(
:rendered_markup
)
.file-content.wiki
.file-content.wiki
=
markup
(
blob
.
name
,
blob
.
data
,
rendered:
rendered_markup
)
=
markup
(
blob
.
name
,
blob
.
data
,
rendered:
rendered_markup
)
>
>>>>>> ce-com/master
app/views/shared/snippets/_blob.html.haml
View file @
0bde54c3
...
@@ -15,13 +15,8 @@
...
@@ -15,13 +15,8 @@
=
render
'projects/blob/viewer_switcher'
,
blob:
blob
=
render
'projects/blob/viewer_switcher'
,
blob:
blob
.btn-group
{
role:
"group"
}
<
.btn-group
{
role:
"group"
}
<
<<<<<<<
HEAD
=
copy_blob_source_button
(
@snippet
)
=
open_raw_file_button
(
raw_path
)
==
=====
=
copy_blob_source_button
(
blob
)
=
copy_blob_source_button
(
blob
)
=
open_raw_blob_button
(
blob
)
=
open_raw_blob_button
(
blob
)
>
>>>>>> ce-com/master
-
if
defined?
(
download_path
)
&&
download_path
-
if
defined?
(
download_path
)
&&
download_path
=
link_to
icon
(
'download'
),
download_path
,
class:
"btn btn-sm has-tooltip"
,
title:
'Download'
,
data:
{
container:
'body'
}
=
link_to
icon
(
'download'
),
download_path
,
class:
"btn btn-sm has-tooltip"
,
title:
'Download'
,
data:
{
container:
'body'
}
...
...
spec/features/projects/blobs/blob_show_spec.rb
View file @
0bde54c3
require
'spec_helper'
require
'spec_helper'
feature
'File blob'
,
:js
,
feature:
true
do
feature
'File blob'
,
:js
,
feature:
true
do
<<<<<<<
HEAD
include
TreeHelper
include
WaitForAjax
let
(
:project
)
{
create
(
:project
,
:public
)
}
def
visit_blob
(
path
,
fragment
=
nil
)
visit
namespace_project_blob_path
(
project
.
namespace
,
project
,
tree_join
(
'master'
,
path
),
anchor:
fragment
)
end
context
'Ruby file'
do
before
do
visit_blob
(
'files/ruby/popen.rb'
)
wait_for_ajax
end
it
'displays the blob'
do
aggregate_failures
do
# shows highlighted Ruby code
expect
(
page
).
to
have_content
(
"require 'fileutils'"
)
# does not show a viewer switcher
expect
(
page
).
not_to
have_selector
(
'.js-blob-viewer-switcher'
)
# shows an enabled copy button
expect
(
page
).
to
have_selector
(
'.js-copy-blob-source-btn:not(.disabled)'
)
end
end
end
context
'Markdown file'
do
context
'visiting directly'
do
before
do
visit_blob
(
'files/markdown/ruby-style-guide.md'
)
wait_for_ajax
end
it
'displays the blob'
do
aggregate_failures
do
# hides the simple viewer
expect
(
page
).
to
have_selector
(
'.blob-viewer[data-type="simple"]'
,
visible:
false
)
expect
(
page
).
to
have_selector
(
'.blob-viewer[data-type="rich"]'
)
# shows rendered Markdown
expect
(
page
).
to
have_link
(
"PEP-8"
)
# shows a viewer switcher
expect
(
page
).
to
have_selector
(
'.js-blob-viewer-switcher'
)
# shows a disabled copy button
expect
(
page
).
to
have_selector
(
'.js-copy-blob-source-btn.disabled'
)
end
end
context
'switching to the simple viewer'
do
before
do
find
(
'.js-blob-viewer-switch-btn[data-viewer=simple]'
).
click
wait_for_ajax
end
it
'displays the blob'
do
aggregate_failures
do
# hides the rich viewer
expect
(
page
).
to
have_selector
(
'.blob-viewer[data-type="simple"]'
)
expect
(
page
).
to
have_selector
(
'.blob-viewer[data-type="rich"]'
,
visible:
false
)
# shows highlighted Markdown code
expect
(
page
).
to
have_content
(
"[PEP-8](http://www.python.org/dev/peps/pep-0008/)"
)
# shows an enabled copy button
expect
(
page
).
to
have_selector
(
'.js-copy-blob-source-btn:not(.disabled)'
)
end
end
context
'switching to the rich viewer again'
do
before
do
find
(
'.js-blob-viewer-switch-btn[data-viewer=rich]'
).
click
wait_for_ajax
end
it
'displays the blob'
do
aggregate_failures
do
# hides the simple viewer
expect
(
page
).
to
have_selector
(
'.blob-viewer[data-type="simple"]'
,
visible:
false
)
expect
(
page
).
to
have_selector
(
'.blob-viewer[data-type="rich"]'
)
# shows an enabled copy button
expect
(
page
).
to
have_selector
(
'.js-copy-blob-source-btn:not(.disabled)'
)
end
end
end
=======
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
def
visit_blob
(
path
,
fragment
=
nil
)
def
visit_blob
(
path
,
fragment
=
nil
)
...
@@ -639,7 +543,6 @@ feature 'File blob', :js, feature: true do
...
@@ -639,7 +543,6 @@ feature 'File blob', :js, feature: true do
# shows a download button
# shows a download button
expect
(
page
).
to
have_link
(
'Download'
)
expect
(
page
).
to
have_link
(
'Download'
)
>>>>>>>
ce
-
com
/
master
end
end
end
end
end
end
...
...
spec/helpers/blob_helper_spec.rb
View file @
0bde54c3
...
@@ -157,10 +157,7 @@ describe BlobHelper do
...
@@ -157,10 +157,7 @@ describe BlobHelper do
describe
'#blob_render_error_options'
do
describe
'#blob_render_error_options'
do
before
do
before
do
assign
(
:project
,
project
)
assign
(
:project
,
project
)
<<<<<<<
HEAD
=======
assign
(
:blob
,
blob
)
assign
(
:blob
,
blob
)
>>>>>>>
ce
-
com
/
master
assign
(
:id
,
File
.
join
(
'master'
,
blob
.
path
))
assign
(
:id
,
File
.
join
(
'master'
,
blob
.
path
))
controller
.
params
[
:controller
]
=
'projects/blob'
controller
.
params
[
:controller
]
=
'projects/blob'
...
...
spec/views/projects/blob/_viewer.html.haml_spec.rb
View file @
0bde54c3
...
@@ -21,10 +21,7 @@ describe 'projects/blob/_viewer.html.haml', :view do
...
@@ -21,10 +21,7 @@ describe 'projects/blob/_viewer.html.haml', :view do
before
do
before
do
assign
(
:project
,
project
)
assign
(
:project
,
project
)
<<<<<<<
HEAD
=======
assign
(
:blob
,
blob
)
assign
(
:blob
,
blob
)
>>>>>>>
ce
-
com
/
master
assign
(
:id
,
File
.
join
(
'master'
,
blob
.
path
))
assign
(
:id
,
File
.
join
(
'master'
,
blob
.
path
))
controller
.
params
[
:controller
]
=
'projects/blob'
controller
.
params
[
:controller
]
=
'projects/blob'
...
...
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