@@ -0,0 +1,32 | |||
|
1 | <h2><%= l(:label_search) %></h2> | |
|
2 | ||
|
3 | <div class="box"> | |
|
4 | <% form_tag({:action => 'search', :id => @project}, :method => :get) do %> | |
|
5 | <p><%= text_field_tag 'token', @token, :size => 30 %> | |
|
6 | <%= check_box_tag 'scope[]', 'issues', (@scope.include? 'issues') %> <label><%= l(:label_issue_plural) %></label> | |
|
7 | <%= check_box_tag 'scope[]', 'news', (@scope.include? 'news') %> <label><%= l(:label_news_plural) %></label> | |
|
8 | <%= check_box_tag 'scope[]', 'documents', (@scope.include? 'documents') %> <label><%= l(:label_document_plural) %></label></p> | |
|
9 | <%= submit_tag l(:button_submit), :name => 'submit' %> | |
|
10 | <% end %> | |
|
11 | </div> | |
|
12 | ||
|
13 | <% if @results %> | |
|
14 | <h3><%= lwr(:label_result, @results.length) %></h3> | |
|
15 | <ul> | |
|
16 | <% @results.each do |e| %> | |
|
17 | <li><p> | |
|
18 | <% if e.is_a? Issue %> | |
|
19 | <%= link_to "#{e.tracker.name} ##{e.id}", :controller => 'issues', :action => 'show', :id => e %>: <%= highlight(h(e.subject), @token) %><br /> | |
|
20 | <i><%= e.author.name %>, <%= format_time(e.created_on) %></i> | |
|
21 | <% elsif e.is_a? News %> | |
|
22 | <%=l(:label_news)%>: <%= link_to highlight(h(e.title), @token), :controller => 'news', :action => 'show', :id => e %><br /> | |
|
23 | <% unless e.summary.empty? %><%=h e.summary %><br /><% end %> | |
|
24 | <i><%= e.author.name %>, <%= format_time(e.created_on) %></i> | |
|
25 | <% elsif e.is_a? Document %> | |
|
26 | <%=l(:label_document)%>: <%= link_to highlight(h(e.title), @token), :controller => 'documents', :action => 'show', :id => e %><br /> | |
|
27 | <i><%= format_time(e.created_on) %></i> | |
|
28 | <% end %> | |
|
29 | </p></li> | |
|
30 | <% end %> | |
|
31 | </ul> | |
|
32 | <% end %> No newline at end of file |
@@ -0,0 +1,9 | |||
|
1 | class AddSearchPermission < ActiveRecord::Migration | |
|
2 | def self.up | |
|
3 | Permission.create :controller => "projects", :action => "search", :description => "label_search", :sort => 130, :is_public => true, :mail_option => 0, :mail_enabled => 0 | |
|
4 | end | |
|
5 | ||
|
6 | def self.down | |
|
7 | Permission.find_by_controller_and_action('projects', 'roadmap').destroy | |
|
8 | end | |
|
9 | end |
@@ -539,6 +539,18 class ProjectsController < ApplicationController | |||
|
539 | 539 | end |
|
540 | 540 | end |
|
541 | 541 | |
|
542 | def search | |
|
543 | @token = params[:token] | |
|
544 | @scope = params[:scope] || (params[:submit] ? [] : %w(issues news documents) ) | |
|
545 | ||
|
546 | if @token and @token.length > 2 | |
|
547 | @results = [] | |
|
548 | @results += @project.issues.find(:all, :include => :author, :conditions => ["issues.subject like ?", "%#{@token}%"] ) if @scope.include? 'issues' | |
|
549 | @results += @project.news.find(:all, :conditions => ["news.title like ?", "%#{@token}%"], :include => :author ) if @scope.include? 'news' | |
|
550 | @results += @project.documents.find(:all, :conditions => ["title like ?", "%#{@token}%"] ) if @scope.include? 'documents' | |
|
551 | end | |
|
552 | end | |
|
553 | ||
|
542 | 554 | private |
|
543 | 555 | # Find project of id params[:id] |
|
544 | 556 | # if not found, redirect to project list |
@@ -93,6 +93,7 | |||
|
93 | 93 | <%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %> |
|
94 | 94 | <%= link_to l(:label_member_plural), {:controller => 'projects', :action => 'list_members', :id => @project }, :class => "menuItem" %> |
|
95 | 95 | <%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %> |
|
96 | <%= link_to l(:label_search), {:controller => 'projects', :action => 'search', :id => @project }, :class => "menuItem" %> | |
|
96 | 97 | <%= link_to l(:label_repository), {:controller => 'repositories', :action => 'show', :id => @project}, :class => "menuItem" if @project.repository and !@project.repository.new_record? %> |
|
97 | 98 | <%= link_to_if_authorized l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project }, :class => "menuItem" %> |
|
98 | 99 | </div> |
@@ -116,6 +117,7 | |||
|
116 | 117 | <li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li> |
|
117 | 118 | <li><%= link_to l(:label_member_plural), :controller => 'projects', :action => 'list_members', :id => @project %></li> |
|
118 | 119 | <li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li> |
|
120 | <li><%= link_to l(:label_search), :controller => 'projects', :action => 'search', :id => @project %></li> | |
|
119 | 121 | <li><%= link_to l(:label_repository), :controller => 'repositories', :action => 'show', :id => @project if @project.repository and !@project.repository.new_record? %></li> |
|
120 | 122 | <li><%= link_to_if_authorized l(:label_settings), :controller => 'projects', :action => 'settings', :id => @project %></li> |
|
121 | 123 | </ul> |
@@ -315,6 +315,9 label_sort_higher: Aufzurichten | |||
|
315 | 315 | label_sort_lower: Herabzusteigen |
|
316 | 316 | label_sort_lowest: Letzter |
|
317 | 317 | label_roadmap: Roadmap |
|
318 | label_search: Suche | |
|
319 | label_result: %d Resultat | |
|
320 | label_result_plural: %d Resultate | |
|
318 | 321 | |
|
319 | 322 | button_login: Einloggen |
|
320 | 323 | button_submit: Einreichen |
@@ -315,6 +315,9 label_sort_higher: Move up | |||
|
315 | 315 | label_sort_lower: Move down |
|
316 | 316 | label_sort_lowest: Move to bottom |
|
317 | 317 | label_roadmap: Roadmap |
|
318 | label_search: Search | |
|
319 | label_result: %d result | |
|
320 | label_result_plural: %d results | |
|
318 | 321 | |
|
319 | 322 | button_login: Login |
|
320 | 323 | button_submit: Submit |
@@ -315,6 +315,9 label_sort_higher: Subir | |||
|
315 | 315 | label_sort_lower: Bajar |
|
316 | 316 | label_sort_lowest: Último |
|
317 | 317 | label_roadmap: Roadmap |
|
318 | label_search: Búsqueda | |
|
319 | label_result: %d resultado | |
|
320 | label_result_plural: %d resultados | |
|
318 | 321 | |
|
319 | 322 | button_login: Conexión |
|
320 | 323 | button_submit: Someter |
@@ -315,6 +315,9 label_sort_higher: Remonter | |||
|
315 | 315 | label_sort_lower: Descendre |
|
316 | 316 | label_sort_lowest: Descendre en dernier |
|
317 | 317 | label_roadmap: Roadmap |
|
318 | label_search: Recherche | |
|
319 | label_result: %d résultat | |
|
320 | label_result_plural: %d résultats | |
|
318 | 321 | |
|
319 | 322 | button_login: Connexion |
|
320 | 323 | button_submit: Soumettre |
General Comments 0
You need to be logged in to leave comments.
Login now