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
Branches
Tags
1 merge request!3339Project dropdown in header uses new dropdown
Loading
@@ -122,7 +122,9 @@ class GitLabDropdown
Loading
@@ -122,7 +122,9 @@ class GitLabDropdown
FILTER_INPUT = '.dropdown-input .dropdown-input-field' FILTER_INPUT = '.dropdown-input .dropdown-input-field'
   
constructor: (@el, @options) -> constructor: (@el, @options) ->
@dropdown = $(@el).parent() self = @
selector = $(@el).data "target"
@dropdown = if selector? then $(selector) else $(@el).parent()
   
# Set Defaults # Set Defaults
{ {
Loading
Loading
class @ProjectSelect class @ProjectSelect
constructor: -> 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) -> $('.ajax-project-select').each (i, select) ->
@groupId = $(select).data('group-id') @groupId = $(select).data('group-id')
@includeGroups = $(select).data('include-groups') @includeGroups = $(select).data('include-groups')
Loading
Loading
Loading
@@ -69,6 +69,7 @@ header {
Loading
@@ -69,6 +69,7 @@ header {
} }
   
.header-content { .header-content {
position: relative;
height: $header-height; height: $header-height;
padding-right: 20px; padding-right: 20px;
   
Loading
@@ -76,6 +77,10 @@ header {
Loading
@@ -76,6 +77,10 @@ header {
padding-right: 0; padding-right: 0;
} }
   
.dropdown-menu {
margin-top: -5px;
}
.title { .title {
margin: 0; margin: 0;
font-size: 19px; font-size: 19px;
Loading
Loading
Loading
@@ -65,18 +65,8 @@ module ProjectsHelper
Loading
@@ -65,18 +65,8 @@ module ProjectsHelper
link_to(simple_sanitize(owner.name), user_path(owner)) link_to(simple_sanitize(owner.name), user_path(owner))
end end
   
project_link = link_to project_path(project), { class: "project-item-select-holder" } do project_link = link_to simple_sanitize(project.name), project_path(project), { class: "project-item-select-holder"}
link_output = simple_sanitize(project.name) project_link += icon "chevron-down", class: "dropdown-toggle-caret js-projects-dropdown-toggle", data: { target: ".header-content", toggle: "dropdown" } if current_user
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
   
full_title = namespace_link + ' / ' + project_link full_title = namespace_link + ' / ' + project_link
full_title += ' · '.html_safe + link_to(simple_sanitize(name), url) if name full_title += ' · '.html_safe + link_to(simple_sanitize(name), url) if name
Loading
Loading
Loading
@@ -45,6 +45,8 @@
Loading
@@ -45,6 +45,8 @@
   
%h1.title= title %h1.title= title
   
= yield :header_content
= render 'shared/outdated_browser' = render 'shared/outdated_browser'
   
- if @project && !@project.empty_repo? - if @project && !@project.empty_repo?
Loading
Loading
Loading
@@ -17,4 +17,11 @@
Loading
@@ -17,4 +17,11 @@
- content_for :scripts_body do - content_for :scripts_body do
= render "layouts/init_auto_complete" if current_user = 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" = render template: "layouts/application"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment