Skip to content
Snippets Groups Projects
Commit dca50ac1 authored by Phil Hughes's avatar Phil Hughes Committed by Jacob Schatz
Browse files

Project dropdown in header uses new dropdown

parent 5713c7cf
No related branches found
No related tags found
1 merge request!3339Project dropdown in header uses new dropdown
Loading
Loading
@@ -122,7 +122,9 @@ class GitLabDropdown
FILTER_INPUT = '.dropdown-input .dropdown-input-field'
 
constructor: (@el, @options) ->
@dropdown = $(@el).parent()
self = @
selector = $(@el).data "target"
@dropdown = if selector? then $(selector) else $(@el).parent()
 
# Set Defaults
{
Loading
Loading
class @ProjectSelect
constructor: ->
$('.js-projects-dropdown-toggle').each (i, dropdown) ->
$dropdown = $(dropdown)
$dropdown.glDropdown(
filterable: true
filterRemote: true
search:
fields: ['name_with_namespace']
data: (term, callback) ->
finalCallback = (projects) ->
callback projects
if @includeGroups
projectsCallback = (projects) ->
groupsCallback = (groups) ->
data = groups.concat(projects)
finalCallback(data)
Api.groups term, false, groupsCallback
else
projectsCallback = finalCallback
if @groupId
Api.groupProjects @groupId, term, projectsCallback
else
Api.projects term, @orderBy, projectsCallback
url: (project) ->
project.web_url
text: (project) ->
project.name_with_namespace
)
$('.ajax-project-select').each (i, select) ->
@groupId = $(select).data('group-id')
@includeGroups = $(select).data('include-groups')
Loading
Loading
Loading
Loading
@@ -69,6 +69,7 @@ header {
}
 
.header-content {
position: relative;
height: $header-height;
padding-right: 20px;
 
Loading
Loading
@@ -76,6 +77,10 @@ header {
padding-right: 0;
}
 
.dropdown-menu {
margin-top: -5px;
}
.title {
margin: 0;
font-size: 19px;
Loading
Loading
Loading
Loading
@@ -65,18 +65,8 @@ module ProjectsHelper
link_to(simple_sanitize(owner.name), user_path(owner))
end
 
project_link = link_to project_path(project), { class: "project-item-select-holder" } do
link_output = simple_sanitize(project.name)
if current_user
link_output += project_select_tag :project_path,
class: "project-item-select js-projects-dropdown",
data: { include_groups: false, order_by: 'last_activity_at' }
end
link_output
end
project_link += icon "chevron-down", class: "dropdown-toggle-caret js-projects-dropdown-toggle" if current_user
project_link = link_to simple_sanitize(project.name), project_path(project), { class: "project-item-select-holder"}
project_link += icon "chevron-down", class: "dropdown-toggle-caret js-projects-dropdown-toggle", data: { target: ".header-content", toggle: "dropdown" } if current_user
 
full_title = namespace_link + ' / ' + project_link
full_title += ' · '.html_safe + link_to(simple_sanitize(name), url) if name
Loading
Loading
Loading
Loading
@@ -45,6 +45,8 @@
 
%h1.title= title
 
= yield :header_content
= render 'shared/outdated_browser'
 
- if @project && !@project.empty_repo?
Loading
Loading
Loading
Loading
@@ -17,4 +17,11 @@
- content_for :scripts_body do
= render "layouts/init_auto_complete" if current_user
 
- content_for :header_content do
.dropdown-menu.dropdown-select
= dropdown_title("Go to a project")
= dropdown_filter("Search your projects")
= dropdown_content
= dropdown_loading
= render template: "layouts/application"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment