From 538e3da8c874c9a7c79bde93a3328f48d25fe9db Mon Sep 17 00:00:00 2001 From: George Vinogradov Date: Thu, 19 Jan 2012 16:10:50 +0400 Subject: [PATCH] [issue #64] Added search through wiki --- app/views/wiki/_results.html.haml | 15 ++++++++++++--- app/views/wiki/pages.html.haml | 2 +- app/views/wiki/search.html.haml | 27 +++++++++++++++++++++++++++ config/locales/ru.yml | 6 +++++- 4 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 app/views/wiki/search.html.haml diff --git a/app/views/wiki/_results.html.haml b/app/views/wiki/_results.html.haml index a56699ecc..97dcfb777 100644 --- a/app/views/wiki/_results.html.haml +++ b/app/views/wiki/_results.html.haml @@ -2,11 +2,20 @@ - if @results and !@results.empty? %ul - @results.each do |result| - %li= link_to result.name, project_wiki_path(@project, CGI.escape(result.name)) + %li + - if action_name == 'search' + = link_to result[:name], project_wiki_path(@project, CGI.escape(result[:name])) + %span.count= "(#{result.count} #{t("layout.wiki.matches")})" + -else + = link_to result.name, project_wiki_path(@project, CGI.escape(result.name)) - else %p#no-results - = t("layout.wiki.no_pages_in") - %strong= @ref + - @st_ref = capture do + %strong= @ref || @query + - if action_name == 'search' + = raw t("layout.wiki.no_results_for_search", :query => @st_ref) + - else + = raw t("layout.wiki.no_pages_in", :ref => @st_ref) #footer %ul.actions diff --git a/app/views/wiki/pages.html.haml b/app/views/wiki/pages.html.haml index 2539e284b..a30d86a97 100644 --- a/app/views/wiki/pages.html.haml +++ b/app/views/wiki/pages.html.haml @@ -15,7 +15,7 @@ .inner #wiki-wrapper.results #head - %h1.title= "#{t("layout.wiki.all_pages_in")} #{@ref}" + %h1.title= t("layout.wiki.all_pages_in", :ref => @ref) %ul.actions %li.minibutton = link_to t("layout.wiki.home"), project_wiki_index_path(@project), diff --git a/app/views/wiki/search.html.haml b/app/views/wiki/search.html.haml new file mode 100644 index 000000000..a70feb5cd --- /dev/null +++ b/app/views/wiki/search.html.haml @@ -0,0 +1,27 @@ += render :partial => 'gollum_includes' += render :partial => 'project_short' + +%a{ :name => "wiki"} +.block + .secondary-navigation + %ul.wat-cf + %li.first= link_to t("layout.wiki.home"), project_wiki_index_path(@project) + %li= link_to t("layout.wiki.pages"), pages_project_wiki_index_path(@project) + %li= link_to t("layout.wiki.wiki_history"), '#' + %li= link_to t("layout.wiki.git_access"), '#' + + .content + .inner + #wiki-wrapper.results + #head + %h1.title= t("layout.wiki.search_results_for", :query => @query) + %ul.actions + %li.minibutton + = link_to t("layout.wiki.home"), project_wiki_index_path(@project), + :class => 'action-edit-page' + = render :partial => 'searchbar' + + = render :partial => "results" + +- content_for :sidebar do + - render :partial => 'projects/sidebar' diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 3401e81e2..29f54903f 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -182,7 +182,11 @@ ru: view_commit: Показать версию compare_revisions: Сравнить версии back_to_top: Наверх - all_pages_in: Все страницы в + all_pages_in: "Все страницы в %{ref}:" + search_results_for: "Результаты поиска для %{query}:" + no_pages_in: В %{ref} нет страниц для отображения. + no_results_for_search: По запросу %{query} ничего не найдено. + matches: Совпадений roles: confirm_delete: Вы уверены, что хотите удалить эту роль?