end\r
end\r
\r
+ def search\r
+ @token = params[:token]\r
+ @scope = params[:scope] || (params[:submit] ? [] : %w(issues news documents) )\r
+\r
+ if @token and @token.length > 2\r
+ @results = []\r
+ @results += @project.issues.find(:all, :include => :author, :conditions => ["issues.subject like ?", "%#{@token}%"] ) if @scope.include? 'issues'\r
+ @results += @project.news.find(:all, :conditions => ["news.title like ?", "%#{@token}%"], :include => :author ) if @scope.include? 'news'\r
+ @results += @project.documents.find(:all, :conditions => ["title like ?", "%#{@token}%"] ) if @scope.include? 'documents'\r
+ end\r
+ end\r
+ \r
private\r
# Find project of id params[:id]\r
# if not found, redirect to project list\r
<%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %>\r
<%= link_to l(:label_member_plural), {:controller => 'projects', :action => 'list_members', :id => @project }, :class => "menuItem" %>\r
<%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %>\r
+ <%= link_to l(:label_search), {:controller => 'projects', :action => 'search', :id => @project }, :class => "menuItem" %>\r
<%= link_to l(:label_repository), {:controller => 'repositories', :action => 'show', :id => @project}, :class => "menuItem" if @project.repository and !@project.repository.new_record? %>\r
<%= link_to_if_authorized l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project }, :class => "menuItem" %>\r
</div>\r
<li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li>\r
<li><%= link_to l(:label_member_plural), :controller => 'projects', :action => 'list_members', :id => @project %></li>\r
<li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li>\r
+ <li><%= link_to l(:label_search), :controller => 'projects', :action => 'search', :id => @project %></li>\r
<li><%= link_to l(:label_repository), :controller => 'repositories', :action => 'show', :id => @project if @project.repository and !@project.repository.new_record? %></li>\r
<li><%= link_to_if_authorized l(:label_settings), :controller => 'projects', :action => 'settings', :id => @project %></li>\r
</ul>\r
--- /dev/null
+<h2><%= l(:label_search) %></h2>\r
+\r
+<div class="box">\r
+<% form_tag({:action => 'search', :id => @project}, :method => :get) do %>\r
+<p><%= text_field_tag 'token', @token, :size => 30 %>\r
+<%= check_box_tag 'scope[]', 'issues', (@scope.include? 'issues') %> <label><%= l(:label_issue_plural) %></label>\r
+<%= check_box_tag 'scope[]', 'news', (@scope.include? 'news') %> <label><%= l(:label_news_plural) %></label>\r
+<%= check_box_tag 'scope[]', 'documents', (@scope.include? 'documents') %> <label><%= l(:label_document_plural) %></label></p>\r
+<%= submit_tag l(:button_submit), :name => 'submit' %>\r
+<% end %>\r
+</div>\r
+\r
+<% if @results %>\r
+ <h3><%= lwr(:label_result, @results.length) %></h3>\r
+ <ul>\r
+ <% @results.each do |e| %>\r
+ <li><p>\r
+ <% if e.is_a? Issue %>\r
+ <%= link_to "#{e.tracker.name} ##{e.id}", :controller => 'issues', :action => 'show', :id => e %>: <%= highlight(h(e.subject), @token) %><br />\r
+ <i><%= e.author.name %>, <%= format_time(e.created_on) %></i>\r
+ <% elsif e.is_a? News %>\r
+ <%=l(:label_news)%>: <%= link_to highlight(h(e.title), @token), :controller => 'news', :action => 'show', :id => e %><br />\r
+ <% unless e.summary.empty? %><%=h e.summary %><br /><% end %>\r
+ <i><%= e.author.name %>, <%= format_time(e.created_on) %></i>\r
+ <% elsif e.is_a? Document %>\r
+ <%=l(:label_document)%>: <%= link_to highlight(h(e.title), @token), :controller => 'documents', :action => 'show', :id => e %><br />\r
+ <i><%= format_time(e.created_on) %></i>\r
+ <% end %>\r
+ </p></li> \r
+ <% end %>\r
+ </ul>\r
+<% end %>
\ No newline at end of file
--- /dev/null
+class AddSearchPermission < ActiveRecord::Migration
+ def self.up
+ Permission.create :controller => "projects", :action => "search", :description => "label_search", :sort => 130, :is_public => true, :mail_option => 0, :mail_enabled => 0
+ end
+
+ def self.down
+ Permission.find_by_controller_and_action('projects', 'roadmap').destroy
+ end
+end
label_sort_lower: Herabzusteigen\r
label_sort_lowest: Letzter\r
label_roadmap: Roadmap\r
+label_search: Suche\r
+label_result: %d Resultat\r
+label_result_plural: %d Resultate\r
\r
button_login: Einloggen\r
button_submit: Einreichen\r
label_sort_lower: Move down\r
label_sort_lowest: Move to bottom\r
label_roadmap: Roadmap\r
+label_search: Search\r
+label_result: %d result\r
+label_result_plural: %d results\r
\r
button_login: Login\r
button_submit: Submit\r
label_sort_lower: Bajar\r
label_sort_lowest: Último\r
label_roadmap: Roadmap\r
+label_search: Búsqueda\r
+label_result: %d resultado\r
+label_result_plural: %d resultados\r
\r
button_login: Conexión\r
button_submit: Someter\r
label_sort_lower: Descendre\r
label_sort_lowest: Descendre en dernier\r
label_roadmap: Roadmap\r
+label_search: Recherche\r
+label_result: %d résultat\r
+label_result_plural: %d résultats\r
\r
button_login: Connexion\r
button_submit: Soumettre\r
label_sort_lower: 下へ\r
label_sort_lowest: 一番下へ\r
label_roadmap: ロードマップ\r
+label_search: Search\r
+label_result: %d result\r
+label_result_plural: %d results\r
\r
button_login: ログイン\r
button_submit: 変更\r
hr { border:none; border-bottom: dotted 1px #c0c0c0; }\r
table p {margin:0; padding:0;}\r
\r
+strong.highlight { background-color: #FCFD8D;}\r
+\r
div.square {\r
border: 1px solid #999;\r
float: left;\r