RE: How to get a string from Proc.new ยป init.rb
1 |
require 'redmine' |
---|---|
2 |
|
3 |
RAILS_DEFAULT_LOGGER.info 'Menu Link plugin 0.0.1 for Redmine' |
4 |
|
5 |
Redmine::Plugin.register :menu_link do |
6 |
name 'Menu Link Plugin' |
7 |
author 'Tide' |
8 |
description 'A plugin which adds a link to the top menu of Redmine.' |
9 |
version '0.0.1' |
10 |
|
11 |
settings :default => { |
12 |
'link_item_text' => 'http://www.redmine.org', |
13 |
'link_item_name' => 'Example Link', |
14 |
'new_window' => '0' |
15 |
|
16 |
}, :partial => 'settings/menulink_settings' |
17 |
end
|
18 |
|
19 |
if Setting.plugin_menu_link['new_window'] == "0" |
20 |
Redmine::Plugin.find('menu_link').menu(:top_menu, |
21 |
:link, |
22 |
"http://www.google.com", |
23 |
:caption => Proc.new { Setting.plugin_menu_link['link_item_name'] }) |
24 |
else
|
25 |
Redmine::Plugin.find('menu_link').menu(:top_menu, |
26 |
:link, |
27 |
"http://www.google.com", |
28 |
:caption => Proc.new { Setting.plugin_menu_link['link_item_name'] }, |
29 |
:html => { :target => '_blank' }) |
30 |
end
|