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
f330585a
Commit
f330585a
authored
Jul 22, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added vue-resource to get & save data
parent
6478adf1
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
117 additions
and
53 deletions
+117
-53
app/assets/javascripts/boards/boards_bundle.js.coffee
app/assets/javascripts/boards/boards_bundle.js.coffee
+10
-2
app/assets/javascripts/boards/components/board.js.coffee
app/assets/javascripts/boards/components/board.js.coffee
+6
-17
app/assets/javascripts/boards/components/board_list.js.coffee
...assets/javascripts/boards/components/board_list.js.coffee
+29
-0
app/assets/javascripts/boards/components/card.js.coffee
app/assets/javascripts/boards/components/card.js.coffee
+0
-4
app/assets/javascripts/boards/services/board_service.js.coffee
...ssets/javascripts/boards/services/board_service.js.coffee
+19
-0
app/assets/javascripts/boards/stores/boards_store.js.coffee
app/assets/javascripts/boards/stores/boards_store.js.coffee
+16
-9
app/assets/stylesheets/pages/boards.scss
app/assets/stylesheets/pages/boards.scss
+10
-12
app/views/projects/boards/components/_board.html.haml
app/views/projects/boards/components/_board.html.haml
+5
-4
app/views/projects/boards/components/_card.html.haml
app/views/projects/boards/components/_card.html.haml
+4
-3
app/views/projects/boards/index.html.haml
app/views/projects/boards/index.html.haml
+1
-2
config/routes.rb
config/routes.rb
+10
-0
vendor/assets/javascripts/vue-resource.js
vendor/assets/javascripts/vue-resource.js
+7
-0
No files found.
app/assets/javascripts/boards/boards_bundle.js.coffee
View file @
f330585a
#= require vue
#= require vue
#= require vue-resource
#= require Sortable
#= require Sortable
#= require_tree ./stores
#= require_tree ./stores
#= require_tree ./services
#= require_tree ./components
#= require_tree ./components
$
->
$
=>
@
service
=
new
BoardService
(
$
(
'#board-app'
).
data
(
'endpoint'
))
new
Vue
new
Vue
el
:
'#board-app'
el
:
'#board-app'
data
:
data
:
boards
:
BoardsStore
.
state
boards
:
BoardsStore
.
state
interaction
:
BoardsStore
.
dragging
ready
:
->
service
.
all
()
.
then
(
resp
)
->
BoardsStore
.
state
.
push
(
board
)
for
board
in
resp
.
data
app/assets/javascripts/boards/components/board.js.coffee
View file @
f330585a
Board
=
Vue
.
extend
Board
=
Vue
.
extend
props
:
props
:
disabled
:
Boolean
board
:
Object
board
:
Object
data
:
->
data
:
->
dragging
:
BoardsStore
.
dragging
dragging
:
BoardsStore
.
dragging
methods
:
methods
:
clearSearch
:
->
clearSearch
:
->
this
.
query
=
''
this
.
query
=
''
computed
:
isPreset
:
->
typeof
this
.
board
.
id
!=
'number'
ready
:
->
ready
:
->
Sortable
.
create
this
.
$el
s
.
list
,
Sortable
.
create
this
.
$el
.
parentNode
,
group
:
'boards'
group
:
'boards'
disabled
:
this
.
disabled
animation
:
150
animation
:
150
scroll
:
document
.
getElementById
(
'board-app'
)
draggable
:
'.is-draggable'
scrollSensitivity
:
150
scrollSpeed
:
50
forceFallback
:
true
forceFallback
:
true
fallbackClass
:
'is-dragging'
fallbackClass
:
'is-dragging'
ghostClass
:
'is-ghost'
ghostClass
:
'is-ghost'
onAdd
:
(
e
)
->
fromBoardId
=
e
.
from
.
getAttribute
(
'data-board'
)
fromBoardId
=
parseInt
(
fromBoardId
)
||
fromBoardId
toBoardId
=
e
.
to
.
getAttribute
(
'data-board'
)
toBoardId
=
parseInt
(
toBoardId
)
||
toBoardId
issueId
=
parseInt
(
e
.
item
.
getAttribute
(
'data-issue'
))
BoardsStore
.
moveCardToBoard
(
fromBoardId
,
toBoardId
,
issueId
,
e
.
newIndex
)
onUpdate
:
(
e
)
->
onUpdate
:
(
e
)
->
console
.
log
e
.
newIndex
,
e
.
oldIndex
BoardsStore
.
moveBoard
(
e
.
oldIndex
+
1
,
e
.
newIndex
+
1
)
onStart
:
->
BoardsStore
.
dragging
=
true
Vue
.
component
(
'board'
,
Board
)
Vue
.
component
(
'board'
,
Board
)
app/assets/javascripts/boards/components/board_list.js.coffee
0 → 100644
View file @
f330585a
BoardList
=
Vue
.
extend
props
:
disabled
:
Boolean
boardId
:
[
Number
,
String
]
issues
:
Array
query
:
String
ready
:
->
Sortable
.
create
this
.
$els
.
list
,
group
:
'issues'
disabled
:
this
.
disabled
animation
:
150
scroll
:
document
.
getElementById
(
'board-app'
)
scrollSensitivity
:
150
scrollSpeed
:
50
forceFallback
:
true
fallbackClass
:
'is-dragging'
ghostClass
:
'is-ghost'
onAdd
:
(
e
)
->
fromBoardId
=
e
.
from
.
getAttribute
(
'data-board'
)
fromBoardId
=
parseInt
(
fromBoardId
)
||
fromBoardId
toBoardId
=
e
.
to
.
getAttribute
(
'data-board'
)
toBoardId
=
parseInt
(
toBoardId
)
||
toBoardId
issueId
=
parseInt
(
e
.
item
.
getAttribute
(
'data-issue'
))
BoardsStore
.
moveCardToBoard
(
fromBoardId
,
toBoardId
,
issueId
,
e
.
newIndex
)
onUpdate
:
(
e
)
->
console
.
log
e
.
newIndex
,
e
.
oldIndex
Vue
.
component
(
'board-list'
,
BoardList
)
app/assets/javascripts/boards/components/card.js.coffee
deleted
100644 → 0
View file @
6478adf1
Card
=
Vue
.
extend
data
:
->
Vue
.
component
(
'card'
,
Card
)
app/assets/javascripts/boards/services/board_service.js.coffee
0 → 100644
View file @
f330585a
class
@
BoardService
constructor
:
(
@
root
)
->
Vue
.
http
.
options
.
root
=
@
root
@
resource
=
Vue
.
resource
"
#{
@
root
}
{/id}"
,
{},
all
:
method
:
'GET'
url
:
'all'
setCSRF
:
->
Vue
.
http
.
headers
.
common
[
'X-CSRF-Token'
]
=
$
.
rails
.
csrfToken
()
all
:
->
@
setCSRF
()
@
resource
.
all
()
updateBoard
:
(
id
,
index
)
->
@
setCSRF
()
@
resource
.
update
{
id
:
id
},
{
index
:
index
}
app/assets/javascripts/boards/stores/boards_store.js.coffee
View file @
f330585a
@
BoardsStore
=
@
BoardsStore
=
state
:
[
state
:
[]
{
id
:
'backlog'
,
title
:
'Backlog'
,
index
:
0
,
search
:
true
,
issues
:
[{
id
:
1
,
title
:
'Test'
,
labels
:
[]}]},
moveBoard
:
(
oldIndex
,
newIndex
)
->
{
id
:
1
,
title
:
'Frontend'
,
index
:
1
,
label
:
{
title
:
'Frontend'
,
backgroundColor
:
'#44ad8e'
,
textColor
:
'#ffffff'
},
issues
:
[{
id
:
3
,
title
:
'Frontend bug'
,
labels
:
[{
title
:
'Frontend'
,
backgroundColor
:
'#44ad8e'
,
textColor
:
'#ffffff'
},
{
title
:
'UX'
,
backgroundColor
:
'#44ad8e'
,
textColor
:
'#ffffff'
}]}]},
boardFrom
=
_
.
find
BoardsStore
.
state
,
(
board
)
->
{
id
:
'done'
,
title
:
'Done'
,
index
:
99999999
,
issues
:
[{
id
:
2
,
title
:
'Testing done'
,
labels
:
[]}]}
board
.
index
is
oldIndex
]
interaction
:
{
service
.
updateBoard
(
boardFrom
.
id
,
newIndex
)
dragging
:
false
}
boardTo
=
_
.
find
BoardsStore
.
state
,
(
board
)
->
board
.
index
is
newIndex
boardFrom
.
index
=
newIndex
if
newIndex
>
boardTo
.
index
boardTo
.
index
--
else
boardTo
.
index
++
moveCardToBoard
:
(
boardFromId
,
boardToId
,
issueId
,
toIndex
)
->
moveCardToBoard
:
(
boardFromId
,
boardToId
,
issueId
,
toIndex
)
->
boardFrom
=
_
.
find
BoardsStore
.
state
,
(
board
)
->
boardFrom
=
_
.
find
BoardsStore
.
state
,
(
board
)
->
board
.
id
is
boardFromId
board
.
id
is
boardFromId
...
@@ -19,7 +26,7 @@
...
@@ -19,7 +26,7 @@
boardFrom
.
issues
=
_
.
reject
boardFrom
.
issues
,
(
issue
)
->
boardFrom
.
issues
=
_
.
reject
boardFrom
.
issues
,
(
issue
)
->
issue
.
id
is
issueId
issue
.
id
is
issueId
# Add to new boards issues
and increase count
# Add to new boards issues
boardTo
.
issues
.
splice
(
toIndex
,
0
,
issue
)
boardTo
.
issues
.
splice
(
toIndex
,
0
,
issue
)
# If going to done - remove label
# If going to done - remove label
...
...
app/assets/stylesheets/pages/boards.scss
View file @
f330585a
...
@@ -107,31 +107,29 @@
...
@@ -107,31 +107,29 @@
flex
:
1
;
flex
:
1
;
margin
:
0
;
margin
:
0
;
padding
:
5px
;
padding
:
5px
;
list-style
:
none
;
overflow
:
scroll
;
overflow
:
scroll
;
}
}
.is-ghost
{
opacity
:
0
;
}
.is-dragging
{
// Important because plugin sets inline CSS
opacity
:
1
!
important
;
}
.card
{
.card
{
width
:
100%
;
width
:
100%
;
padding
:
10px
$gl-padding
;
padding
:
10px
$gl-padding
;
background
:
#fff
;
background
:
#fff
;
border-radius
:
$border-radius-default
;
border-radius
:
$border-radius-default
;
box-shadow
:
0
1px
2px
rgba
(
186
,
186
,
186
,
0
.5
);
box-shadow
:
0
1px
2px
rgba
(
186
,
186
,
186
,
0
.5
);
list-style
:
none
;
&
:not
(
:last-child
)
{
&
:not
(
:last-child
)
{
margin-bottom
:
5px
;
margin-bottom
:
5px
;
}
}
&
.is-dragging
{
cursor
:
-
webkit-grabbing
;
cursor
:
-
moz-grabbing
;
// Important because plugin sets inline CSS
opacity
:
1
!
important
;
}
&
.is-ghost
{
opacity
:
0
;
}
}
}
.card-title
{
.card-title
{
...
...
app/views/projects/boards/components/_board.html.haml
View file @
f330585a
%board
{
"inline-template"
=>
true
,
"v-cloak"
=>
true
,
"v-for"
=>
"board in boards | orderBy 'index'"
,
":board"
=>
"board"
,
":disabled"
=>
"#{current_user.nil?}"
}
%board
{
"inline-template"
=>
true
,
"v-cloak"
=>
true
,
"v-for"
=>
"board in boards | orderBy 'index'"
,
":board"
=>
"board"
}
.board
.board
{
":class"
=>
"{ 'is-draggable': !isPreset }"
}
.board-inner
.board-inner
%header
.board-inner-container.board-header
{
":class"
=>
"{ 'has-border': board.label }"
,
":style"
=>
"{ borderTopColor: board.label.backgroundColor }"
}
%header
.board-inner-container.board-header
{
":class"
=>
"{ 'has-border': board.label }"
,
":style"
=>
"{ borderTopColor: board.label.backgroundColor }"
}
%h3
.board-title
%h3
.board-title
...
@@ -13,5 +13,6 @@
...
@@ -13,5 +13,6 @@
%span
.sr-only
%span
.sr-only
Clear search
Clear search
=
icon
(
"times"
,
class:
"board-search-clear"
)
=
icon
(
"times"
,
class:
"board-search-clear"
)
%ul
.board-list
{
"v-el:list"
=>
true
,
":data-board"
=>
"board.id"
}
%board-list
{
"inline-template"
=>
true
,
":board-id"
=>
"board.id"
,
":issues"
=>
"board.issues"
,
":disabled"
=>
"#{current_user.nil?}"
,
":query"
=>
"query"
}
%ul
.board-list
{
"v-el:list"
=>
true
,
":data-board"
=>
"boardId"
}
=
render
"projects/boards/components/card"
=
render
"projects/boards/components/card"
app/views/projects/boards/components/_card.html.haml
View file @
f330585a
%li
.card
{
"
v-for"
=>
"issue in board.issues"
,
":data-issue"
=>
"issue.id
"
}
%li
.card
{
"
:data-issue"
=>
"issue.id"
,
"v-for"
=>
"issue in issues | filterBy query in 'title'
"
}
%h4
.card-title
%h4
.card-title
%a
{
href:
"#"
}
%a
{
href:
"#"
,
":title"
=>
"issue.title"
}
{{ issue.title }}
{{ issue.title }}
.card-footer
.card-footer
%span
.card-number
%span
.card-number
\#288
=
precede
'#'
do
{{ issue.id }}
%span
.label.color-label
{
"v-for"
=>
"label in issue.labels"
,
":style"
=>
"{ backgroundColor: label.backgroundColor, color: label.textColor }"
}
%span
.label.color-label
{
"v-for"
=>
"label in issue.labels"
,
":style"
=>
"{ backgroundColor: label.backgroundColor, color: label.textColor }"
}
{{ label.title }}
{{ label.title }}
app/views/projects/boards/index.html.haml
View file @
f330585a
...
@@ -9,6 +9,5 @@
...
@@ -9,6 +9,5 @@
=
render
'shared/issuable/filter'
,
type: :boards
=
render
'shared/issuable/filter'
,
type: :boards
.boards-list
#board-app
{
":class"
=>
"{ 'is-dragging': interaction.dragging }"
}
.boards-list
#board-app
{
"data-endpoint"
=>
"#{namespace_project_boards_path(@project.namespace, @project)}"
}
{{ interaction.dragging }}
=
render
"projects/boards/components/board"
=
render
"projects/boards/components/board"
config/routes.rb
View file @
f330585a
...
@@ -832,7 +832,17 @@ Rails.application.routes.draw do
...
@@ -832,7 +832,17 @@ Rails.application.routes.draw do
end
end
end
end
<<<<<<<
9
d83a366e263d015894908f72576972f87848399
resources
:project_members
,
except:
[
:show
,
:new
,
:edit
],
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
},
concerns: :access_requestable
do
resources
:project_members
,
except:
[
:show
,
:new
,
:edit
],
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
},
concerns: :access_requestable
do
=======
resources
:boards
do
collection
do
get
:all
end
end
resources
:project_members
,
except:
[
:new
,
:edit
],
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
},
concerns: :access_requestable
do
>>>>>>>
Added
vue
-
resource
to
get
&
save
data
collection
do
collection
do
delete
:leave
delete
:leave
...
...
vendor/assets/javascripts/vue-resource.js
0 → 100644
View file @
f330585a
This diff is collapsed.
Click to expand it.
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