BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
4917df5e
Commit
4917df5e
authored
Mar 15, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue boards list template in JS file
This is one step closer to making the transition to .vue files for issue boards
parent
65ea732c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
68 deletions
+105
-68
board.js
app/assets/javascripts/boards/components/board.js
+2
-1
board_list.js
app/assets/javascripts/boards/components/board_list.js
+100
-39
board_new_issue.js
app/assets/javascripts/boards/components/board_new_issue.js
+3
-1
_show.html.haml
app/views/projects/boards/_show.html.haml
+0
-1
_board_list.html.haml
app/views/projects/boards/components/_board_list.html.haml
+0
-26
No files found.
app/assets/javascripts/boards/components/board.js
View file @
4917df5e
/* eslint-disable comma-dangle, space-before-function-paren, one-var */
/* global Sortable */
import
boardList
from
'./board_list'
;
import
Vue
from
'vue'
;
import
boardBlankState
from
'./board_blank_state'
;
...
...
@@ -16,7 +17,7 @@ require('./board_list');
gl
.
issueBoards
.
Board
=
Vue
.
extend
({
template
:
'#js-board-template'
,
components
:
{
'board-list'
:
gl
.
issueBoards
.
B
oardList
,
b
oardList
,
'board-delete'
:
gl
.
issueBoards
.
BoardDelete
,
boardBlankState
,
},
...
...
app/assets/javascripts/boards/components/board_list.js
View file @
4917df5e
/* eslint-disable comma-dangle, space-before-function-paren, max-len */
/* global Sortable */
import
Vue
from
'vue'
;
import
boardNewIssue
from
'./board_new_issue'
;
import
boardCard
from
'./board_card'
;
import
eventHub
from
'../eventhub'
;
(()
=>
{
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
issueBoards
=
window
.
gl
.
issueBoards
||
{};
gl
.
issueBoards
.
BoardList
=
Vue
.
extend
({
template
:
'#js-board-list-template'
,
export
default
{
template
:
`
<div class="board-list-component">
<div
class="board-list-loading text-center"
v-if="loading">
<i class="fa fa-spinner fa-spin"></i>
</div>
<board-new-issue
:list="list"
v-if="list.type !== 'closed' && showIssueForm"/>
<ul
class="board-list"
v-show="!loading"
ref="list"
:data-board="list.id"
:class="{ 'is-smaller': showIssueForm }">
<board-card
v-for="(issue, index) in issues"
ref="issue"
:index="index"
:list="list"
:issue="issue"
:issue-link-base="issueLinkBase"
:root-path="rootPath"
:disabled="disabled"
:key="issue.id" />
<li
class="board-list-count text-center"
v-if="showCount"
data-id="-1">
<i
class="fa fa-spinner fa-spin"
v-show="list.loadingMore">
</i>
<span v-if="list.issues.length === list.issuesSize">
Show all issues
</span>
<span v-else>
Showing {{ list.issues.length }} of {{ list.issuesSize }} issues
</span>
</li>
</ul>
</div>
`
,
components
:
{
boardCard
,
boardNewIssue
,
},
props
:
{
disabled
:
Boolean
,
list
:
Object
,
issues
:
Array
,
loading
:
Boolean
,
issueLinkBase
:
String
,
rootPath
:
String
,
},
data
()
{
disabled
:
{
type
:
Boolean
,
required
:
true
,
},
list
:
{
type
:
Object
,
required
:
true
,
},
issues
:
{
type
:
Array
,
required
:
true
,
},
loading
:
{
type
:
Boolean
,
required
:
true
,
},
issueLinkBase
:
{
type
:
String
,
required
:
true
,
},
rootPath
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
scrollOffset
:
250
,
filters
:
Store
.
state
.
filters
,
showCount
:
false
,
showIssueForm
:
false
showIssueForm
:
false
,
};
},
watch
:
{
filters
:
{
handler
()
{
handler
()
{
this
.
list
.
loadingMore
=
false
;
this
.
$refs
.
list
.
scrollTop
=
0
;
},
deep
:
true
deep
:
true
,
},
issues
()
{
issues
()
{
this
.
$nextTick
(()
=>
{
if
(
this
.
scrollHeight
()
<=
this
.
listHeight
()
&&
this
.
list
.
issuesSize
>
this
.
list
.
issues
.
length
)
{
if
(
this
.
scrollHeight
()
<=
this
.
listHeight
()
&&
this
.
list
.
issuesSize
>
this
.
list
.
issues
.
length
)
{
this
.
list
.
page
+=
1
;
this
.
list
.
getIssues
(
false
);
}
...
...
@@ -54,19 +112,19 @@ import boardCard from './board_card';
this
.
showCount
=
false
;
}
});
}
},
},
methods
:
{
listHeight
()
{
listHeight
()
{
return
this
.
$refs
.
list
.
getBoundingClientRect
().
height
;
},
scrollHeight
()
{
scrollHeight
()
{
return
this
.
$refs
.
list
.
scrollHeight
;
},
scrollTop
()
{
scrollTop
()
{
return
this
.
$refs
.
list
.
scrollTop
+
this
.
listHeight
();
},
loadNextPage
()
{
loadNextPage
()
{
const
getIssues
=
this
.
list
.
nextPage
();
if
(
getIssues
)
{
...
...
@@ -79,11 +137,16 @@ import boardCard from './board_card';
toggleForm
()
{
this
.
showIssueForm
=
!
this
.
showIssueForm
;
},
onScroll
()
{
if
((
this
.
scrollTop
()
>
this
.
scrollHeight
()
-
this
.
scrollOffset
)
&&
!
this
.
list
.
loadingMore
)
{
this
.
loadNextPage
();
}
},
},
created
()
{
gl
.
IssueBoardsApp
.
$on
(
`hide-issue-form-
${
this
.
list
.
id
}
`
,
this
.
toggleForm
);
eventHub
.
$on
(
`hide-issue-form-
${
this
.
list
.
id
}
`
,
this
.
toggleForm
);
},
mounted
()
{
mounted
()
{
const
options
=
gl
.
issueBoards
.
getBoardSortableDefaultOptions
({
scroll
:
document
.
querySelectorAll
(
'.boards-list'
)[
0
],
group
:
'issues'
,
...
...
@@ -100,7 +163,8 @@ import boardCard from './board_card';
gl
.
issueBoards
.
onStart
();
},
onAdd
:
(
e
)
=>
{
gl
.
issueBoards
.
BoardsStore
.
moveIssueToList
(
Store
.
moving
.
list
,
this
.
list
,
Store
.
moving
.
issue
,
e
.
newIndex
);
gl
.
issueBoards
.
BoardsStore
.
moveIssueToList
(
Store
.
moving
.
list
,
this
.
list
,
Store
.
moving
.
issue
,
e
.
newIndex
);
this
.
$nextTick
(()
=>
{
e
.
item
.
remove
();
...
...
@@ -108,24 +172,21 @@ import boardCard from './board_card';
},
onUpdate
:
(
e
)
=>
{
const
sortedArray
=
this
.
sortable
.
toArray
().
filter
(
id
=>
id
!==
'-1'
);
gl
.
issueBoards
.
BoardsStore
.
moveIssueInList
(
this
.
list
,
Store
.
moving
.
issue
,
e
.
oldIndex
,
e
.
newIndex
,
sortedArray
);
gl
.
issueBoards
.
BoardsStore
.
moveIssueInList
(
this
.
list
,
Store
.
moving
.
issue
,
e
.
oldIndex
,
e
.
newIndex
,
sortedArray
);
},
onMove
(
e
)
{
return
!
e
.
related
.
classList
.
contains
(
'board-list-count'
);
}
},
});
this
.
sortable
=
Sortable
.
create
(
this
.
$refs
.
list
,
options
);
// Scroll event on list to load more
this
.
$refs
.
list
.
onscroll
=
()
=>
{
if
((
this
.
scrollTop
()
>
this
.
scrollHeight
()
-
this
.
scrollOffset
)
&&
!
this
.
list
.
loadingMore
)
{
this
.
loadNextPage
();
}
};
this
.
$refs
.
list
.
addEventListener
(
'scroll'
,
this
.
onScroll
);
},
beforeDestroy
()
{
gl
.
IssueBoardsApp
.
$off
(
`hide-issue-form-
${
this
.
list
.
id
}
`
,
this
.
toggleForm
);
eventHub
.
$off
(
`hide-issue-form-
${
this
.
list
.
id
}
`
,
this
.
toggleForm
);
this
.
$refs
.
list
.
removeEventListener
(
'scroll'
,
this
.
onScroll
);
},
});
})();
};
app/assets/javascripts/boards/components/board_new_issue.js
View file @
4917df5e
/* global ListIssue */
import
eventHub
from
'../eventhub'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
export
default
{
...
...
@@ -49,7 +51,7 @@ export default {
},
cancel
()
{
this
.
title
=
''
;
gl
.
IssueBoardsApp
.
$emit
(
`hide-issue-form-
${
this
.
list
.
id
}
`
);
eventHub
.
$emit
(
`hide-issue-form-
${
this
.
list
.
id
}
`
);
},
},
mounted
()
{
...
...
app/views/projects/boards/_show.html.haml
View file @
4917df5e
...
...
@@ -8,7 +8,6 @@
=
page_specific_javascript_bundle_tag
(
'boards'
)
%script
#js-board-template
{
type:
"text/x-template"
}=
render
"projects/boards/components/board"
%script
#js-board-list-template
{
type:
"text/x-template"
}=
render
"projects/boards/components/board_list"
%script
#js-board-modal-filter
{
type:
"text/x-template"
}=
render
"shared/issuable/search_bar"
,
type: :boards_modal
=
render
"projects/issues/head"
...
...
app/views/projects/boards/components/_board_list.html.haml
deleted
100644 → 0
View file @
65ea732c
.board-list-component
.board-list-loading.text-center
{
"v-if"
=>
"loading"
}
=
icon
(
"spinner spin"
)
-
if
can?
current_user
,
:create_issue
,
@project
%board-new-issue
{
":list"
=>
"list"
,
"v-if"
=>
'list.type !== "closed" && showIssueForm'
}
%ul
.board-list
{
"ref"
=>
"list"
,
"v-show"
=>
"!loading"
,
":data-board"
=>
"list.id"
,
":class"
=>
'
{
"is-smaller"
:
showIssueForm
}
'
}
%board-card
{
"v-for"
=>
"(issue, index) in issues"
,
"ref"
=>
"issue"
,
":index"
=>
"index"
,
":list"
=>
"list"
,
":issue"
=>
"issue"
,
":issue-link-base"
=>
"issueLinkBase"
,
":root-path"
=>
"rootPath"
,
":disabled"
=>
"disabled"
,
":key"
=>
"issue.id"
}
%li
.board-list-count.text-center
{
"v-if"
=>
"showCount"
,
"data-issue-id"
=>
"-1"
}
=
icon
(
"spinner spin"
,
"v-show"
=>
"list.loadingMore"
)
%span
{
"v-if"
=>
"list.issues.length === list.issuesSize"
}
Showing all issues
%span
{
"v-else"
=>
true
}
Showing {{ list.issues.length }} of {{ list.issuesSize }} issues
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