# HG changeset patch # User Chris Cannam # Date 1310564234 -3600 # Node ID b9f81065a8e10c24948cca84dee1554e3638165b # Parent a8e5a47c5596b36defaa56773e88605bfaec722b# Parent d7326bb4f6f0cda12bfdcf0fffed630c3208203e Merge from branch "feature_142" diff -r d7326bb4f6f0 -r b9f81065a8e1 .hgignore --- a/.hgignore Wed Jul 13 14:26:44 2011 +0100 +++ b/.hgignore Wed Jul 13 14:37:14 2011 +0100 @@ -26,3 +26,5 @@ *.rbc .svn/ .git/ +*~ + diff -r d7326bb4f6f0 -r b9f81065a8e1 app/controllers/issues_controller.rb --- a/app/controllers/issues_controller.rb Wed Jul 13 14:26:44 2011 +0100 +++ b/app/controllers/issues_controller.rb Wed Jul 13 14:37:14 2011 +0100 @@ -301,7 +301,7 @@ # is in this issues watcher's list # if not, adds it. - if params[:issue][:assigned_to_id] && !params[:issue][:assigned_to_id].empty?: + if params[:issue] && params[:issue][:assigned_to_id] && !params[:issue][:assigned_to_id].empty?: unless @issue.watched_by?(User.find(params[:issue][:assigned_to_id])): @issue.add_watcher(User.find(params[:issue][:assigned_to_id])) end diff -r d7326bb4f6f0 -r b9f81065a8e1 app/controllers/search_controller.rb --- a/app/controllers/search_controller.rb Wed Jul 13 14:26:44 2011 +0100 +++ b/app/controllers/search_controller.rb Wed Jul 13 14:37:14 2011 +0100 @@ -69,6 +69,7 @@ # no more than 5 tokens to search for @tokens.slice! 5..-1 if @tokens.size > 5 + @project_matches = [] @results = [] @results_by_type = Hash.new {|h,k| h[k] = 0} @@ -82,6 +83,12 @@ :before => params[:previous].nil?) @results += r @results_by_type[s] += c + if s == 'projects' + r, c = s.singularize.camelcase.constantize.search(@tokens, nil, + :all_words => @all_words, + :titles_only => 1) + @project_matches += r + end end @results = @results.sort {|a,b| b.event_datetime <=> a.event_datetime} if params[:previous].nil? diff -r d7326bb4f6f0 -r b9f81065a8e1 app/views/projects/show.rhtml --- a/app/views/projects/show.rhtml Wed Jul 13 14:26:44 2011 +0100 +++ b/app/views/projects/show.rhtml Wed Jul 13 14:37:14 2011 +0100 @@ -20,9 +20,6 @@
+<% if @project_matches and !@project_matches.empty? and (@project_matches.count < 6) and !@pagination_previous_date %> +

<%= l(:label_matching_project_plural) %> (<%= @project_matches.count %>)

+
+ <% @project_matches.each do |e| %> +
<%= content_tag('span', h(e.project), :class => 'project') unless @project == e.project %> <%= link_to highlight_tokens(truncate(e.event_title, :length => 255), @tokens), e.event_url %>
+
<%= e.short_description %> + <% end %> +
+<% end %> + <% if @results %>

<%= l(:label_result_plural) %> (<%= @results_by_type.values.sum %>)

diff -r d7326bb4f6f0 -r b9f81065a8e1 config/locales/en.yml --- a/config/locales/en.yml Wed Jul 13 14:26:44 2011 +0100 +++ b/config/locales/en.yml Wed Jul 13 14:37:14 2011 +0100 @@ -705,7 +705,8 @@ label_roadmap_overdue: "%{value} late" label_roadmap_no_issues: No issues for this version label_search: Search - label_result_plural: Results + label_result_plural: Search results + label_matching_project_plural: Matching project names label_all_words: All words label_wiki: Wiki label_wiki_edit: Wiki edit