Revision 780:31b3aa308568 vendor
| vendor/plugins/redmine_tags/app/views/auto_completes/_search_tag_list.html.erb | ||
|---|---|---|
| 1 |
<ul> |
|
| 2 |
<% @tags.each do |tag| -%> |
|
| 3 |
<%= content_tag 'li', h('%s (%d)' % [tag.name, tag.count]), :name => tag.name %>
|
|
| 4 |
<% end -%> |
|
| 5 |
</ul> |
|
| vendor/plugins/redmine_tags/app/views/auto_completes/_tag_list.html.erb | ||
|---|---|---|
| 2 | 2 |
<% @tags.each do |tag| -%> |
| 3 | 3 |
<%= content_tag 'li', h('%s (%d)' % [tag.name, tag.count]), :name => tag.name %>
|
| 4 | 4 |
<% end -%> |
| 5 |
<%= content_tag 'li', l(:auto_complete_new_tag) % @name, :name => @name %> |
|
| 5 |
<%= content_tag 'li', l(:auto_complete_new_tag) % @name, :name => @name %>
|
|
| 6 | 6 |
</ul> |
| vendor/plugins/redmine_tags/app/views/projects/_filter_search_tags.html.erb | ||
|---|---|---|
| 1 |
<p class='tag'> |
|
| 2 |
<% fields_for @project, :builder => TabularFormBuilder do |f| -%> |
|
| 3 |
<div> |
|
| 4 |
<p id="project_tags"> |
|
| 5 |
<%= f.text_field :tag_list, :label => :tags, :size => 60, :class => 'hol' %> |
|
| 6 |
</p> |
|
| 7 |
<div id="project_tag_candidates" class="autocomplete"></div> |
|
| 8 |
<%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %> |
|
| 9 |
|
|
| 10 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_search_tags', :project_id => Project.first.id)}')" %>
|
|
| 11 |
</div> |
|
| 12 |
<% end -%> |
|
| 13 |
</p> |
|
| vendor/plugins/redmine_tags/app/views/projects/_my_projects.rhtml | ||
|---|---|---|
| 1 |
<fieldset id="filters" class="collapsible"> |
|
| 2 |
<legend onclick="toggleFieldset(this);"><%= l(:label_my_projects) %></legend> |
|
| 1 |
<% if @myproj_status=="true" %> |
|
| 2 |
<fieldset id="my_projects_fieldset" class="collapsible"> |
|
| 3 |
<legend onclick="toggleFieldsetWithState(this);"><%= l(:label_my_projects) %></legend> |
|
| 4 |
<% else %> |
|
| 5 |
<fieldset id="my_projects_fieldset" class="collapsible collapsed"> |
|
| 6 |
<legend onclick="toggleFieldsetWithState(this);"><%= l(:label_my_projects) %></legend> |
|
| 7 |
<div style="display: none;"> |
|
| 8 |
<% end%> |
|
| 3 | 9 |
<% if @user_projects %> |
| 4 | 10 |
<div> |
| 5 | 11 |
<%= render_my_project_hierarchy(@user_projects)%> |
| vendor/plugins/redmine_tags/app/views/projects/_tags_form.html.erb | ||
|---|---|---|
| 3 | 3 |
<p id="project_tags"><%= f.text_field :tag_list, :label => :tags, :size => 60, :class => 'hol' %></p> |
| 4 | 4 |
<div id="project_tag_candidates" class="autocomplete"></div> |
| 5 | 5 |
<%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %> |
| 6 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags', :project_id => project)}')" %>
|
|
| 6 |
<%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags', :project_id => project)}', false)" %>
|
|
| 7 | 7 |
</div> |
| 8 | 8 |
<% end -%> |
| vendor/plugins/redmine_tags/app/views/projects/index.rhtml | ||
|---|---|---|
| 1 | 1 |
<% content_for :header_tags do %> |
| 2 | 2 |
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
| 3 | 3 |
<% end %> |
| 4 |
<%= javascript_include_tag 'projects_index', :plugin => 'redmine_tags' %> |
|
| 5 |
|
|
| 4 | 6 |
|
| 5 | 7 |
<div class="contextual"> |
| 6 | 8 |
<%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }%>
|
| ... | ... | |
| 14 | 16 |
<%= render :partial => 'my_projects' %> |
| 15 | 17 |
<% end %> |
| 16 | 18 |
|
| 19 |
<div style="clear:both;"></div> |
|
| 20 |
<% form_remote_tag(:controller => :projects, :action => :index, :method => :get, :id => :project_filtering) do %> |
|
| 17 | 21 |
|
| 18 |
<div style="clear:both;"></div> |
|
| 19 |
<% form_tag(:controller => :projects, :action => :index, :method => :get, :id => :project_filtering) do %> |
|
| 20 |
<fieldset id="filters" class="collapsible"> |
|
| 21 |
<legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> |
|
| 22 |
<% if @filter_status=="true" %> |
|
| 23 |
<fieldset id="filters_fieldset" class="collapsible"> |
|
| 24 |
<legend onclick="toggleFieldsetWithState(this);"><%= l(:label_filter_plural) %></legend> |
|
| 25 |
<% else %> |
|
| 26 |
<fieldset id="filters_fieldset" class="collapsible collapsed"> |
|
| 27 |
<legend onclick="toggleFieldsetWithState(this);"><%= l(:label_filter_plural) %></legend> |
|
| 28 |
<div style="display: none;"> |
|
| 29 |
<% end %> |
|
| 22 | 30 |
<div> |
| 23 | 31 |
<p class='q'> |
| 24 | 32 |
<%= label_tag 'q', l('project_filtering_q_label') %>
|
| ... | ... | |
| 26 | 34 |
</p> |
| 27 | 35 |
|
| 28 | 36 |
<div id='filter_tags'> |
| 29 |
<%= render :partial => 'filter_tags' %> |
|
| 37 |
<%= render :partial => 'filter_search_tags' %>
|
|
| 30 | 38 |
</div> |
| 31 | 39 |
|
| 32 | 40 |
<p class='buttons'><%= submit_tag( l('button_filter'), :id => 'filter_button') -%></p>
|
| vendor/plugins/redmine_tags/assets/javascripts/projects_index.js | ||
|---|---|---|
| 1 |
Event.observe(window, 'load', function() {
|
|
| 2 |
|
|
| 3 |
}); |
|
| 4 |
|
|
| 5 |
|
|
| 6 |
function toggleFieldsetWithState(this_field){
|
|
| 7 |
id = Element.up(this_field, 'fieldset').id; |
|
| 8 |
// is the fieldset collapsed? |
|
| 9 |
status = $(id).hasClassName("collapsed");
|
|
| 10 |
change_session(id, status); |
|
| 11 |
|
|
| 12 |
toggleFieldset(this_field); |
|
| 13 |
}; |
|
| 14 |
|
|
| 15 |
function change_session(id, nstatus) {
|
|
| 16 |
var url = "projects/set_fieldset_status"; |
|
| 17 |
var request = new Ajax.Request(url, {
|
|
| 18 |
method: 'post', |
|
| 19 |
parameters: {field_id: id, status: nstatus},
|
|
| 20 |
asynchronous: true |
|
| 21 |
}); |
|
| 22 |
} |
|
| vendor/plugins/redmine_tags/assets/javascripts/tags_input.js | ||
|---|---|---|
| 93 | 93 |
new Redmine.TagsInput('issue_tag_list').autocomplete('issue_tag_candidates', url);
|
| 94 | 94 |
} |
| 95 | 95 |
|
| 96 |
|
|
| 97 | 96 |
function observeProjectTagsField(url) {
|
| 98 |
new Redmine.TagsInput('project_tag_list').autocomplete('project_tag_candidates', url);
|
|
| 97 |
new Redmine.TagsInput('project_tag_list').autocomplete('project_tag_candidates', url);
|
|
| 99 | 98 |
} |
| vendor/plugins/redmine_tags/config/routes.rb | ||
|---|---|---|
| 1 |
ActionController::Routing::Routes.draw do |map| |
|
| 2 |
map.connect 'projects/set_fieldset_status', :controller => 'projects', :action => 'set_fieldset_status', :conditions => {:method => :post}
|
|
| 3 |
end |
|
| vendor/plugins/redmine_tags/lib/redmine_tags/patches/auto_completes_controller_patch.rb | ||
|---|---|---|
| 38 | 38 |
@tags = Project.available_tags :name_like => @name |
| 39 | 39 |
render :layout => false, :partial => 'tag_list' |
| 40 | 40 |
end |
| 41 |
|
|
| 42 |
def project_search_tags |
|
| 43 |
@name = params[:q].to_s |
|
| 44 |
@tags = Project.available_tags :name_like => @name |
|
| 45 |
render :layout => false, :partial => 'search_tag_list' |
|
| 46 |
end |
|
| 41 | 47 |
end |
| 42 | 48 |
end |
| 43 | 49 |
end |
| vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb | ||
|---|---|---|
| 2 | 2 |
|
| 3 | 3 |
module RedmineTags |
| 4 | 4 |
module Patches |
| 5 |
module ProjectsControllerPatch |
|
| 5 |
module ProjectsControllerPatch
|
|
| 6 | 6 |
def self.included(base) |
| 7 | 7 |
base.send(:include, InstanceMethods) |
| 8 | 8 |
base.class_eval do |
| 9 | 9 |
unloadable |
| 10 |
skip_before_filter :authorize, :only => [:set_fieldset_status] |
|
| 11 |
skip_before_filter :find_project, :only => [:set_fieldset_status] |
|
| 10 | 12 |
before_filter :add_tags_to_project, :only => [:save, :update] |
| 11 |
before_filter :filter_projects, :only => :index |
|
| 13 |
# before_filter :filter_projects, :only => :index |
|
| 14 |
|
|
| 15 |
alias :index filtered_index |
|
| 12 | 16 |
end |
| 13 | 17 |
end |
| 14 | 18 |
|
| 15 | 19 |
module InstanceMethods |
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 16 | 23 |
def add_tags_to_project |
| 17 | 24 |
|
| 18 | 25 |
if params && params[:project] && !params[:project][:tag_list].nil? |
| ... | ... | |
| 25 | 32 |
end |
| 26 | 33 |
end |
| 27 | 34 |
|
| 28 |
# # luisf - TO BE REMOVED? |
|
| 29 |
# def calculate_project_filtering_settings |
|
| 30 |
# @project_filtering_settings = Setting[:plugin_redmine_project_filtering] |
|
| 31 |
# end |
|
| 35 |
def paginate_projects |
|
| 36 |
sort_init 'name' |
|
| 37 |
sort_update %w(name lft created_on updated_on) |
|
| 38 |
@limit = per_page_option |
|
| 39 |
@project_count = Project.visible_roots.find(@projects).count |
|
| 40 |
@project_pages = ActionController::Pagination::Paginator.new self, @project_count, @limit, params['page'] |
|
| 41 |
@offset ||= @project_pages.current.offset |
|
| 42 |
end |
|
| 32 | 43 |
|
| 33 |
def filter_projects |
|
| 44 |
def set_fieldset_status |
|
| 45 |
|
|
| 46 |
# luisf. test for missing parameters……… |
|
| 47 |
field = params[:field_id] |
|
| 48 |
status = params[:status] |
|
| 49 |
|
|
| 50 |
session[(field + "_status").to_sym] = status |
|
| 51 |
logger.error { "SET - DEBUG-ME #{session.inspect}" }
|
|
| 52 |
|
|
| 53 |
render :nothing => true |
|
| 54 |
end |
|
| 55 |
|
|
| 56 |
# gets the status of the collabsible fieldsets |
|
| 57 |
def get_fieldset_statuses |
|
| 58 |
if session[:my_projects_fieldset_status].nil? |
|
| 59 |
@myproj_status = true |
|
| 60 |
else |
|
| 61 |
@myproj_status = session[:my_projects_fieldset_status] |
|
| 62 |
end |
|
| 63 |
|
|
| 64 |
if session[:filters_fieldset_status].nil? |
|
| 65 |
@filter_status = false |
|
| 66 |
else |
|
| 67 |
@filter_status = session[:filters_fieldset_status] |
|
| 68 |
end |
|
| 69 |
end |
|
| 70 |
|
|
| 71 |
# Lists visible projects. Paginator is for top-level projects only |
|
| 72 |
# (subprojects belong to them) |
|
| 73 |
def filtered_index |
|
| 34 | 74 |
@project = Project.new |
| 75 |
filter_projects |
|
| 76 |
get_fieldset_statuses |
|
| 35 | 77 |
|
| 36 | 78 |
respond_to do |format| |
| 37 |
format.any(:html, :xml) {
|
|
| 38 |
calculate_filtered_projects |
|
| 79 |
format.html {
|
|
| 80 |
paginate_projects |
|
| 81 |
@projects = Project.visible_roots.find(@projects, :offset => @offset, :limit => @limit, :order => sort_clause) |
|
| 82 |
|
|
| 83 |
if User.current.logged? |
|
| 84 |
# seems sort_by gives us case-sensitive ordering, which we don't want |
|
| 85 |
# @user_projects = User.current.projects.sort_by(&:name) |
|
| 86 |
@user_projects = User.current.projects.all(:order => :name) |
|
| 87 |
end |
|
| 88 |
|
|
| 89 |
render :template => 'projects/index.rhtml', :layout => !request.xhr? |
|
| 90 |
} |
|
| 91 |
format.api {
|
|
| 92 |
@offset, @limit = api_offset_and_limit |
|
| 93 |
@project_count = Project.visible.count |
|
| 94 |
@projects = Project.visible.find(@projects, :offset => @offset, :limit => @limit, :order => 'lft') |
|
| 95 |
} |
|
| 96 |
format.atom {
|
|
| 97 |
projects = Project.visible.find(:all, :order => 'created_on DESC', :limit => Setting.feeds_limit.to_i) |
|
| 98 |
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
|
|
| 39 | 99 |
} |
| 40 | 100 |
format.js {
|
| 41 |
calculate_filtered_projects |
|
| 101 |
paginate_projects |
|
| 102 |
@projects = Project.visible_roots.find(@projects, :offset => @offset, :limit => @limit, :order => sort_clause) |
|
| 42 | 103 |
render :update do |page| |
| 43 | 104 |
page.replace_html 'projects', :partial => 'filtered_projects' |
| 44 | 105 |
end |
| 45 | 106 |
} |
| 46 |
format.atom {
|
|
| 47 |
projects = Project.visible.find(:all, :order => 'created_on DESC', |
|
| 48 |
:limit => Setting.feeds_limit.to_i) |
|
| 49 |
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
|
|
| 50 |
} |
|
| 51 | 107 |
end |
| 52 | 108 |
end |
| 53 | 109 |
|
| 54 | 110 |
private |
| 55 | 111 |
|
| 56 |
def calculate_filtered_projects
|
|
| 112 |
def filter_projects
|
|
| 57 | 113 |
@question = (params[:q] || "").strip |
| 58 | 114 |
|
| 59 | 115 |
if params.has_key?(:project) |
| ... | ... | |
| 64 | 120 |
|
| 65 | 121 |
@projects = Project.visible |
| 66 | 122 |
|
| 67 |
@featured_projects = @projects.featured if Project.respond_to? :featured |
|
| 68 |
|
|
| 69 | 123 |
# luisf |
| 70 | 124 |
@projects = @projects.search_by_question(@question) unless @question == "" |
| 71 | 125 |
@tagged_projects_ids = Project.tagged_with(@tag_list).collect{ |project| Project.find(project.id) } unless @tag_list.empty?
|
| 72 | 126 |
|
| 73 |
debugger |
|
| 74 |
|
|
| 75 | 127 |
# intersection of both prject groups |
| 76 |
@projects = @projects && @tagged_projects_ids unless @tag_list.empty? |
|
| 77 |
|
|
| 78 |
debugger |
|
| 79 |
@filtered_projects = @projects |
|
| 128 |
@projects = @projects & @tagged_projects_ids unless @tag_list.empty? |
|
| 80 | 129 |
end |
| 81 | 130 |
end |
| 82 | 131 |
end |
| vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_helper_patch.rb | ||
|---|---|---|
| 18 | 18 |
# description, manager(s), creation date, last activity date, |
| 19 | 19 |
# general activity level, whether there is anything actually hosted |
| 20 | 20 |
# here for the project, etc. |
| 21 |
def render_project_table_with_filtering(projects, question) |
|
| 22 |
debugger |
|
| 23 |
|
|
| 21 |
def render_project_table_with_filtering(projects, question) |
|
| 24 | 22 |
custom_fields = "" |
| 25 | 23 |
s = "" |
| 26 | 24 |
if projects.any? |
Also available in: Unified diff