summaryrefslogtreecommitdiff
path: root/app/views/search
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-07 20:48:57 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-07 20:52:43 +0200
commitcc64f2a814802abe9ae3bb8297079b643c8774df (patch)
tree5eb20bceb48b9f81093e8734907fe4c9f7b40ada /app/views/search
parent0a1603992490d47b3fe676a02dedb5417603a1f2 (diff)
downloadgitlab-ce-cc64f2a814802abe9ae3bb8297079b643c8774df.tar.gz
Common filtering for dashboard and group. Share partial search result partial
Diffstat (limited to 'app/views/search')
-rw-r--r--app/views/search/_result.html.haml84
-rw-r--r--app/views/search/show.html.haml85
2 files changed, 85 insertions, 84 deletions
diff --git a/app/views/search/_result.html.haml b/app/views/search/_result.html.haml
index 8b137891791..79bed4f737c 100644
--- a/app/views/search/_result.html.haml
+++ b/app/views/search/_result.html.haml
@@ -1 +1,85 @@
+%br
+%h3.page_title
+ Search results
+ %span.cgray (#{@projects.count + @merge_requests.count + @issues.count + @wiki_pages.count})
+%hr
+.search_results
+ .row
+ .span6
+ %table
+ %thead
+ %tr
+ %th Projects
+ %tbody
+ - @projects.each do |project|
+ %tr
+ %td
+ = link_to project do
+ %strong.term= project.name_with_namespace
+ %small.cgray
+ last activity at
+ = project.last_activity_date.stamp("Aug 25, 2011")
+ - if @projects.blank?
+ %tr
+ %td
+ %h4.nothing_here_message No Projects
+ %br
+ %table
+ %thead
+ %tr
+ %th Merge Requests
+ %tbody
+ - @merge_requests.each do |merge_request|
+ %tr
+ %td
+ = link_to [merge_request.project, merge_request] do
+ %span.badge.badge-info ##{merge_request.id}
+ &ndash;
+ %strong.term= truncate merge_request.title, length: 50
+ %strong.right
+ %span.label= merge_request.project.name
+ - if @merge_requests.blank?
+ %tr
+ %td
+ %h4.nothing_here_message No Merge Requests
+ .span6
+ %table
+ %thead
+ %tr
+ %th Issues
+ %tbody
+ - @issues.each do |issue|
+ %tr
+ %td
+ = link_to [issue.project, issue] do
+ %span.badge.badge-info ##{issue.id}
+ &ndash;
+ %strong.term= truncate issue.title, length: 40
+ %strong.right
+ %span.label= issue.project.name
+ - if @issues.blank?
+ %tr
+ %td
+ %h4.nothing_here_message No Issues
+ .span6
+ %table
+ %thead
+ %tr
+ %th Wiki
+ %tbody
+ - @wiki_pages.each do |wiki_page|
+ %tr
+ %td
+ = link_to project_wiki_path(wiki_page.project, wiki_page) do
+ %strong.term= truncate wiki_page.title, length: 40
+ %strong.right
+ %span.label= wiki_page.project.name
+ - if @wiki_pages.blank?
+ %tr
+ %td
+ %h4.nothing_here_message No wiki pages
+:javascript
+ $(function() {
+ $(".search_results .term").highlight("#{escape_javascript(params[:search])}");
+ })
diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml
index ddcef442490..aa0d6d700d9 100644
--- a/app/views/search/show.html.haml
+++ b/app/views/search/show.html.haml
@@ -6,87 +6,4 @@
= search_field_tag :search, params[:search], placeholder: "issue 143", class: "input-xxlarge search-text-input", id: "dashboard_search"
= submit_tag 'Search', class: "btn primary wide"
- if params[:search].present?
- %br
- %h3
- Search results
- %small (#{@projects.count + @merge_requests.count + @issues.count + @wiki_pages.count})
- %hr
- .search_results
- .row
- .span6
- %table
- %thead
- %tr
- %th Projects
- %tbody
- - @projects.each do |project|
- %tr
- %td
- = link_to project do
- %strong.term= project.name_with_namespace
- %small.cgray
- last activity at
- = project.last_activity_date.stamp("Aug 25, 2011")
- - if @projects.blank?
- %tr
- %td
- %h4.nothing_here_message No Projects
- %br
- %table
- %thead
- %tr
- %th Merge Requests
- %tbody
- - @merge_requests.each do |merge_request|
- %tr
- %td
- = link_to [merge_request.project, merge_request] do
- %span.badge.badge-info ##{merge_request.id}
- &ndash;
- %strong.term= truncate merge_request.title, length: 50
- %strong.right
- %span.label= merge_request.project.name
- - if @merge_requests.blank?
- %tr
- %td
- %h4.nothing_here_message No Merge Requests
- .span6
- %table
- %thead
- %tr
- %th Issues
- %tbody
- - @issues.each do |issue|
- %tr
- %td
- = link_to [issue.project, issue] do
- %span.badge.badge-info ##{issue.id}
- &ndash;
- %strong.term= truncate issue.title, length: 40
- %strong.right
- %span.label= issue.project.name
- - if @issues.blank?
- %tr
- %td
- %h4.nothing_here_message No Issues
- .span6
- %table
- %thead
- %tr
- %th Wiki
- %tbody
- - @wiki_pages.each do |wiki_page|
- %tr
- %td
- = link_to project_wiki_path(wiki_page.project, wiki_page) do
- %strong.term= truncate wiki_page.title, length: 40
- %strong.right
- %span.label= wiki_page.project.name
- - if @wiki_pages.blank?
- %tr
- %td
- %h4.nothing_here_message No wiki pages
- :javascript
- $(function() {
- $(".search_results .term").highlight("#{escape_javascript(params[:search])}");
- })
+ = render 'search/result'