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
Léo-Paul Géneau
gitlab-ce
Commits
d90f3fe6
Commit
d90f3fe6
authored
Sep 04, 2017
by
kushalpandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Projects Dropdown App Entry
parent
18ce6685
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
app/assets/javascripts/projects_dropdown/index.js
app/assets/javascripts/projects_dropdown/index.js
+68
-0
No files found.
app/assets/javascripts/projects_dropdown/index.js
0 → 100644
View file @
d90f3fe6
import
Vue
from
'
vue
'
;
import
Translate
from
'
../vue_shared/translate
'
;
import
eventHub
from
'
./event_hub
'
;
import
ProjectsService
from
'
./service/projects_service
'
;
import
ProjectsStore
from
'
./store/projects_store
'
;
import
projectsDropdownApp
from
'
./components/app.vue
'
;
Vue
.
use
(
Translate
);
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
el
=
document
.
getElementById
(
'
js-projects-dropdown
'
);
const
navEl
=
document
.
getElementById
(
'
nav-projects-dropdown
'
);
// Don't do anything if element doesn't exist (No projects dropdown)
// This is for when the user accesses GitLab without logging in
if
(
!
el
||
!
navEl
)
{
return
;
}
$
(
navEl
).
on
(
'
show.bs.dropdown
'
,
(
e
)
=>
{
const
dropdownEl
=
$
(
e
.
currentTarget
).
find
(
'
.projects-dropdown-menu
'
);
dropdownEl
.
one
(
'
transitionend
'
,
()
=>
{
eventHub
.
$emit
(
'
dropdownOpen
'
);
});
});
// eslint-disable-next-line no-new
new
Vue
({
el
,
components
:
{
projectsDropdownApp
,
},
data
()
{
const
dataset
=
this
.
$options
.
el
.
dataset
;
const
store
=
new
ProjectsStore
();
const
service
=
new
ProjectsService
(
dataset
.
userName
);
const
project
=
{
id
:
Number
(
dataset
.
projectId
),
name
:
dataset
.
projectName
,
namespace
:
dataset
.
projectNamespace
,
webUrl
:
dataset
.
projectWebUrl
,
avatarUrl
:
dataset
.
projectAvatarUrl
||
null
,
lastAccessedOn
:
Date
.
now
(),
};
return
{
store
,
service
,
state
:
store
.
state
,
currentUserName
:
dataset
.
userName
,
currentProject
:
project
,
};
},
render
(
createElement
)
{
return
createElement
(
'
projects-dropdown-app
'
,
{
props
:
{
currentUserName
:
this
.
currentUserName
,
currentProject
:
this
.
currentProject
,
store
:
this
.
store
,
service
:
this
.
service
,
},
});
},
});
});
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