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
Jérome Perrin
gitlab-ce
Commits
909d2d8b
Commit
909d2d8b
authored
Jul 15, 2016
by
Connor Shea
Committed by
Alfredo Sumaran
Aug 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove inline JavaScript for Search autocomplete.
parent
af3cc383
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
21 deletions
+41
-21
app/assets/javascripts/search_autocomplete.js
app/assets/javascripts/search_autocomplete.js
+38
-0
app/views/layouts/_search.html.haml
app/views/layouts/_search.html.haml
+3
-21
No files found.
app/assets/javascripts/search_autocomplete.js
View file @
909d2d8b
...
...
@@ -367,4 +367,42 @@
})();
$
(
function
()
{
if
(
$
(
'
.js-search-project-options
'
).
length
)
{
var
projectOptionsDataEl
=
$
(
'
.js-search-project-options
'
);
gl
.
projectOptions
=
gl
.
projectOptions
||
{};
var
projectPath
=
projectOptionsDataEl
.
data
(
'
project-path
'
);
gl
.
projectOptions
[
projectPath
]
=
{
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
'
);
gl
.
groupOptions
=
gl
.
groupOptions
||
{};
var
groupPath
=
groupOptionsDataEl
.
data
(
'
group-path
'
);
gl
.
groupOptions
[
groupPath
]
=
{
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
'
);
gl
.
dashboardOptions
=
{
issuesPath
:
dashboardOptionsDataEl
.
data
(
'
issues-path
'
),
mrPath
:
dashboardOptionsDataEl
.
data
(
'
mr-path
'
)
};
}
});
}).
call
(
this
);
app/views/layouts/_search.html.haml
View file @
909d2d8b
...
...
@@ -36,30 +36,12 @@
-
else
=
hidden_field_tag
:search_code
,
true
:javascript
gl
.
projectOptions
=
gl
.
projectOptions
||
{};
gl
.
projectOptions
[
"
#{
j
(
@project
.
path
)
}
"
]
=
{
issuesPath
:
"
#{
namespace_project_issues_path
(
@project
.
namespace
,
@project
)
}
"
,
mrPath
:
"
#{
namespace_project_merge_requests_path
(
@project
.
namespace
,
@project
)
}
"
,
name
:
"
#{
j
(
@project
.
name
)
}
"
};
.js-search-project-options
{
data:
{
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)}"
}
}
-
if
@group
&&
@group
.
persisted?
&&
@group
.
path
:javascript
gl
.
groupOptions
=
gl
.
groupOptions
||
{};
gl
.
groupOptions
[
"
#{
j
(
@group
.
path
)
}
"
]
=
{
name
:
"
#{
j
(
@group
.
name
)
}
"
,
issuesPath
:
"
#{
issues_group_path
(
j
(
@group
.
path
))
}
"
,
mrPath
:
"
#{
merge_requests_group_path
(
j
(
@group
.
path
))
}
"
};
:javascript
gl
.
dashboardOptions
=
{
issuesPath
:
"
#{
issues_dashboard_url
}
"
,
mrPath
:
"
#{
merge_requests_dashboard_url
}
"
};
.js-search-group-options
{
data:
{
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))}"
}
}
.js-search-dashboard-options
{
data:
{
issues_path:
"#{issues_dashboard_url}"
,
mr_path:
"#{merge_requests_dashboard_url}"
}
}
-
if
@snippet
||
@snippets
=
hidden_field_tag
:snippets
,
true
...
...
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