changeset 502:b9f81065a8e1 cannam

Merge from branch "feature_142"
author Chris Cannam
date Wed, 13 Jul 2011 14:37:14 +0100
parents a8e5a47c5596 (diff) d7326bb4f6f0 (current diff)
children 5d608412b003 3cab7f3ad3c7
files app/views/projects/settings/_members.rhtml config/locales/en.yml
diffstat 6 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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/
+*~
+
--- 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
--- 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?
--- 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 @@
 
 <div class="contextual" style="clear: right">
 <ul>
-<% @users_by_role.keys.sort.each do |role| %>
-<li><%=h role %>: <%= @users_by_role[role].sort.collect{|u| link_to_user u}.join(", ") %></li>
-<% end %>
 <% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link(h(@project.homepage)) %></li><% end %>
 <% if @subprojects.any? %>
 	<li><%=l(:label_subproject_plural)%>:
--- a/app/views/search/index.rhtml	Wed Jul 13 14:26:44 2011 +0100
+++ b/app/views/search/index.rhtml	Wed Jul 13 14:37:14 2011 +0100
@@ -18,6 +18,16 @@
 <% end %>
 </div>
 
+<% if @project_matches and !@project_matches.empty? and (@project_matches.count < 6) and !@pagination_previous_date %>
+   <h3><%= l(:label_matching_project_plural) %> (<%= @project_matches.count %>)</h3>
+    <dl id="search-results">
+      <% @project_matches.each do |e| %>
+        <dt class="<%= e.event_type %>"><%= 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 %></dt>
+        <dd><span class="description"><%= e.short_description %></span>
+      <% end %>
+    </dl>
+<% end %>
+
 <% if @results %>
     
     <h3><%= l(:label_result_plural) %> (<%= @results_by_type.values.sum %>)</h3>
--- 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