diff --git a/lib/overhead_timesheet_hook.rb b/lib/overhead_timesheet_hook.rb index 32dc57b..d8bc160 100644 --- a/lib/overhead_timesheet_hook.rb +++ b/lib/overhead_timesheet_hook.rb @@ -22,6 +22,11 @@ class OverheadTimesheetHook < Redmine::Hook::ViewListener # Added a new field for filtering based on "billable?" def plugin_timesheet_views_timesheet_form(context={}) - context[:controller].send(:render_to_string, :partial => 'timesheet/overhead_form', :layout => false) + context[:controller].send(:render_to_string, + :partial => 'timesheet/overhead_form', + :layout => false, + :locals => { + :list_size => context[:list_size] || 5 + }) end end diff --git a/spec/lib/overhead_timesheet_hook_spec.rb b/spec/lib/overhead_timesheet_hook_spec.rb index fa6b6f2..af59514 100644 --- a/spec/lib/overhead_timesheet_hook_spec.rb +++ b/spec/lib/overhead_timesheet_hook_spec.rb @@ -58,6 +58,10 @@ describe OverheadTimesheetHook, "#plugin_timesheet_views_timesheet_form", :type response.should have_tag('label[class=?][for=?]', 'select_all', 'timesheet[billable][]') end - it 'should add a multple select field called "billable"' + it 'should add a multple select field called "billable"' do + response = call_hook(:plugin_timesheet_views_timesheet_form, {}) + response.should have_tag('select[name=?][multiple=multiple]', 'timesheet[billable][]') + end + it 'should pre-select the values from the submission' end