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
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
Show 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 @@
...
@@ -2,6 +2,7 @@
import
Visibility
from
'
visibilityjs
'
;
import
Visibility
from
'
visibilityjs
'
;
import
Poll
from
'
./../lib/utils/poll
'
;
import
Poll
from
'
./../lib/utils/poll
'
;
import
Service
from
'
./services/index
'
;
import
Service
from
'
./services/index
'
;
import
tasks
from
'
./actions/tasks
'
;
export
default
{
export
default
{
props
:
{
props
:
{
...
@@ -30,14 +31,13 @@ export default {
...
@@ -30,14 +31,13 @@ export default {
return
{
return
{
poll
,
poll
,
apiData
:
{},
apiData
:
{},
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
,
tasks
:
'
0 of 0
'
,
};
};
},
},
methods
:
{
methods
:
{
...
@@ -46,18 +46,7 @@ export default {
...
@@ -46,18 +46,7 @@ export default {
this
.
triggerAnimation
();
this
.
triggerAnimation
();
},
},
updateTaskHTML
()
{
updateTaskHTML
()
{
const
tasks
=
document
.
querySelector
(
'
#task_status_short
'
);
tasks
(
this
.
apiData
,
this
.
tasks
);
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
();
}
},
},
elementsToVisualize
(
noTitleChange
,
noDescriptionChange
)
{
elementsToVisualize
(
noTitleChange
,
noDescriptionChange
)
{
const
elementStack
=
[];
const
elementStack
=
[];
...
@@ -71,11 +60,7 @@ export default {
...
@@ -71,11 +60,7 @@ export default {
// 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
;
this
.
updateTaskHTML
();
this
.
updateTaskHTML
();
this
.
tasks
=
this
.
apiData
.
task_status
;
if
(
this
.
description
!==
'
<span></span>
'
)
{
this
.
previousDescription
=
this
.
description
;
}
elementStack
.
push
(
this
.
$el
.
querySelector
(
'
.wiki
'
));
elementStack
.
push
(
this
.
$el
.
querySelector
(
'
.wiki
'
));
}
}
...
@@ -129,24 +114,18 @@ export default {
...
@@ -129,24 +114,18 @@ export default {
this
.
animate
(
title
,
description
,
elementsToVisualize
);
this
.
animate
(
title
,
description
,
elementsToVisualize
);
},
},
handleCurrentOrPrevious
()
{
updateEditedTimeAgo
()
{
this
.
descriptionChange
=
true
;
const
toolTipTime
=
gl
.
utils
.
formatDate
(
this
.
apiData
.
updated_at
);
this
.
current
=
!
this
.
current
;
const
$timeAgoNode
=
$
(
'
.issue_edited_ago
'
);
$timeAgoNode
.
attr
(
'
datetime
'
,
this
.
apiData
.
updated_at
);
$timeAgoNode
.
attr
(
'
data-original-title
'
,
toolTipTime
);
},
},
},
},
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
())
{
...
@@ -164,18 +143,19 @@ export default {
...
@@ -164,18 +143,19 @@ 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
.
updateEditedTimeAgo
();
$
(
this
.
$refs
[
'
issue-content-container-gfm-entry
'
]).
renderGFM
();
$
(
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
'
,
});
});
return
tl
;
return
tl
&&
null
;
}
}
}
return
null
;
return
null
;
},
},
};
};
...
@@ -188,17 +168,9 @@ export default {
...
@@ -188,17 +168,9 @@ 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=
"
showD
escription"
v-html=
"
d
escription"
ref=
"issue-content-container-gfm-entry"
ref=
"issue-content-container-gfm-entry"
>
>
</div>
</div>
...
...
app/controllers/projects/issues_controller.rb
View file @
290cba5b
...
@@ -206,6 +206,7 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -206,6 +206,7 @@ class Projects::IssuesController < Projects::ApplicationController
description_text:
@issue
.
description
,
description_text:
@issue
.
description
,
task_status:
@issue
.
task_status
,
task_status:
@issue
.
task_status
,
issue_number:
@issue
.
iid
,
issue_number:
@issue
.
iid
,
updated_at:
@issue
.
updated_at
,
}
}
end
end
...
...
app/views/projects/issues/_issue.html.haml
View file @
290cba5b
...
@@ -37,10 +37,6 @@
...
@@ -37,10 +37,6 @@
-
issue
.
labels
.
each
do
|
label
|
-
issue
.
labels
.
each
do
|
label
|
=
link_to_label
(
label
,
subject:
issue
.
project
,
css_class:
'label-link'
)
=
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
.pull-right.issue-updated-at
%span
updated
#{
time_ago_with_tooltip
(
issue
.
updated_at
,
placement:
'bottom'
,
html_class:
'issue_update_ago'
)
}
%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