Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

How to use this plugin previous version (1.xx, 1.0.x...)

akiko-pusu edited this page Feb 1, 2012 · 11 revisions

Note

Bannerプラグインは、init.rbに、Redmineバージョン1.2以上、というコードを指定しているため、それより前のバージョンで稼働させようとすると、アプリケーション全体がうまく起動しません。 また、Bannerで仕様している、ヘッダ部分へのメッセージ表示は、Redmine本体に実装されていないViewHook を利用しています。 このため、ヘッダ部分の表示を行っている、app/view/layout/base.rhtml を拡張して利用しています。

Redmineのバージョンが上がるたびに、app/view/layout/base.rhtmlに変更が入れば、プラグインもそれに追従しないといけません。 意外に見落としがちなので、Redmine本体に、ViewHookを増やしてもらえるようにリクエストを出しています。


Workaround / 修正方法

Here is a quick workaround to use this plugin on older version of Redmine, such as 1.0.x, 1.1. / バージョン1.2より前のRedmineで利用する方法は、下記の通りです。

1. Edit redmine_banner/init.rb

Comment out or remove this line.

  • requires_redmine :version_or_higher => '1.2.0'

If not, Redmine will be failed to start.

2. Copy Redmine/app/view/layouts/base.rhtml to Redmine/vendr/redmine_banner/app/view/layouts/base.rhtml

Copy Redmine/app/view/layouts/base.rhtml to Redmine/vendr/redmine_banner/app/view/layouts/base.rhtml. You can overwrite the existing redmine_banner/app/view/layouts/base.rhtml. This template, base.rhtml, should be based on the same version's one for Redmine.

先にあるものを上書きしてしまってかまいません。 利用しているRedmineのバージョンにマッチしたbase.rhtmlを使うのがポイントです。

3. Add a magic spell on redmine_banner/app/view/layout/base.rhtml :)

Add a this line, <%= call_hook :view_layouts_base_after_top_menu %>, just after <div id="top-menu">..</div> block.

トップメニューを描画する部分の下に、 <%= call_hook :view_layouts_base_after_top_menu %> という一行を挿入します。 <div id="top-menu">..</div> というトップメニューブロックの直下です。

Exp. / 下記が具体例です。

<div id="top-menu">
<div id="account">
<%= render_menu :account_menu -%>
</div>
<%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}",:id => 'loggedas') if User.current.logged? %>
<%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
</div>
<%= call_hook :view_layouts_base_after_top_menu %> # This is a magic spell:)

Clone this wiki locally