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
ab1ad3bd
Commit
ab1ad3bd
authored
Oct 21, 2014
by
Ciro Santilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only run namespace select js when needed
Only needed in admin/projects.
parent
c3b81e5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
22 deletions
+27
-22
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+5
-1
app/assets/javascripts/namespace_select.js.coffee
app/assets/javascripts/namespace_select.js.coffee
+22
-21
No files found.
app/assets/javascripts/dispatcher.js.coffee
View file @
ab1ad3bd
...
...
@@ -81,7 +81,11 @@ class Dispatcher
shortcut_handler
=
true
switch
path
.
first
()
when
'admin'
then
new
Admin
()
when
'admin'
new
Admin
()
switch
path
[
1
]
when
'projects'
new
NamespaceSelect
()
when
'dashboard'
shortcut_handler
=
new
ShortcutsDashboardNavigation
()
when
'projects'
...
...
app/assets/javascripts/namespace_select.js.coffee
View file @
ab1ad3bd
$
->
namespaceFormatResult
=
(
namespace
)
->
markup
=
"<div class='namespace-result'>"
markup
+=
"<span class='namespace-kind'>"
+
namespace
.
kind
+
"</span>"
markup
+=
"<span class='namespace-path'>"
+
namespace
.
path
+
"</span>"
markup
+=
"</div>"
markup
class
@
NamespaceSelect
constructor
:
->
namespaceFormatResult
=
(
namespace
)
->
markup
=
"<div class='namespace-result'>"
markup
+=
"<span class='namespace-kind'>"
+
namespace
.
kind
+
"</span>"
markup
+=
"<span class='namespace-path'>"
+
namespace
.
path
+
"</span>"
markup
+=
"</div>"
markup
formatSelection
=
(
namespace
)
->
namespace
.
kind
+
": "
+
namespace
.
path
formatSelection
=
(
namespace
)
->
namespace
.
kind
+
": "
+
namespace
.
path
$
(
'.ajax-namespace-select'
).
each
(
i
,
select
)
->
$
(
select
).
select2
placeholder
:
"Search for namespace"
multiple
:
$
(
select
).
hasClass
(
'multiselect'
)
minimumInputLength
:
0
query
:
(
query
)
->
Api
.
namespaces
query
.
term
,
(
namespaces
)
->
data
=
{
results
:
namespaces
}
query
.
callback
(
data
)
$
(
'.ajax-namespace-select'
).
each
(
i
,
select
)
->
$
(
select
).
select2
placeholder
:
"Search for namespace"
multiple
:
$
(
select
).
hasClass
(
'multiselect'
)
minimumInputLength
:
0
query
:
(
query
)
->
Api
.
namespaces
query
.
term
,
(
namespaces
)
->
data
=
{
results
:
namespaces
}
query
.
callback
(
data
)
dropdownCssClass
:
"ajax-namespace-dropdown"
formatResult
:
namespaceFormatResult
formatSelection
:
formatSelection
dropdownCssClass
:
"ajax-namespace-dropdown"
formatResult
:
namespaceFormatResult
formatSelection
:
formatSelection
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