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
Tatuya Kamada
gitlab-ce
Commits
4b720875
Commit
4b720875
authored
Aug 25, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up the code a bit
parent
bf5a853e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
22 deletions
+20
-22
app/assets/javascripts/search_autocomplete.js
app/assets/javascripts/search_autocomplete.js
+17
-18
app/views/layouts/_search.html.haml
app/views/layouts/_search.html.haml
+3
-4
No files found.
app/assets/javascripts/search_autocomplete.js
View file @
4b720875
...
...
@@ -368,39 +368,38 @@
})();
$
(
function
()
{
if
(
$
(
'
.js-search-project-options
'
).
length
)
{
var
projectOptionsDataEl
=
$
(
'
.js-search-project-options
'
);
var
$projectOptionsDataEl
=
$
(
'
.js-search-project-options
'
);
var
$groupOptionsDataEl
=
$
(
'
.js-search-group-options
'
);
var
$dashboardOptionsDataEl
=
$
(
'
.js-search-dashboard-options
'
);
if
(
$projectOptionsDataEl
.
length
)
{
gl
.
projectOptions
=
gl
.
projectOptions
||
{};
var
projectPath
=
projectOptionsDataEl
.
data
(
'
project-path
'
);
var
projectPath
=
$
projectOptionsDataEl
.
data
(
'
project-path
'
);
gl
.
projectOptions
[
projectPath
]
=
{
name
:
projectOptionsDataEl
.
data
(
'
name
'
),
issuesPath
:
projectOptionsDataEl
.
data
(
'
issues-path
'
),
mrPath
:
projectOptionsDataEl
.
data
(
'
mr-path
'
)
name
:
$
projectOptionsDataEl
.
data
(
'
name
'
),
issuesPath
:
$
projectOptionsDataEl
.
data
(
'
issues-path
'
),
mrPath
:
$
projectOptionsDataEl
.
data
(
'
mr-path
'
)
};
}
if
(
$
(
'
.js-search-group-options
'
).
length
)
{
var
groupOptionsDataEl
=
$
(
'
.js-search-group-options
'
);
if
(
$groupOptionsDataEl
.
length
)
{
gl
.
groupOptions
=
gl
.
groupOptions
||
{};
var
groupPath
=
groupOptionsDataEl
.
data
(
'
group-path
'
);
var
groupPath
=
$
groupOptionsDataEl
.
data
(
'
group-path
'
);
gl
.
groupOptions
[
groupPath
]
=
{
name
:
groupOptionsDataEl
.
data
(
'
name
'
),
issuesPath
:
groupOptionsDataEl
.
data
(
'
issues-path
'
),
mrPath
:
groupOptionsDataEl
.
data
(
'
mr-path
'
)
name
:
$
groupOptionsDataEl
.
data
(
'
name
'
),
issuesPath
:
$
groupOptionsDataEl
.
data
(
'
issues-path
'
),
mrPath
:
$
groupOptionsDataEl
.
data
(
'
mr-path
'
)
};
}
if
(
$
(
'
.js-search-dashboard-options
'
).
length
)
{
var
dashboardOptionsDataEl
=
$
(
'
.js-search-dashboard-options
'
);
if
(
$dashboardOptionsDataEl
.
length
)
{
gl
.
dashboardOptions
=
{
issuesPath
:
dashboardOptionsDataEl
.
data
(
'
issues-path
'
),
mrPath
:
dashboardOptionsDataEl
.
data
(
'
mr-path
'
)
issuesPath
:
$
dashboardOptionsDataEl
.
data
(
'
issues-path
'
),
mrPath
:
$
dashboardOptionsDataEl
.
data
(
'
mr-path
'
)
};
}
});
...
...
app/views/layouts/_search.html.haml
View file @
4b720875
...
...
@@ -3,10 +3,9 @@
-
if
controller
.
controller_path
=~
/^projects/
&&
@project
.
persisted?
-
label
=
'This project'
-
if
@group
&&
@group
.
persisted?
&&
@group
.
path
-
group_data_attrs
=
{
group_path:
"
#{
j
(
@group
.
path
)
}
"
,
name:
"
#{
j
(
@group
.
name
)
}
"
,
issues_path:
"
#{
issues_group_path
(
j
(
@group
.
path
))
}
"
,
mr_path:
"
#{
merge_requests_group_path
(
j
(
@group
.
path
))
}
"
}
-
group_data_attrs
=
{
group_path:
j
(
@group
.
path
),
name:
@group
.
name
,
issues_path:
issues_group_path
(
j
(
@group
.
path
)),
mr_path:
merge_requests_group_path
(
j
(
@group
.
path
))
}
-
if
@project
&&
@project
.
persisted?
-
project_data_attrs
=
{
project_path:
"
#{
j
(
@project
.
path
)
}
"
,
name:
"
#{
j
(
@project
.
name
)
}
"
,
issues_path:
"
#{
namespace_project_issues_path
(
@project
.
namespace
,
@project
)
}
"
,
mr_path:
"
#{
namespace_project_merge_requests_path
(
@project
.
namespace
,
@project
)
}
"
}
-
project_data_attrs
=
{
project_path:
j
(
@project
.
path
),
name:
j
(
@project
.
name
),
issues_path:
namespace_project_issues_path
(
@project
.
namespace
,
@project
),
mr_path:
namespace_project_merge_requests_path
(
@project
.
namespace
,
@project
)
}
.search.search-form
{
class:
"#{'has-location-badge' if label.present?}"
}
=
form_tag
search_path
,
method: :get
,
class:
'navbar-form'
do
|
f
|
.search-input-container
...
...
@@ -14,7 +13,7 @@
.location-badge
=
label
.search-input-wrap
.dropdown
{
data:
{
url:
search_autocomplete_path
}
}
=
search_field_tag
"search"
,
nil
,
placeholder:
'Search'
,
class:
"search-input dropdown-menu-toggle js-search-dashboard-options"
,
spellcheck:
false
,
tabindex:
"1"
,
autocomplete:
'off'
,
data:
{
toggle:
'dropdown'
,
issues_path:
"
#{
issues_dashboard_url
}
"
,
mr_path:
"
#{
merge_requests_dashboard_url
}
"
}
=
search_field_tag
'search'
,
nil
,
placeholder:
'Search'
,
class:
'search-input dropdown-menu-toggle js-search-dashboard-options'
,
spellcheck:
false
,
tabindex:
'1'
,
autocomplete:
'off'
,
data:
{
toggle:
'dropdown'
,
issues_path:
issues_dashboard_url
,
mr_path:
merge_requests_dashboard_url
}
.dropdown-menu.dropdown-select
=
dropdown_content
do
%ul
...
...
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