Revision 749:3f28aebc5fc1 vendor/plugins/redmine_tags

View differences:

vendor/plugins/redmine_tags/app/views/projects/_filter_tags.rhtml
1 1
<p class='tag'>
2
  <%= label_tag 'Tag' %>
3
  <%= select_tag("tag[#{tag.id}]", 
4
        options_from_collection_for_select(
5
          [nil] + Project.available_tags, 
6
          'to_s', 
7
          'to_s',
8
          @custom_fields[custom_field.id.to_s]
9
        )
10
      )
11
  %>
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
      <%= javascript_tag "observeProjectTagsField('#{url_for(:controller => 'auto_completes', :action => 'project_tags')}')" %>
10
    </div>
11
  <% end -%>
12 12
</p>
vendor/plugins/redmine_tags/app/views/projects/index.rhtml
18 18
      <%= render :partial => 'custom_field', :collection => @custom_fields_used_for_project_filtering %>
19 19
      <p class='buttons'><%= submit_tag( l(:button_send), :id => 'filter_button') -%></p>
20 20
    </div>
21

  
22
    <div id='filter_tags'>
23
      <%= render :partial => 'filter_tags' %>
24
    </div>
25

  
21 26
  </fieldset>
22 27
<% end %>
23 28

  
vendor/plugins/redmine_tags/lib/redmine_tags/hooks/model_project_hook.rb
1
# This file is a part of redmine_tags
2
# redMine plugin, that adds tagging support.
3
#
4
# Copyright (c) 2010 Eric Davis
5
# Copyright (c) 2010 Aleksey V Zapparov AKA ixti
6
#
7
# redmine_tags is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# redmine_tags is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with redmine_tags.  If not, see <http://www.gnu.org/licenses/>.
19

  
20
module RedmineTags
21
  module Hooks
22
    class ModelProjectHook < Redmine::Hook::ViewListener
23
      def controller_project_before_save(context={})
24
        debugger
25
        save_tags_to_project(context, true)
26
      end
27

  
28
      # Issue has an after_save method that calls reload (update_nested_set_attributes)
29
      # This makes it impossible for a new record to get a tag_list, it's
30
      # cleared on reload. So instead, hook in after the Issue#save to update
31
      # this issue's tag_list and call #save ourselves.
32
      def controller_projects_before_save(context={})
33
        debugger
34
        save_tags_to_project(context, false)
35
        context[:project].save
36
      end
37

  
38
      def save_tags_to_project(context, create_journal)
39
        params = context[:params]
40
        debugger
41
        logger.error { "WORKING" }
42

  
43
   #     if params && params[:issue] && !params[:issue][:tag_list].nil?
44
   #       old_tags = context[:issue].tag_list.to_s
45
   #       context[:issue].tag_list = params[:issue][:tag_list]
46
   #       new_tags = context[:issue].tag_list.to_s
47
   #
48
   #       if create_journal and not (old_tags == new_tags || context[:issue].current_journal.blank?)
49
   #         context[:issue].current_journal.details << JournalDetail.new(:property => 'attr',
50
   #                                                                      :prop_key => 'tag_list',
51
   #                                                                      :old_value => old_tags,
52
   #                                                                      :value => new_tags)
53
   #       end
54
   #     end
55
      end
56
    end
57
  end
58
end
vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb
8 8
        base.class_eval do          
9 9
          unloadable 
10 10
          before_filter :add_tags_to_project, :only => [:save, :update]
11
          before_filter :filter_projects, :only => :index          
11
          before_filter :filter_projects, :only => :index                
12 12
        end
13 13
      end
14 14

  
......
30 30
          end
31 31

  
32 32
          def filter_projects
33
            
34
            logger.error { "FILTRA PA!" }
35
            
33
            logger.error { "before_filter: filter_projects" }
34

  
35
            @project = Project.new
36
                                  
36 37
            respond_to do |format|
37 38
              format.any(:html, :xml) { 
38 39
                calculate_filtered_projects

Also available in: Unified diff