OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/lib/backlogs/patches/my_controller_patch.rb

28 lines
773 B

require_dependency 'my_controller'
module Backlogs::Patches::MyControllerPatch
def self.included(base)
base.class_eval do
unloadable
include InstanceMethods
after_filter :save_backlogs_preferences, :only => [:account]
end
end
module InstanceMethods
def save_backlogs_preferences
if request.post? && flash[:notice] == l(:notice_account_updated)
color = (params[:backlogs] ? params[:backlogs][:task_color] : '').to_s
if color == '' || color.match(/^#[A-Fa-f0-9]{6}$/)
User.current.backlogs_preference(:task_color, color)
else
flash[:notice] = "Invalid task color code #{color}"
end
end
end
end
end
MyController.send(:include, Backlogs::Patches::MyControllerPatch)