Revision 1254:a54ce736229d plugins
| plugins/redmine_tags/app/views/projects/index.html.erb | ||
|---|---|---|
| 15 | 15 |
</h2> |
| 16 | 16 |
|
| 17 | 17 |
<div style="clear:both;"></div> |
| 18 |
<%= form_tag(:controller => :projects, :action => :index, :method => :get, :html => {:id => :project_filtering_form}, :remote => true) do -%>
|
|
| 19 | 18 |
|
| 19 |
<%= form_tag :projects, :method => :get do -%> |
|
| 20 | 20 |
<fieldset id="filters_fieldset" class="collapsible"> |
| 21 | 21 |
<legend><%= l(:label_filter_plural) %></legend> |
| 22 | 22 |
|
| ... | ... | |
| 26 | 26 |
</div> |
| 27 | 27 |
|
| 28 | 28 |
<p class='q'> |
| 29 |
<%= label_tag 'q', l('project_filtering_q_label') %>
|
|
| 30 |
<%= text_field_tag 'q', @question, :size => 30, :id => 'search-input' %> |
|
| 29 |
<%= label_tag 'search', l('project_filtering_q_label') %>
|
|
| 30 |
<%= text_field_tag 'search', params[:search] -%> |
|
| 31 |
<%= submit_tag :search, :name => nil %> |
|
| 31 | 32 |
</p> |
| 32 | 33 |
|
| 33 |
<p style="display: none;"><%= submit_tag( l('button_filter'), :id => 'submitButton') -%></p>
|
|
| 34 |
<%= link_to l(:button_apply), {}, :onclick => "$('submitButton').click(); return false;", :class => 'icon icon-checked' -%>
|
|
| 35 |
<%= link_to l(:button_clear), {}, :class => 'icon icon-reload' %>
|
|
| 36 | 34 |
</div> |
| 37 | 35 |
|
| 38 | 36 |
</fieldset> |
| plugins/redmine_tags/assets/javascripts/projects_index.js | ||
|---|---|---|
| 2 | 2 |
init: function(){
|
| 3 | 3 |
var self = this; |
| 4 | 4 |
$('fieldset#filters_fieldset legend').live("click", self.toggle);
|
| 5 |
// $('fieldset #submitButton').live("click", self.submitSearch);
|
|
| 5 | 6 |
}, |
| 6 | 7 |
|
| 7 | 8 |
expanded: false, |
| ... | ... | |
| 10 | 11 |
var fieldset = $(this).parents('fieldset').first();
|
| 11 | 12 |
fieldset.toggleClass('collapsed');
|
| 12 | 13 |
fieldset.children('div').toggle();
|
| 14 |
}, |
|
| 15 |
submitSearch: function(){
|
|
| 16 |
console.log("Submitting search");
|
|
| 17 |
$(this).submit(); |
|
| 18 |
return false; |
|
| 13 | 19 |
} |
| 14 | 20 |
}; |
| 15 | 21 |
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 16 | 26 |
/* |
| 17 | 27 |
function toggleFieldsetWithState(obj){
|
| 18 | 28 |
var fset = $(obj).parent('fieldset');
|
| ... | ... | |
| 25 | 35 |
} |
| 26 | 36 |
|
| 27 | 37 |
|
| 28 |
function submitForm(){
|
|
| 29 |
$('submitButton').click();
|
|
| 30 |
} |
|
| 31 | 38 |
|
| 32 | 39 |
|
| 33 | 40 |
function change_session(id, nstatus) {
|
| plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb | ||
|---|---|---|
| 8 | 8 |
base.send(:include, InstanceMethods) |
| 9 | 9 |
base.class_eval do |
| 10 | 10 |
unloadable |
| 11 |
skip_before_filter :authorize, :only => [:set_fieldset_status] |
|
| 12 |
skip_before_filter :find_project, :only => [:set_fieldset_status] |
|
| 11 |
# skip_before_filter :authorize, :only => [:set_fieldset_status]
|
|
| 12 |
# skip_before_filter :find_project, :only => [:set_fieldset_status]
|
|
| 13 | 13 |
|
| 14 | 14 |
alias :index filtered_index |
| 15 | 15 |
end |
| ... | ... | |
| 22 | 22 |
@limit = per_page_option |
| 23 | 23 |
|
| 24 | 24 |
# Only top-level visible projects are counted --lf.10Jan2013 |
| 25 |
top_level_visible_projects = @projects.select{ |p| p.parent_id.nil? and p.visible? }
|
|
| 25 |
top_level_visible_projects = @projects.visible_roots
|
|
| 26 | 26 |
@project_count = top_level_visible_projects.count |
| 27 | 27 |
|
| 28 | 28 |
# Project.visible_roots.find(@projects).count |
| ... | ... | |
| 31 | 31 |
@offset ||= @project_pages.current.offset |
| 32 | 32 |
end |
| 33 | 33 |
|
| 34 |
def set_fieldset_status |
|
| 35 |
|
|
| 36 |
# luisf. test for missing parameters……… |
|
| 37 |
field = params[:field_id] |
|
| 38 |
status = params[:status] |
|
| 39 |
|
|
| 40 |
session[(field + "_status").to_sym] = status |
|
| 41 |
render :nothing => true |
|
| 42 |
end |
|
| 34 |
# def set_fieldset_status
|
|
| 35 |
# |
|
| 36 |
# # luisf. test for missing parameters………
|
|
| 37 |
# field = params[:field_id]
|
|
| 38 |
# status = params[:status]
|
|
| 39 |
# |
|
| 40 |
# session[(field + "_status").to_sym] = status
|
|
| 41 |
# render :nothing => true
|
|
| 42 |
# end
|
|
| 43 | 43 |
|
| 44 | 44 |
# gets the status of the collabsible fieldsets |
| 45 |
def get_fieldset_statuses |
|
| 46 |
if session[:my_projects_fieldset_status].nil? |
|
| 47 |
@myproj_status = "true" |
|
| 48 |
else |
|
| 49 |
@myproj_status = session[:my_projects_fieldset_status] |
|
| 50 |
end |
|
| 51 |
|
|
| 52 |
if session[:filters_fieldset_status].nil? |
|
| 53 |
@filter_status = "false" |
|
| 54 |
else |
|
| 55 |
@filter_status = session[:filters_fieldset_status] |
|
| 56 |
end |
|
| 57 |
|
|
| 58 |
if params && params[:project] && !params[:project][:tag_list].nil?
|
|
| 59 |
@filter_status = "true" |
|
| 60 |
end |
|
| 61 |
|
|
| 62 |
end |
|
| 45 |
# def get_fieldset_statuses
|
|
| 46 |
# if session[:my_projects_fieldset_status].nil?
|
|
| 47 |
# @myproj_status = "true"
|
|
| 48 |
# else
|
|
| 49 |
# @myproj_status = session[:my_projects_fieldset_status]
|
|
| 50 |
# end
|
|
| 51 |
# |
|
| 52 |
# if session[:filters_fieldset_status].nil?
|
|
| 53 |
# @filter_status = "false"
|
|
| 54 |
# else
|
|
| 55 |
# @filter_status = session[:filters_fieldset_status]
|
|
| 56 |
# end
|
|
| 57 |
# |
|
| 58 |
# if params && params[:project] && !params[:project][:tag_list].# nil?
|
|
| 59 |
# @filter_status = "true"
|
|
| 60 |
# end
|
|
| 61 |
# |
|
| 62 |
# end
|
|
| 63 | 63 |
|
| 64 | 64 |
# Lists visible projects. Paginator is for top-level projects only |
| 65 | 65 |
# (subprojects belong to them) |
| 66 | 66 |
def filtered_index |
| 67 | 67 |
@project = Project.new |
| 68 | 68 |
filter_projects |
| 69 |
get_fieldset_statuses |
|
| 69 |
# get_fieldset_statuses
|
|
| 70 | 70 |
|
| 71 | 71 |
sort_clause = "name" |
| 72 | 72 |
|
| ... | ... | |
| 101 | 101 |
private |
| 102 | 102 |
|
| 103 | 103 |
def filter_projects |
| 104 |
@question = (params[:q] || "").strip |
|
| 104 |
# find projects like question |
|
| 105 |
@question = (params[:search] || "").strip |
|
| 106 |
# |
|
| 107 |
# if params.has_key?(:project) |
|
| 108 |
# @tag_list = (params[:project][:tag_list] || "").strip.split(",")
|
|
| 109 |
# else |
|
| 110 |
# @tag_list = [] |
|
| 111 |
# end |
|
| 112 |
# |
|
| 113 |
# if @question == "" |
|
| 114 |
# @projects = Project.visible_roots |
|
| 115 |
# else |
|
| 116 |
# @projects = Project.visible_roots.find(Project.visible.like(@question)) |
|
| 117 |
# end |
|
| 118 |
# |
|
| 119 |
# unless @tag_list.empty? |
|
| 120 |
# @tagged_projects_ids = Project.visible.tagged_with(@tag_list).collect{ |# project| Project.find(project.id).root }
|
|
| 121 |
# |
|
| 122 |
# @projects = @projects & @tagged_projects_ids |
|
| 123 |
# @projects = @projects.uniq |
|
| 124 |
# end |
|
| 105 | 125 |
|
| 106 |
if params.has_key?(:project) |
|
| 107 |
@tag_list = (params[:project][:tag_list] || "").strip.split(",")
|
|
| 108 |
else |
|
| 109 |
@tag_list = [] |
|
| 110 |
end |
|
| 126 |
# hack... |
|
| 127 |
@projects = Project.like(@question) |
|
| 111 | 128 |
|
| 112 |
if @question == "" |
|
| 113 |
@projects = Project.visible_roots |
|
| 114 |
else |
|
| 115 |
@projects = Project.visible_roots.find(Project.visible.search_by_question(@question)) |
|
| 116 |
end |
|
| 117 |
|
|
| 118 |
unless @tag_list.empty? |
|
| 119 |
@tagged_projects_ids = Project.visible.tagged_with(@tag_list).collect{ |project| Project.find(project.id).root }
|
|
| 120 |
|
|
| 121 |
@projects = @projects & @tagged_projects_ids |
|
| 122 |
@projects = @projects.uniq |
|
| 123 |
end |
|
| 124 | 129 |
end |
| 125 | 130 |
end |
| 126 | 131 |
end |
| plugins/redmine_tags/lib/redmine_tags/patches/projects_helper_patch.rb | ||
|---|---|---|
| 104 | 104 |
end |
| 105 | 105 |
end |
| 106 | 106 |
|
| 107 |
s |
|
| 107 |
s.html_safe
|
|
| 108 | 108 |
end |
| 109 | 109 |
|
| 110 | 110 |
|
| ... | ... | |
| 239 | 239 |
|
| 240 | 240 |
end |
| 241 | 241 |
|
| 242 |
s |
|
| 242 |
s.html_safe
|
|
| 243 | 243 |
|
| 244 | 244 |
end |
| 245 | 245 |
|
| 246 |
|
|
| 247 |
|
|
| 248 | 246 |
private |
| 249 | 247 |
|
| 250 | 248 |
# copied from search_helper. This one doesn't escape html or limit the text length |
| ... | ... | |
| 262 | 260 |
result << content_tag('span', words, :class => "highlight token-#{t}")
|
| 263 | 261 |
end |
| 264 | 262 |
end |
| 265 |
result |
|
| 263 |
result.html_safe
|
|
| 266 | 264 |
end |
| 267 | 265 |
|
| 268 | 266 |
end |
Also available in: Unified diff