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
290cba5b
Commit
290cba5b
authored
May 02, 2017
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove curr and previous states - extract tasks logic to tasks action
parent
e2bc67c9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
52 deletions
+48
-52
app/assets/javascripts/issue_show/actions/tasks.js
app/assets/javascripts/issue_show/actions/tasks.js
+27
-0
app/assets/javascripts/issue_show/issue_title_description.vue
...assets/javascripts/issue_show/issue_title_description.vue
+20
-48
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-0
app/views/projects/issues/_issue.html.haml
app/views/projects/issues/_issue.html.haml
+0
-4
No files found.
app/assets/javascripts/issue_show/actions/tasks.js
0 → 100644
View file @
290cba5b
export
default
(
apiData
,
tasks
)
=>
{
const
$tasks
=
$
(
'
#task_status
'
);
const
$tasksShort
=
$
(
'
#task_status_short
'
);
const
$issueableHeader
=
$
(
'
.issuable-header
'
);
const
zeroData
=
{
api
:
null
,
tasks
:
null
};
if
(
$tasks
.
length
===
0
)
{
if
(
!
(
apiData
.
task_status
.
indexOf
(
'
0 of 0
'
)
>=
0
))
{
$issueableHeader
.
append
(
`<span id="task_status">
${
apiData
.
task_status
}
</span>`
);
}
else
{
$issueableHeader
.
append
(
'
<span id="task_status"></span>
'
);
}
}
else
{
zeroData
.
api
=
apiData
.
task_status
.
indexOf
(
'
0 of 0
'
)
>=
0
;
zeroData
.
tasks
=
tasks
.
indexOf
(
'
0 of 0
'
)
>=
0
;
}
if
(
$tasks
&&
!
zeroData
.
api
)
{
$tasks
.
text
(
apiData
.
task_status
);
$tasksShort
.
text
(
apiData
.
task_status
);
}
else
if
(
zeroData
.
tasks
)
{
$issueableHeader
.
append
(
`<span id="task_status">
${
apiData
.
task_status
}
</span>`
);
}
else
if
(
zeroData
.
api
)
{
$tasks
.
remove
();
$tasksShort
.
remove
();
}
};
app/assets/javascripts/issue_show/issue_title_description.vue
View file @
290cba5b
...
...
@@ -2,6 +2,7 @@
import
Visibility
from
'
visibilityjs
'
;
import
Poll
from
'
./../lib/utils/poll
'
;
import
Service
from
'
./services/index
'
;
import
tasks
from
'
./actions/tasks
'
;
export
default
{
props
:
{
...
...
@@ -30,14 +31,13 @@ export default {
return
{
poll
,
apiData
:
{},
current
:
true
,
timeoutId
:
null
,
title
:
'
<span></span>
'
,
titleText
:
''
,
description
:
'
<span></span>
'
,
descriptionText
:
''
,
descriptionChange
:
false
,
previousDescription
:
null
,
tasks
:
'
0 of 0
'
,
};
},
methods
:
{
...
...
@@ -46,18 +46,7 @@ export default {
this
.
triggerAnimation
();
},
updateTaskHTML
()
{
const
tasks
=
document
.
querySelector
(
'
#task_status_short
'
);
const
zeroTasks
=
this
.
apiData
.
task_status
.
indexOf
(
'
0 of 0
'
)
>=
0
;
if
(
tasks
&&
!
zeroTasks
)
{
tasks
.
innerText
=
this
.
apiData
.
task_status
;
}
else
if
(
!
tasks
&&
!
zeroTasks
)
{
$
(
'
.issuable-header
'
).
append
(
`
<span id="task_status_short" class="hidden-md hidden-lg">
${
this
.
apiData
.
task_status
}
</span>
`
);
}
else
if
(
zeroTasks
)
{
$
(
'
#task_status_short
'
).
remove
();
}
tasks
(
this
.
apiData
,
this
.
tasks
);
},
elementsToVisualize
(
noTitleChange
,
noDescriptionChange
)
{
const
elementStack
=
[];
...
...
@@ -71,11 +60,7 @@ export default {
// only change to true when we need to bind TaskLists the html of description
this
.
descriptionChange
=
true
;
this
.
updateTaskHTML
();
if
(
this
.
description
!==
'
<span></span>
'
)
{
this
.
previousDescription
=
this
.
description
;
}
this
.
tasks
=
this
.
apiData
.
task_status
;
elementStack
.
push
(
this
.
$el
.
querySelector
(
'
.wiki
'
));
}
...
...
@@ -129,24 +114,18 @@ export default {
this
.
animate
(
title
,
description
,
elementsToVisualize
);
},
handleCurrentOrPrevious
()
{
this
.
descriptionChange
=
true
;
this
.
current
=
!
this
.
current
;
updateEditedTimeAgo
()
{
const
toolTipTime
=
gl
.
utils
.
formatDate
(
this
.
apiData
.
updated_at
);
const
$timeAgoNode
=
$
(
'
.issue_edited_ago
'
);
$timeAgoNode
.
attr
(
'
datetime
'
,
this
.
apiData
.
updated_at
);
$timeAgoNode
.
attr
(
'
data-original-title
'
,
toolTipTime
);
},
},
computed
:
{
descriptionClass
()
{
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
()
{
if
(
!
Visibility
.
hidden
())
{
...
...
@@ -164,18 +143,19 @@ export default {
updated
()
{
// if new html is injected (description changed) - bind TaskList and call renderGFM
if
(
this
.
descriptionChange
)
{
this
.
updateEditedTimeAgo
();
$
(
this
.
$refs
[
'
issue-content-container-gfm-entry
'
]).
renderGFM
();
if
(
this
.
current
)
{
const
tl
=
new
gl
.
TaskList
({
dataType
:
'
issue
'
,
fieldName
:
'
description
'
,
selector
:
'
.detail-page-description
'
,
});
const
tl
=
new
gl
.
TaskList
({
dataType
:
'
issue
'
,
fieldName
:
'
description
'
,
selector
:
'
.detail-page-description
'
,
});
return
tl
;
}
return
tl
&&
null
;
}
return
null
;
},
};
...
...
@@ -188,17 +168,9 @@ export default {
:class=
"descriptionClass"
v-if=
"description"
>
<div
v-if=
"previousDescription"
>
<button
:class=
"prevCurrBtnClass"
@
click=
"handleCurrentOrPrevious"
>
{{
previousOrCurrentButtonText
}}
</button>
</div><br>
<div
class=
"wiki issue-realtime-trigger-pulse"
v-html=
"
showD
escription"
v-html=
"
d
escription"
ref=
"issue-content-container-gfm-entry"
>
</div>
...
...
app/controllers/projects/issues_controller.rb
View file @
290cba5b
...
...
@@ -206,6 +206,7 @@ class Projects::IssuesController < Projects::ApplicationController
description_text:
@issue
.
description
,
task_status:
@issue
.
task_status
,
issue_number:
@issue
.
iid
,
updated_at:
@issue
.
updated_at
,
}
end
...
...
app/views/projects/issues/_issue.html.haml
View file @
290cba5b
...
...
@@ -37,10 +37,6 @@
-
issue
.
labels
.
each
do
|
label
|
=
link_to_label
(
label
,
subject:
issue
.
project
,
css_class:
'label-link'
)
-
if
issue
.
tasks?
%span
.task-status
=
issue
.
task_status
.pull-right.issue-updated-at
%span
updated
#{
time_ago_with_tooltip
(
issue
.
updated_at
,
placement:
'bottom'
,
html_class:
'issue_update_ago'
)
}
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