To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / vendor / plugins / redmine_tags / lib / redmine_tags / patches / projects_controller_patch.rb @ 731:3f87a3b61d9c
History | View | Annotate | Download (789 Bytes)
| 1 | 730:4a9bb3b8d5cd | luis | require_dependency 'projects_controller'
|
|---|---|---|---|
| 2 | |||
| 3 | module RedmineTags |
||
| 4 | module Patches |
||
| 5 | module ProjectsControllerPatch |
||
| 6 | def self.included(base) |
||
| 7 | base.send(:include, InstanceMethods) |
||
| 8 | base.class_eval do
|
||
| 9 | unloadable |
||
| 10 | before_filter :add_tags_to_project, :only => [:save, :update] |
||
| 11 | end
|
||
| 12 | end
|
||
| 13 | |||
| 14 | module InstanceMethods |
||
| 15 | 731:3f87a3b61d9c | luis | def add_tags_to_project |
| 16 | if params && params[:project] && !params[:project][:tag_list].nil? |
||
| 17 | old_tags = @project.tag_list.to_s
|
||
| 18 | new_tags = params[:project][:tag_list].to_s |
||
| 19 | |||
| 20 | unless (old_tags == new_tags)
|
||
| 21 | @project.tag_list = new_tags
|
||
| 22 | end
|
||
| 23 | end
|
||
| 24 | 730:4a9bb3b8d5cd | luis | end
|
| 25 | end
|
||
| 26 | end
|
||
| 27 | end
|
||
| 28 | end |