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
Jérome Perrin
gitlab-ce
Commits
a194e874
Commit
a194e874
authored
May 01, 2017
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
previous and current description
parent
78a8be96
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
22 deletions
+54
-22
app/assets/javascripts/issue_show/issue_title_description.vue
...assets/javascripts/issue_show/issue_title_description.vue
+53
-21
spec/javascripts/issue_show/issue_title_description_spec.js
spec/javascripts/issue_show/issue_title_description_spec.js
+1
-1
No files found.
app/assets/javascripts/issue_show/issue_title_description.vue
View file @
a194e874
...
@@ -29,36 +29,43 @@ export default {
...
@@ -29,36 +29,43 @@ export default {
return
{
return
{
poll
,
poll
,
data
:
{},
current
:
true
,
timeoutId
:
null
,
timeoutId
:
null
,
title
:
'
<span></span>
'
,
title
:
'
<span></span>
'
,
titleText
:
''
,
titleText
:
''
,
description
:
'
<span></span>
'
,
description
:
'
<span></span>
'
,
descriptionText
:
''
,
descriptionText
:
''
,
descriptionChange
:
false
,
descriptionChange
:
false
,
previousDescription
:
null
,
taskStatus
:
''
,
taskStatus
:
''
,
};
};
},
},
methods
:
{
methods
:
{
renderResponse
(
res
)
{
renderResponse
(
res
)
{
const
data
=
JSON
.
parse
(
res
.
body
);
const
data
=
JSON
.
parse
(
res
.
body
);
this
.
issueIID
=
data
.
issue_number
;
this
.
data
=
data
;
this
.
issueIID
=
this
.
data
.
issue_number
;
this
.
triggerAnimation
(
data
);
this
.
triggerAnimation
(
data
);
},
},
updateTaskHTML
(
data
)
{
updateTaskHTML
()
{
this
.
taskStatus
=
data
.
task_status
;
this
.
taskStatus
=
this
.
data
.
task_status
;
document
.
querySelector
(
'
#task_status
'
).
innerText
=
this
.
taskStatus
;
document
.
querySelector
(
'
#task_status
'
).
innerText
=
this
.
taskStatus
;
},
},
elementsToVisualize
(
noTitleChange
,
noDescriptionChange
,
data
)
{
elementsToVisualize
(
noTitleChange
,
noDescriptionChange
)
{
const
elementStack
=
[];
const
elementStack
=
[];
if
(
!
noTitleChange
)
{
if
(
!
noTitleChange
)
{
this
.
titleText
=
data
.
title_text
;
this
.
titleText
=
this
.
data
.
title_text
;
elementStack
.
push
(
this
.
$el
.
querySelector
(
'
.title
'
));
elementStack
.
push
(
this
.
$el
.
querySelector
(
'
.title
'
));
}
}
if
(
!
noDescriptionChange
)
{
if
(
!
noDescriptionChange
)
{
// only change to true when we need to bind TaskLists the html of description
// only change to true when we need to bind TaskLists the html of description
this
.
descriptionChange
=
true
;
this
.
descriptionChange
=
true
;
if
(
this
.
description
!==
'
<span></span>
'
)
{
this
.
previousDescription
=
this
.
description
;
}
elementStack
.
push
(
this
.
$el
.
querySelector
(
'
.wiki
'
));
elementStack
.
push
(
this
.
$el
.
querySelector
(
'
.wiki
'
));
}
}
...
@@ -89,35 +96,49 @@ export default {
...
@@ -89,35 +96,49 @@ export default {
clearTimeout
(
this
.
timeoutId
);
clearTimeout
(
this
.
timeoutId
);
},
0
);
},
0
);
},
},
triggerAnimation
(
data
)
{
triggerAnimation
()
{
// always reset to false before checking the change
// always reset to false before checking the change
this
.
descriptionChange
=
false
;
this
.
descriptionChange
=
false
;
const
{
title
,
description
}
=
data
;
const
{
title
,
description
}
=
this
.
data
;
this
.
descriptionText
=
data
.
description_text
;
this
.
descriptionText
=
this
.
data
.
description_text
;
this
.
updateTaskHTML
(
data
);
this
.
updateTaskHTML
();
const
noTitleChange
=
this
.
title
===
title
;
const
noDescriptionChange
=
this
.
description
===
description
;
/**
/**
* since opacity is changed, even if there is no diff for Vue to update
* since opacity is changed, even if there is no diff for Vue to update
* we must check the title/description even on a 304 to ensure no visual change
* we must check the title/description even on a 304 to ensure no visual change
*/
*/
const
noTitleChange
=
this
.
title
===
title
;
const
noDescriptionChange
=
this
.
description
===
description
;
if
(
noTitleChange
&&
noDescriptionChange
)
return
;
if
(
noTitleChange
&&
noDescriptionChange
)
return
;
const
elementsToVisualize
=
this
.
elementsToVisualize
(
const
elementsToVisualize
=
this
.
elementsToVisualize
(
noTitleChange
,
noTitleChange
,
noDescriptionChange
,
noDescriptionChange
,
data
,
);
);
this
.
animate
(
title
,
description
,
elementsToVisualize
);
this
.
animate
(
title
,
description
,
elementsToVisualize
);
},
},
handleCurrentOrPrevious
()
{
this
.
descriptionChange
=
true
;
this
.
current
=
!
this
.
current
;
},
},
},
computed
:
{
computed
:
{
descriptionClass
()
{
descriptionClass
()
{
return
`description
${
this
.
candescription
}
is-task-list-enabled`
;
return
`description
${
this
.
candescription
}
is-task-list-enabled`
;
},
},
showDescription
()
{
return
this
.
current
?
this
.
description
:
this
.
previousDescription
;
},
previousOrCurrentButtonText
()
{
return
this
.
current
?
'
<< Show Previous Decription
'
:
'
Show Current Description >>
'
;
},
prevCurrBtnClass
()
{
return
this
.
current
?
'
btn btn-sm btn-default
'
:
'
btn btn-sm btn-primary
'
;
},
},
},
created
()
{
created
()
{
if
(
!
Visibility
.
hidden
())
{
if
(
!
Visibility
.
hidden
())
{
...
@@ -135,15 +156,18 @@ export default {
...
@@ -135,15 +156,18 @@ export default {
updated
()
{
updated
()
{
// if new html is injected (description changed) - bind TaskList and call renderGFM
// if new html is injected (description changed) - bind TaskList and call renderGFM
if
(
this
.
descriptionChange
)
{
if
(
this
.
descriptionChange
)
{
$
(
this
.
$refs
[
'
issue-content-container-gfm-entry
'
]).
renderGFM
();
if
(
this
.
current
)
{
const
tl
=
new
gl
.
TaskList
({
const
tl
=
new
gl
.
TaskList
({
dataType
:
'
issue
'
,
dataType
:
'
issue
'
,
fieldName
:
'
description
'
,
fieldName
:
'
description
'
,
selector
:
'
.detail-page-description
'
,
selector
:
'
.detail-page-description
'
,
});
});
$
(
this
.
$refs
[
'
issue-content-container-gfm-entry
'
]).
renderGFM
();
return
tl
;
return
tl
;
}
}
}
return
null
;
return
null
;
},
},
};
};
...
@@ -156,9 +180,17 @@ export default {
...
@@ -156,9 +180,17 @@ export default {
:class=
"descriptionClass"
:class=
"descriptionClass"
v-if=
"description"
v-if=
"description"
>
>
<div
v-if=
"previousDescription"
>
<button
:class=
"prevCurrBtnClass"
@
click=
"handleCurrentOrPrevious"
>
{{
previousOrCurrentButtonText
}}
</button>
</div><br>
<div
<div
class=
"wiki issue-realtime-trigger-pulse"
class=
"wiki issue-realtime-trigger-pulse"
v-html=
"
d
escription"
v-html=
"
showD
escription"
ref=
"issue-content-container-gfm-entry"
ref=
"issue-content-container-gfm-entry"
>
>
</div>
</div>
...
...
spec/javascripts/issue_show/issue_title_description_spec.js
View file @
a194e874
...
@@ -13,7 +13,7 @@ const issueShowInterceptor = (request, next) => {
...
@@ -13,7 +13,7 @@ const issueShowInterceptor = (request, next) => {
}));
}));
};
};
f
describe
(
'
Issue Title
'
,
()
=>
{
describe
(
'
Issue Title
'
,
()
=>
{
document
.
body
.
innerHTML
=
'
<span id="task_status"></span>
'
;
document
.
body
.
innerHTML
=
'
<span id="task_status"></span>
'
;
const
comps
=
{
const
comps
=
{
...
...
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