if query.blank?
@projects = []
@merge_requests = []
+ @issues = []
else
- @projects = Project.search(query).limit(10)
- @merge_requests = MergeRequest.search(query).limit(10)
+ @projects = current_user.projects.search(query).limit(10)
+ @merge_requests = MergeRequest.where(:project_id => current_user.project_ids).search(query).limit(10)
+ @issues = Issue.where(:project_id => current_user.project_ids).search(query).limit(10)
end
end
end
%small Nothing here
- else
- if @projects.any?
- - @projects.each do |project|
- = link_to project do
- %h4
- %span.ico.project
- = project.name
- %small
- last activity at
- = project.last_activity_date.stamp("Aug 25, 2011")
+ %h4 Projects
+ .padded
+ - @projects.each do |project|
+ = link_to project do
+ %h4
+ %span.ico.project
+ = project.name
+ %small
+ last activity at
+ = project.last_activity_date.stamp("Aug 25, 2011")
- if @merge_requests.any?
- - @merge_requests.each do |merge_request|
- = link_to [merge_request.project, merge_request] do
- %h5
- Merge Request #
- = merge_request.id
- –
- = truncate merge_request.title, :length => 50
- %small
- updated at
- = merge_request.updated_at.stamp("Aug 25, 2011")
- %strong
- %span.label= merge_request.project.name
+ %h4 Merge Requests
+ .padded
+ - @merge_requests.each do |merge_request|
+ = link_to [merge_request.project, merge_request] do
+ %h5
+ Merge Request #
+ = merge_request.id
+ –
+ = truncate merge_request.title, :length => 50
+ %small
+ updated at
+ = merge_request.updated_at.stamp("Aug 25, 2011")
+ %strong
+ %span.label= merge_request.project.name
+ - if @issues.any?
+ %h4 Issues
+ .padded
+ - @issues.each do |issue|
+ = link_to [issue.project, issue] do
+ %h5
+ Issue #
+ = issue.id
+ –
+ = truncate issue.title, :length => 50
+ %small
+ updated at
+ = issue.updated_at.stamp("Aug 25, 2011")
+ %strong
+ %span.label= issue.project.name
:javascript
$(function() {
$(".search_results").highlight("#{params[:search]}");