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
e3405212
Commit
e3405212
authored
Aug 30, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pull projects select to own component
parent
8da4fff9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
71 deletions
+111
-71
app/assets/javascripts/boards/components/board_new_issue.js
app/assets/javascripts/boards/components/board_new_issue.js
+10
-71
app/assets/javascripts/boards/components/project_select.js
app/assets/javascripts/boards/components/project_select.js
+101
-0
No files found.
app/assets/javascripts/boards/components/board_new_issue.js
View file @
e3405212
/* global ListIssue */
/* global ListIssue */
import
eventHub
from
'
../eventhub
'
;
import
eventHub
from
'
../eventhub
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
ProjectSelect
from
'
./project_select
'
;
import
Api
from
'
../../api
'
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
const
Store
=
gl
.
issueBoards
.
BoardsStore
;
...
@@ -27,12 +26,9 @@ export default {
...
@@ -27,12 +26,9 @@ export default {
};
};
},
},
components
:
{
components
:
{
loadingIcon
,
'
project-select
'
:
ProjectSelect
,
},
},
computed
:
{
computed
:
{
selectedProjectName
()
{
return
this
.
selectedProject
.
name
||
'
Select a project
'
;
},
disabled
()
{
disabled
()
{
if
(
this
.
groupId
)
{
if
(
this
.
groupId
)
{
return
this
.
title
===
''
||
!
this
.
selectedProject
.
name
;
return
this
.
title
===
''
||
!
this
.
selectedProject
.
name
;
...
@@ -86,43 +82,13 @@ export default {
...
@@ -86,43 +82,13 @@ export default {
this
.
title
=
''
;
this
.
title
=
''
;
eventHub
.
$emit
(
`hide-issue-form-
${
this
.
list
.
id
}
`
);
eventHub
.
$emit
(
`hide-issue-form-
${
this
.
list
.
id
}
`
);
},
},
setSelectedProject
(
selectedProject
)
{
this
.
selectedProject
=
selectedProject
;
},
},
},
mounted
()
{
mounted
()
{
this
.
$refs
.
input
.
focus
();
this
.
$refs
.
input
.
focus
();
if
(
this
.
groupId
)
{
eventHub
.
$on
(
'
setSelectedProject
'
,
this
.
setSelectedProject
);
$
(
this
.
$refs
.
projectsDropdown
).
glDropdown
({
filterable
:
true
,
filterRemote
:
true
,
search
:
{
fields
:
[
'
name_with_namespace
'
],
},
clicked
:
({
$el
,
e
})
=>
{
e
.
preventDefault
();
this
.
selectedProject
=
{
id
:
$el
.
data
(
'
project-id
'
),
name
:
$el
.
data
(
'
project-name
'
),
};
},
selectable
:
true
,
data
:
(
term
,
callback
)
=>
{
this
.
loading
=
true
;
return
Api
.
groupProjects
(
this
.
groupId
,
term
,
(
projects
)
=>
{
this
.
loading
=
false
;
callback
(
projects
);
});
},
renderRow
(
project
)
{
return
`
<li>
<a href='#' class='dropdown-menu-link' data-project-id="
${
project
.
id
}
" data-project-name="
${
project
.
name
}
">
${
_
.
escape
(
project
.
name
)}
</a>
</li>
`
;
},
text
:
project
=>
project
.
name
,
});
}
},
},
template
:
`
template
:
`
<div class="board-new-issue-form">
<div class="board-new-issue-form">
...
@@ -144,37 +110,10 @@ export default {
...
@@ -144,37 +110,10 @@ export default {
ref="input"
ref="input"
autocomplete="off"
autocomplete="off"
:id="list.id + '-title'" />
:id="list.id + '-title'" />
<template v-if="groupId">
<project-select
<label class="label-light prepend-top-10"
v-if="groupId"
:for="list.id + '-project'">
:groupId="groupId"
Project
/>
</label>
<div ref="projectsDropdown" class="dropdown">
<button
class="dropdown-menu-toggle wide"
type="button"
data-toggle="dropdown"
aria-expanded="false">
{{ selectedProjectName }}
<i class="fa fa-chevron-down" aria-hidden="true"></i>
</button>
<div class="dropdown-menu dropdown-menu-selectable dropdown-menu-full-width">
<div class="dropdown-title">
<span>Projects</span>
<button aria-label="Close" type="button" class="dropdown-title-button dropdown-menu-close">
<i aria-hidden="true" data-hidden="true" class="fa fa-times dropdown-menu-close-icon"></i>
</button>
</div>
<div class="dropdown-input">
<input class="dropdown-input-field">
</div>
<div class="dropdown-content"></div>
<div class="dropdown-loading">
<loading-icon />
</div>
</div>
</div>
</template>
<div class="clearfix prepend-top-10">
<div class="clearfix prepend-top-10">
<button class="btn btn-success pull-left"
<button class="btn btn-success pull-left"
type="submit"
type="submit"
...
...
app/assets/javascripts/boards/components/project_select.js
0 → 100644
View file @
e3405212
/* global ListIssue */
import
eventHub
from
'
../eventhub
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
Api
from
'
../../api
'
;
export
default
{
name
:
'
BoardProjectSelect
'
,
props
:
{
groupId
:
{
type
:
Number
,
required
:
true
,
default
:
0
,
},
listId
:
{
type
:
Number
,
required
:
true
,
default
:
0
,
},
},
data
()
{
return
{
loading
:
true
,
selectedProject
:
{},
};
},
components
:
{
loadingIcon
,
},
computed
:
{
selectedProjectName
()
{
return
this
.
selectedProject
.
name
||
'
Select a project
'
;
},
},
mounted
()
{
$
(
this
.
$refs
.
projectsDropdown
).
glDropdown
({
filterable
:
true
,
filterRemote
:
true
,
search
:
{
fields
:
[
'
name_with_namespace
'
],
},
clicked
:
({
$el
,
e
})
=>
{
e
.
preventDefault
();
this
.
selectedProject
=
{
id
:
$el
.
data
(
'
project-id
'
),
name
:
$el
.
data
(
'
project-name
'
),
};
eventHub
.
$emit
(
'
setSelectedProject
'
,
this
.
selectedProject
);
},
selectable
:
true
,
data
:
(
term
,
callback
)
=>
{
this
.
loading
=
true
;
return
Api
.
groupProjects
(
this
.
groupId
,
term
,
(
projects
)
=>
{
this
.
loading
=
false
;
callback
(
projects
);
});
},
renderRow
(
project
)
{
return
`
<li>
<a href='#' class='dropdown-menu-link' data-project-id="
${
project
.
id
}
" data-project-name="
${
project
.
name
}
">
${
_
.
escape
(
project
.
name
)}
</a>
</li>
`
;
},
text
:
project
=>
project
.
name
,
});
},
template
:
`
<div>
<label class="label-light prepend-top-10">
Project
</label>
<div ref="projectsDropdown" class="dropdown">
<button
class="dropdown-menu-toggle wide"
type="button"
data-toggle="dropdown"
aria-expanded="false">
{{ selectedProjectName }}
<i class="fa fa-chevron-down" aria-hidden="true"></i>
</button>
<div class="dropdown-menu dropdown-menu-selectable dropdown-menu-full-width">
<div class="dropdown-title">
<span>Projects</span>
<button aria-label="Close" type="button" class="dropdown-title-button dropdown-menu-close">
<i aria-hidden="true" data-hidden="true" class="fa fa-times dropdown-menu-close-icon"></i>
</button>
</div>
<div class="dropdown-input">
<input class="dropdown-input-field">
</div>
<div class="dropdown-content"></div>
<div class="dropdown-loading">
<loading-icon />
</div>
</div>
</div>
</div>
`
,
};
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