Mercurial > hg > soundsoftware-site
changeset 729:291c4d7dc0b6 feature_14
Extending the Project model in order to save the tags in the before_save callback.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 27 Oct 2011 19:17:17 +0100 |
parents | cc4d3d842171 |
children | 4a9bb3b8d5cd |
files | vendor/plugins/redmine_tags/lib/redmine_tags/hooks/views_projects_hook.rb vendor/plugins/redmine_tags/lib/redmine_tags/patches/auto_completes_controller_patch.rb vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb |
diffstat | 3 files changed, 31 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/hooks/views_projects_hook.rb Thu Oct 27 14:19:43 2011 +0100 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/hooks/views_projects_hook.rb Thu Oct 27 19:17:17 2011 +0100 @@ -1,8 +1,8 @@ module RedmineTags module Hooks class ViewsProjectsHook < Redmine::Hook::ViewListener + render_on :view_projects_form, :partial => 'projects/tags_form' render_on :view_projects_show_left, :partial => 'projects/tags' -# render_on :view_issues_form_details_bottom, :partial => 'issues/tags_form' # render_on :view_issues_sidebar_planning_bottom, :partial => 'issues/tags_sidebar' end end
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/auto_completes_controller_patch.rb Thu Oct 27 14:19:43 2011 +0100 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/auto_completes_controller_patch.rb Thu Oct 27 19:17:17 2011 +0100 @@ -32,6 +32,12 @@ @tags = Issue.available_tags :project_id => @project, :name_like => @name render :layout => false, :partial => 'tag_list' end + + def project_tags + @name = params[:q].to_s + @tags = Project.available_tags :project_id => @project, :name_like => @name + render :layout => false, :partial => 'tag_list' + end end end end
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb Thu Oct 27 14:19:43 2011 +0100 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb Thu Oct 27 19:17:17 2011 +0100 @@ -5,15 +5,37 @@ module RedmineTags module Patches module ProjectPatch - def self.included(base) + def self.included(base) # :nodoc: base.extend(ClassMethods) base.class_eval do unloadable acts_as_taggable + alias_method_chain :before_save, :save_tags end end + def before_save_with_save_tags(context={}) + + logger.error { "GONNA SAVE TAG LIST" } + logger.error { @project.name } + + # if params && params[:project] && !params[:project][:tag_list].nil? + # old_tags = context[:project].tag_list.to_s + # context[:project].tag_list = params[:project][:tag_list] + # new_tags = context[:project].tag_list.to_s + # + # unless (old_tags == new_tags || context[:project].current_journal.blank?) + # context[:project].current_journal.details << JournalDetail.new(:property => 'attr', + # :prop_key => 'tag_list', + # :old_value => old_tags, + # :value => new_tags) + # end + # end + end + + + module ClassMethods # Returns available issue tags # === Parameters @@ -34,7 +56,7 @@ end if open_only - visible << ["#{Issue.table_name}.status_id IN " + + visible << ["#{Project.table_name}.status_id IN " + "( SELECT issue_status.id " + " FROM #{IssueStatus.table_name} issue_status " + " WHERE issue_status.is_closed = ? )", false]