# HG changeset patch
# User luisf
# Date 1320772372 0
# Node ID 3f28aebc5fc1a5b9d4b99898465db360d8f706fe
# Parent 287c27cb8bd29abb9ef53dbe92b4b463334d687e
started building the project's tag filtering interface.
diff -r 287c27cb8bd2 -r 3f28aebc5fc1 vendor/plugins/redmine_tags/app/views/projects/_filter_tags.rhtml
--- a/vendor/plugins/redmine_tags/app/views/projects/_filter_tags.rhtml Tue Nov 08 15:05:22 2011 +0000
+++ b/vendor/plugins/redmine_tags/app/views/projects/_filter_tags.rhtml Tue Nov 08 17:12:52 2011 +0000
@@ -1,12 +1,12 @@
- <%= label_tag 'Tag' %>
- <%= select_tag("tag[#{tag.id}]",
- options_from_collection_for_select(
- [nil] + Project.available_tags,
- 'to_s',
- 'to_s',
- @custom_fields[custom_field.id.to_s]
- )
- )
- %>
+ <% fields_for @project, :builder => TabularFormBuilder do |f| -%>
+
+
+ <%= f.text_field :tag_list, :label => :tags, :size => 60, :class => 'hol' %>
+
+
+ <%= javascript_include_tag 'tags_input', :plugin => 'redmine_tags' %>
+ <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags')}')" %>
+
+ <% end -%>
diff -r 287c27cb8bd2 -r 3f28aebc5fc1 vendor/plugins/redmine_tags/app/views/projects/index.rhtml
--- a/vendor/plugins/redmine_tags/app/views/projects/index.rhtml Tue Nov 08 15:05:22 2011 +0000
+++ b/vendor/plugins/redmine_tags/app/views/projects/index.rhtml Tue Nov 08 17:12:52 2011 +0000
@@ -18,6 +18,11 @@
<%= render :partial => 'custom_field', :collection => @custom_fields_used_for_project_filtering %>
<%= submit_tag( l(:button_send), :id => 'filter_button') -%>
+
+
+ <%= render :partial => 'filter_tags' %>
+
+
<% end %>
diff -r 287c27cb8bd2 -r 3f28aebc5fc1 vendor/plugins/redmine_tags/lib/redmine_tags/hooks/model_project_hook.rb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_tags/lib/redmine_tags/hooks/model_project_hook.rb Tue Nov 08 17:12:52 2011 +0000
@@ -0,0 +1,58 @@
+# This file is a part of redmine_tags
+# redMine plugin, that adds tagging support.
+#
+# Copyright (c) 2010 Eric Davis
+# Copyright (c) 2010 Aleksey V Zapparov AKA ixti
+#
+# redmine_tags is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# redmine_tags is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with redmine_tags. If not, see .
+
+module RedmineTags
+ module Hooks
+ class ModelProjectHook < Redmine::Hook::ViewListener
+ def controller_project_before_save(context={})
+ debugger
+ save_tags_to_project(context, true)
+ end
+
+ # Issue has an after_save method that calls reload (update_nested_set_attributes)
+ # This makes it impossible for a new record to get a tag_list, it's
+ # cleared on reload. So instead, hook in after the Issue#save to update
+ # this issue's tag_list and call #save ourselves.
+ def controller_projects_before_save(context={})
+ debugger
+ save_tags_to_project(context, false)
+ context[:project].save
+ end
+
+ def save_tags_to_project(context, create_journal)
+ params = context[:params]
+ debugger
+ logger.error { "WORKING" }
+
+ # if params && params[:issue] && !params[:issue][:tag_list].nil?
+ # old_tags = context[:issue].tag_list.to_s
+ # context[:issue].tag_list = params[:issue][:tag_list]
+ # new_tags = context[:issue].tag_list.to_s
+ #
+ # if create_journal and not (old_tags == new_tags || context[:issue].current_journal.blank?)
+ # context[:issue].current_journal.details << JournalDetail.new(:property => 'attr',
+ # :prop_key => 'tag_list',
+ # :old_value => old_tags,
+ # :value => new_tags)
+ # end
+ # end
+ end
+ end
+ end
+end
diff -r 287c27cb8bd2 -r 3f28aebc5fc1 vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb Tue Nov 08 15:05:22 2011 +0000
+++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb Tue Nov 08 17:12:52 2011 +0000
@@ -8,7 +8,7 @@
base.class_eval do
unloadable
before_filter :add_tags_to_project, :only => [:save, :update]
- before_filter :filter_projects, :only => :index
+ before_filter :filter_projects, :only => :index
end
end
@@ -30,9 +30,10 @@
end
def filter_projects
-
- logger.error { "FILTRA PA!" }
-
+ logger.error { "before_filter: filter_projects" }
+
+ @project = Project.new
+
respond_to do |format|
format.any(:html, :xml) {
calculate_filtered_projects