Nuevo plugin Additionals 2.0.20
This commit is contained in:
parent
a2a901b71b
commit
93e1e28683
354 changed files with 40514 additions and 0 deletions
65
plugins/additionals/lib/additionals/patches/wiki_controller_patch.rb
Executable file
65
plugins/additionals/lib/additionals/patches/wiki_controller_patch.rb
Executable file
|
@ -0,0 +1,65 @@
|
|||
require_dependency 'wiki_controller'
|
||||
|
||||
module Additionals
|
||||
module Patches
|
||||
module WikiControllerPatch
|
||||
def self.included(base)
|
||||
base.send(:include, InstanceMethods)
|
||||
base.class_eval do
|
||||
alias_method :respond_to_without_additionals, :respond_to
|
||||
alias_method :respond_to, :respond_to_with_additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
def respond_to_with_additionals(&block)
|
||||
if @project && @content
|
||||
if @_action_name == 'show'
|
||||
additionals_include_header
|
||||
additionals_include_footer
|
||||
end
|
||||
end
|
||||
respond_to_without_additionals(&block)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def additionals_include_header
|
||||
wiki_header = '' + Additionals.settings[:global_wiki_header].to_s
|
||||
return if wiki_header.empty?
|
||||
|
||||
if Object.const_defined?('WikiExtensionsUtil') && WikiExtensionsUtil.is_enabled?(@project)
|
||||
header = @wiki.find_page('Header')
|
||||
return if header
|
||||
end
|
||||
|
||||
text = "\n"
|
||||
text << '<div id="wiki_extentions_header">'
|
||||
text << "\n\n"
|
||||
text << wiki_header
|
||||
text << "\n\n</div>"
|
||||
text << "\n\n"
|
||||
text << @content.text
|
||||
@content.text = text
|
||||
end
|
||||
|
||||
def additionals_include_footer
|
||||
wiki_footer = '' + Additionals.settings[:global_wiki_footer].to_s
|
||||
return if wiki_footer.empty?
|
||||
|
||||
if Object.const_defined?('WikiExtensionsUtil') && WikiExtensionsUtil.is_enabled?(@project)
|
||||
footer = @wiki.find_page('Footer')
|
||||
return if footer
|
||||
end
|
||||
|
||||
text = @content.text
|
||||
text << "\n\n"
|
||||
text << '<div id="wiki_extentions_footer">'
|
||||
text << "\n\n"
|
||||
text << wiki_footer
|
||||
text << "\n\n</div>"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue