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
Léo-Paul Géneau
gitlab-ce
Commits
4931a836
Commit
4931a836
authored
Jul 12, 2016
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements to simplify vue template.
parent
9d70a4ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
31 deletions
+31
-31
app/assets/javascripts/merge_conflict_resolver.js.coffee
app/assets/javascripts/merge_conflict_resolver.js.coffee
+14
-12
app/views/projects/merge_requests/show/_conflicts.html.haml
app/views/projects/merge_requests/show/_conflicts.html.haml
+17
-19
No files found.
app/assets/javascripts/merge_conflict_resolver.js.coffee
View file @
4931a836
...
...
@@ -48,21 +48,23 @@ class window.MergeConflictResolver extends Vue
decorateData
:
(
data
)
->
headHeaderText
=
'HEAD//our changes'
originHeaderText
=
'origin//their changes'
for
file
in
data
.
files
file
.
parallelLines
=
{
left
:
[],
right
:
[]
}
file
.
inlineLines
=
[]
currentLineType
=
'old'
file
.
parallelLines
=
{
left
:
[],
right
:
[]
}
file
.
inlineLines
=
[]
file
.
shortCommitSha
=
file
.
commit_sha
.
slice
0
,
7
currentLineType
=
'old'
for
section
in
file
.
sections
{
conflict
,
lines
,
id
}
=
section
if
conflict
header
=
{
lineType
:
'header'
,
id
}
file
.
parallelLines
.
left
.
push
header
file
.
parallelLines
.
right
.
push
header
file
.
parallelLines
.
left
.
push
{
isHeader
:
yes
,
id
,
text
:
headHeaderText
,
cssClass
:
'head'
}
file
.
parallelLines
.
right
.
push
{
isHeader
:
yes
,
id
,
text
:
originHeaderText
,
cssClass
:
'origin'
}
header
.
type
=
'old'
file
.
inlineLines
.
push
header
file
.
inlineLines
.
push
{
isHeader
:
yes
,
id
,
text
:
headHeaderText
,
type
:
'old'
,
cssClass
:
'head'
}
for
line
in
lines
if
line
.
type
in
[
'new'
,
'old'
]
and
currentLineType
isnt
line
.
type
...
...
@@ -71,14 +73,15 @@ class window.MergeConflictResolver extends Vue
file
.
inlineLines
.
push
{
lineType
:
'emptyLine'
,
text
:
'<span> </span>'
}
line
.
conflict
=
conflict
line
.
cssClass
=
if
line
.
type
is
'old'
then
'head'
else
if
line
.
type
is
'new'
then
'origin'
else
''
file
.
inlineLines
.
push
line
if
conflict
if
line
.
type
is
'old'
line
=
{
lineType
:
'conflict'
,
lineNumber
:
line
.
old_line
,
text
:
line
.
text
}
line
=
{
lineType
:
'conflict'
,
lineNumber
:
line
.
old_line
,
text
:
line
.
text
,
cssClass
:
'head'
}
file
.
parallelLines
.
left
.
push
line
else
if
line
.
type
is
'new'
line
=
{
lineType
:
'conflict'
,
lineNumber
:
line
.
new_line
,
text
:
line
.
text
}
line
=
{
lineType
:
'conflict'
,
lineNumber
:
line
.
new_line
,
text
:
line
.
text
,
cssClass
:
'origin'
}
file
.
parallelLines
.
right
.
push
line
else
console
.
log
'unhandled line type...'
,
line
...
...
@@ -87,9 +90,8 @@ class window.MergeConflictResolver extends Vue
file
.
parallelLines
.
right
.
push
{
lineType
:
'context'
,
lineNumber
:
line
.
new_line
,
text
:
line
.
text
}
if
conflict
file
.
inlineLines
.
push
{
lineType
:
'header'
,
id
,
type
:
'new
'
}
file
.
inlineLines
.
push
{
isHeader
:
yes
,
id
,
type
:
'new'
,
text
:
originHeaderText
,
cssClass
:
'origin
'
}
console
.
log
data
return
data
...
...
app/views/projects/merge_requests/show/_conflicts.html.haml
View file @
4931a836
...
...
@@ -31,24 +31,24 @@
%a
%span
{{file.new_path}}
.file-actions
%a
.btn.btn-sm
View file @{{file.
commit_sha.slice(0, 7)
}}
%a
.btn.btn-sm
View file @{{file.
shortCommitSha
}}
.diff-content.diff-wrap-lines
.diff-wrap-lines.code.file-content.js-syntax-highlight.white
%table
{
"v-for"
=>
"(key, group) in file.parallelLines"
}
%tr
.line_holder.parallel
{
|
"v-for"
=>
"line in group"
,
|
":class"
=>
"line.lineType != 'context' && (key == 'left' ? 'head' : 'origin')"
}
%tr
.line_holder.parallel
{
"v-for"
=>
"line in group"
,
":class"
=>
"line.cssClass"
}
%td
.diff-line-num.header
{
"v-if"
=>
"line.lineType == 'header'"
}
%td
.line_content.header
{
"v-if"
=>
"line.lineType == 'header'"
}
%strong
{{key == 'left' ? 'HEAD//our changes' : 'origin//their changes'}}
%button
.btn
{
"@click"
=>
"handleSelected(line.id, line.lineType)"
}
Use this
%template
{
"v-if"
=>
"line.isHeader"
}
%td
.diff-line-num.header
%td
.line_content.header
%strong
{{line.text}}
%button
.btn
{
"@click"
=>
"handleSelected(line.id, line.lineType)"
}
Use this
%td
.diff-line-num.old_line
{
"v-if"
=>
"line.lineType != 'header'"
}
{{line.lineNumber}}
%td
.line_content
{
"v-if"
=>
"line.lineType != 'header'"
}
{{line.text}}
%template
{
"v-if"
=>
"!line.isHeader"
}
%td
.diff-line-num.old_line
{{line.lineNumber}}
%td
.line_content
{{line.text}}
.files
{{
"v-if"
=>
"!isParallel"
}}
...
...
@@ -58,16 +58,14 @@
%a
%span
{{file.new_path}}
.file-actions
%a
.btn.btn-sm
View file @{{file.
commit_sha.slice(0, 7)
}}
%a
.btn.btn-sm
View file @{{file.
shortCommitSha
}}
.diff-content.diff-wrap-lines
.diff-wrap-lines.code.file-content.js-syntax-highlight.white
%table
%tr
.line_holder
{
|
"v-for"
=>
"line in file.inlineLines"
,
|
":class"
=>
"line.type == 'old' ? 'head' : line.type == 'new' ? 'origin' : ''"
}
%tr
.line_holder
{
"v-for"
=>
"line in file.inlineLines"
,
":class"
=>
"line.cssClass"
}
%template
{
"v-if"
=>
"
line.lineType != 'header'
"
}
%template
{
"v-if"
=>
"
!line.isHeader
"
}
%td
.diff-line-num.old_line
%a
{{line.old_line}}
%td
.diff-line-num.new_line
...
...
@@ -75,9 +73,9 @@
%td
.line_content
{{{line.text}}}
%template
{
"v-if"
=>
"line.
lineType == 'header'
"
}
%template
{
"v-if"
=>
"line.
isHeader
"
}
%td
.diff-line-num.header
%td
.diff-line-num.header
%td
.line_content.header
%strong
{{line.t
ype == 'old' ? 'HEAD//our changes' : 'origin//their changes'
}}
%strong
{{line.t
ext
}}
%button
.btn
{
"@click"
=>
"handleSelected(line.id, line.type)"
}
Use this
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