Project

General

Profile

RE: Writing plugins compatible with both Redmine 1.x and ... » application_helper_patch.rb

Marco Nobler, 2012-11-05 15:38

 
1
require_dependency 'application_helper'
2

    
3
module RedmineTlcit
4
	module Patches
5
		module ApplicationHelperPatch
6
		  def self.included(base) # :nodoc:
7
			base.send(:include, InstanceMethods)
8

    
9
			base.class_eval do
10
			unloadable
11
			end
12
		  end
13

    
14
		  module InstanceMethods
15
			def prompt_to_remote(name, text, param, url, html_options = {})
16
			  html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;"
17
			  link_to name, {}, html_options
18
			end
19
		  end
20
		end
21
	end
22
end
23

    
24
unless ApplicationHelper.included_modules.include? RedmineTlcit::Patches::ApplicationHelperPatch
25
	ApplicationHelper.send(:include, RedmineTlcit::Patches::ApplicationHelperPatch)
26
end 
(2-2/2)