プロジェクト

全般

プロフィール

« | » 

リビジョン ded315b0

高徹 高橋 徹 さんが7年以上前に追加

modified deprecated alias_method_chain to prepend

差分を表示:

init.rb
require 'redmine'
require 'cgi'
require 'glossary_asset_tag_helper_patch'
require 'glossary_application_helper_patch'
require 'term_link_helper'
require 'csv'
FCSV = CSV
lib/glossary_application_helper_patch.rb
module GlossaryApplicationHelper
def javascript_include_tag(*sources)
out = super(*sources)
if sources.is_a?(Array) and sources[0] == 'jstoolbar/jstoolbar-textile.min'
out += javascript_tag <<-javascript_tag
jsToolBar.prototype.elements.termlink = {
type: 'button',
title: '#{l(:label_tag_termlink)}',
fn: {
wiki: function() { this.encloseSelection("{{term(", ")}}") }
}
}
javascript_tag
out += stylesheet_link_tag 'termlink', :plugin => 'redmine_glossary'
end
out
end
end
ApplicationHelper.prepend GlossaryApplicationHelper
lib/glossary_asset_tag_helper_patch.rb
module ActionView
module Helpers
module AssetTagHelper
def javascript_include_tag_with_glossary(*sources)
out = javascript_include_tag_without_glossary(*sources)
if sources.is_a?(Array) and sources[0] == 'jstoolbar/textile'
out += javascript_tag <<-javascript_tag
jsToolBar.prototype.elements.termlink = {
type: 'button',
title: '#{l(:label_tag_termlink)}',
fn: {
wiki: function() { this.encloseSelection("{{term(", ")}}") }
}
}
javascript_tag
out += stylesheet_link_tag 'termlink', :plugin => 'redmine_glossary'
end
out
end
alias_method_chain :javascript_include_tag, :glossary
end
end
end

他の形式にエクスポート: Unified diff