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
78a8be96
Commit
78a8be96
authored
May 01, 2017
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make tab title legit
parent
f2326440
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
4 deletions
+21
-4
app/assets/javascripts/issue_show/issue_title_description.vue
...assets/javascripts/issue_show/issue_title_description.vue
+12
-2
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+2
-0
spec/javascripts/issue_show/issue_title_description_spec.js
spec/javascripts/issue_show/issue_title_description_spec.js
+4
-2
spec/javascripts/issue_show/mock_data.js
spec/javascripts/issue_show/mock_data.js
+3
-0
No files found.
app/assets/javascripts/issue_show/issue_title_description.vue
View file @
78a8be96
...
@@ -31,6 +31,7 @@ export default {
...
@@ -31,6 +31,7 @@ export default {
poll
,
poll
,
timeoutId
:
null
,
timeoutId
:
null
,
title
:
'
<span></span>
'
,
title
:
'
<span></span>
'
,
titleText
:
''
,
description
:
'
<span></span>
'
,
description
:
'
<span></span>
'
,
descriptionText
:
''
,
descriptionText
:
''
,
descriptionChange
:
false
,
descriptionChange
:
false
,
...
@@ -40,16 +41,18 @@ export default {
...
@@ -40,16 +41,18 @@ export default {
methods
:
{
methods
:
{
renderResponse
(
res
)
{
renderResponse
(
res
)
{
const
data
=
JSON
.
parse
(
res
.
body
);
const
data
=
JSON
.
parse
(
res
.
body
);
this
.
issueIID
=
data
.
issue_number
;
this
.
triggerAnimation
(
data
);
this
.
triggerAnimation
(
data
);
},
},
updateTaskHTML
(
data
)
{
updateTaskHTML
(
data
)
{
this
.
taskStatus
=
data
.
task_status
;
this
.
taskStatus
=
data
.
task_status
;
document
.
querySelector
(
'
#task_status
'
).
innerText
=
this
.
taskStatus
;
document
.
querySelector
(
'
#task_status
'
).
innerText
=
this
.
taskStatus
;
},
},
elementsToVisualize
(
noTitleChange
,
noDescriptionChange
)
{
elementsToVisualize
(
noTitleChange
,
noDescriptionChange
,
data
)
{
const
elementStack
=
[];
const
elementStack
=
[];
if
(
!
noTitleChange
)
{
if
(
!
noTitleChange
)
{
this
.
titleText
=
data
.
title_text
;
elementStack
.
push
(
this
.
$el
.
querySelector
(
'
.title
'
));
elementStack
.
push
(
this
.
$el
.
querySelector
(
'
.title
'
));
}
}
...
@@ -66,11 +69,17 @@ export default {
...
@@ -66,11 +69,17 @@ export default {
return
elementStack
;
return
elementStack
;
},
},
setTabTitle
()
{
const
currentTabTitle
=
document
.
querySelector
(
'
title
'
);
const
currentTabTitleScope
=
currentTabTitle
.
innerText
.
split
(
'
·
'
);
currentTabTitleScope
[
0
]
=
`
${
this
.
titleText
}
(#
${
this
.
issueIID
}
) `
;
currentTabTitle
.
innerText
=
currentTabTitleScope
.
join
(
'
·
'
);
},
animate
(
title
,
description
,
elementsToVisualize
)
{
animate
(
title
,
description
,
elementsToVisualize
)
{
this
.
timeoutId
=
setTimeout
(()
=>
{
this
.
timeoutId
=
setTimeout
(()
=>
{
this
.
title
=
title
;
this
.
title
=
title
;
this
.
description
=
description
;
this
.
description
=
description
;
document
.
querySelector
(
'
title
'
).
innerText
=
title
;
this
.
setTabTitle
()
;
elementsToVisualize
.
forEach
((
element
)
=>
{
elementsToVisualize
.
forEach
((
element
)
=>
{
element
.
classList
.
remove
(
'
issue-realtime-pre-pulse
'
);
element
.
classList
.
remove
(
'
issue-realtime-pre-pulse
'
);
...
@@ -99,6 +108,7 @@ export default {
...
@@ -99,6 +108,7 @@ export default {
const
elementsToVisualize
=
this
.
elementsToVisualize
(
const
elementsToVisualize
=
this
.
elementsToVisualize
(
noTitleChange
,
noTitleChange
,
noDescriptionChange
,
noDescriptionChange
,
data
,
);
);
this
.
animate
(
title
,
description
,
elementsToVisualize
);
this
.
animate
(
title
,
description
,
elementsToVisualize
);
...
...
app/controllers/projects/issues_controller.rb
View file @
78a8be96
...
@@ -201,9 +201,11 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -201,9 +201,11 @@ class Projects::IssuesController < Projects::ApplicationController
render
json:
{
render
json:
{
title:
view_context
.
markdown_field
(
@issue
,
:title
),
title:
view_context
.
markdown_field
(
@issue
,
:title
),
title_text:
@issue
.
title
,
description:
view_context
.
markdown_field
(
@issue
,
:description
),
description:
view_context
.
markdown_field
(
@issue
,
:description
),
description_text:
@issue
.
description
,
description_text:
@issue
.
description
,
task_status:
@issue
.
task_status
,
task_status:
@issue
.
task_status
,
issue_number:
@issue
.
iid
,
}
}
end
end
...
...
spec/javascripts/issue_show/issue_title_description_spec.js
View file @
78a8be96
...
@@ -13,7 +13,9 @@ const issueShowInterceptor = (request, next) => {
...
@@ -13,7 +13,9 @@ const issueShowInterceptor = (request, next) => {
}));
}));
};
};
describe
(
'
Issue Title
'
,
()
=>
{
fdescribe
(
'
Issue Title
'
,
()
=>
{
document
.
body
.
innerHTML
=
'
<span id="task_status"></span>
'
;
const
comps
=
{
const
comps
=
{
IssueTitleComponent
:
{},
IssueTitleComponent
:
{},
};
};
...
@@ -40,7 +42,7 @@ describe('Issue Title', () => {
...
@@ -40,7 +42,7 @@ describe('Issue Title', () => {
// need setTimeout because actual setTimeout in code :P
// need setTimeout because actual setTimeout in code :P
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
document
.
querySelector
(
'
title
'
).
innerText
)
expect
(
document
.
querySelector
(
'
title
'
).
innerText
)
.
toContain
(
'
this is a title
'
);
.
toContain
(
'
this is a title
(#1)
'
);
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.title
'
).
innerHTML
)
expect
(
issueShowComponent
.
$el
.
querySelector
(
'
.title
'
).
innerHTML
)
.
toContain
(
'
<p>this is a title</p>
'
);
.
toContain
(
'
<p>this is a title</p>
'
);
...
...
spec/javascripts/issue_show/mock_data.js
View file @
78a8be96
export
default
{
export
default
{
title
:
'
<p>this is a title</p>
'
,
title
:
'
<p>this is a title</p>
'
,
title_text
:
'
this is a title
'
,
description
:
'
<p>this is a description!</p>
'
,
description
:
'
<p>this is a description!</p>
'
,
description_text
:
'
this is a description
'
,
description_text
:
'
this is a description
'
,
issue_number
:
1
,
task_status
:
'
2/4 completed
'
,
};
};
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