aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-12-21 23:03:58 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-12-21 23:03:58 +0100
commit27ef81ee84252c85e3dd09d44d88fb441700182b (patch)
treede09fc298f72e31f7ac58adbd819cf3603e1272e /sonar-server
parentb87e9dae5c6f0a10f60340f69e78bfe4146e4ac5 (diff)
downloadsonarqube-27ef81ee84252c85e3dd09d44d88fb441700182b.tar.gz
sonarqube-27ef81ee84252c85e3dd09d44d88fb441700182b.zip
SONAR-983 i18n, better purge, fix NPE when deleted resource
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/project.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/search/_autocomplete.html.erb25
2 files changed, 15 insertions, 11 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
index 01b358e17ce..0a4028f22b7 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
@@ -44,6 +44,7 @@ class Project < ActiveRecord::Base
if project
Snapshot.update_all(['islast=?', false], ['(root_project_id=? OR project_id=?) AND islast=?', project.id, project.id, true])
Project.delete_all(['id=? OR root_id=? or copy_resource_id=?', project.id, project.id, project.id])
+ ResourceIndex.delete_all(['root_project_id=?', project.id])
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/search/_autocomplete.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/search/_autocomplete.html.erb
index e17bcfba883..029e8a7d3b6 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/search/_autocomplete.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/search/_autocomplete.html.erb
@@ -1,24 +1,27 @@
-<% search = params[:s] %>
<% unless @results_by_qualifier.empty? %>
<ul>
<%
@results_by_qualifier.keys.each do |qualifier|
%>
- <%
- @results_by_qualifier[qualifier].each_with_index do |resource_index, index|
+<%
+ first=true
+ @results_by_qualifier[qualifier].each do |resource_index|
resource=@resources_by_id[resource_index.resource_id]
- %>
+ if resource
+%>
<li id="<%= resource.id -%>">
- <div class="q"><%= index==0 ? message("qualifiers.#{qualifier}") : '' -%></div>
-
- <%= qualifier_icon resource -%> <%= highlight(resource.name(true), search) -%>
+ <div class="q"><%= message("qualifiers.#{qualifier}") if first -%></div>
+ <%= qualifier_icon resource -%> <%= highlight(truncate(resource.name(true), :length => 65), params[:s]) -%>
</li>
- <% end %>
- <% end %>
+<% first=false
+ end
+ end
+ end
+%>
</ul>
<% else %>
<ul>
- <li>No results</li>
+ <li><%= message('no_results') -%></li>
</ul>
<% end %>
-<div class="autocompleteNote"><%= @total -%> results (<%= Time.now - @start_time -%> seconds)</div> \ No newline at end of file
+<div class="autocompleteNote"><%= @total -%> <%= message('search.results') -%> <%= message('search.duration', :params => [Time.now - @start_time]) -%></div> \ No newline at end of file