Skip to content

Commit

Permalink
Merge pull request #1682 from riyad/improve-search-suggestions
Browse files Browse the repository at this point in the history
Improve (static) suggestions in global search field
  • Loading branch information
vsizov committed Oct 12, 2012
2 parents 89a349f + 64008b9 commit 4083d01
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions app/helpers/application_helper.rb
Expand Up @@ -76,26 +76,40 @@ def grouped_options_refs(destination = :tree)

def search_autocomplete_source
projects = current_user.projects.map{ |p| { label: p.name, url: project_path(p) } }

default_nav = [
{ label: "Profile", url: profile_path },
{ label: "Keys", url: keys_path },
{ label: "Dashboard", url: root_path },
{ label: "Admin", url: admin_root_path }
{ label: "My Profile", url: profile_path },
{ label: "My SSH Keys", url: keys_path },
{ label: "My Dashboard", url: root_path },
{ label: "Admin Section", url: admin_root_path },
]

project_nav = []
help_nav = [
{ label: "Workflow Help", url: help_workflow_path },
{ label: "Permissions Help", url: help_permissions_path },
{ label: "Web Hooks Help", url: help_web_hooks_path },
{ label: "System Hooks Help", url: help_system_hooks_path },
{ label: "API Help", url: help_api_path },
{ label: "Markdown Help", url: help_markdown_path },
{ label: "SSH Keys Help", url: help_ssh_path },
]

project_nav = []
if @project && !@project.new_record?
project_nav = [
{ label: "#{@project.name} / Issues", url: project_issues_path(@project) },
{ label: "#{@project.name} / Wall", url: wall_project_path(@project) },
{ label: "#{@project.name} / Tree", url: project_tree_path(@project, @ref || @project.root_ref) },
{ label: "#{@project.name} / Commits", url: project_commits_path(@project, @ref || @project.root_ref) },
{ label: "#{@project.name} / Team", url: project_team_index_path(@project) }
{ label: "#{@project.name} Issues", url: project_issues_path(@project) },
{ label: "#{@project.name} Commits", url: project_commits_path(@project, @ref || @project.root_ref) },
{ label: "#{@project.name} Merge Requests", url: project_merge_requests_path(@project) },
{ label: "#{@project.name} Milestones", url: project_milestones_path(@project) },
{ label: "#{@project.name} Snippets", url: project_snippets_path(@project) },
{ label: "#{@project.name} Team", url: project_team_index_path(@project) },
{ label: "#{@project.name} Tree", url: project_tree_path(@project, @ref || @project.root_ref) },
{ label: "#{@project.name} Wall", url: wall_project_path(@project) },
{ label: "#{@project.name} Wiki", url: project_wikis_path(@project) },
]
end

[projects, default_nav, project_nav].flatten.to_json
[projects, default_nav, project_nav, help_nav].flatten.to_json
end

def emoji_autocomplete_source
Expand Down

0 comments on commit 4083d01

Please sign in to comment.