diff --git a/init.rb b/init.rb index 7c73fd9d6f..9b5005fd19 100644 --- a/init.rb +++ b/init.rb @@ -5,6 +5,7 @@ require 'view_projects_show_sidebar_bottom_hook' $LOAD_PATH << File.expand_path("../lib/redmine_widgets", __FILE__) require 'simple_table' require 'entry_table' +require 'cost_types' Redmine::Plugin.register :redmine_reporting do name 'Reporting Plugin' diff --git a/lib/redmine_widgets/cost_types.rb b/lib/redmine_widgets/cost_types.rb new file mode 100644 index 0000000000..c25f3b9b62 --- /dev/null +++ b/lib/redmine_widgets/cost_types.rb @@ -0,0 +1,22 @@ +class Widget::CostTypes < Widget::Base + def render_with_options(options, &block) + @cost_types = options.delete(:cost_types) + @selected_type_id = options.delete(:selected_type_id) + + super(options, &block) + end + + def render + write contents + end + + def contents + content_tag :div do + available_cost_type_tabs(@subject).map do |id, label| + type_selection = radio_button_tag("unit", id, id == @selected_type_id) + type_selection += label_tag "unit_#{id}", h(label) + type_selection + end.join("
") + end + end +end