Module: TimesheetHelper

Defined in:
app/helpers/timesheet_helper.rb

Instance Method Summary collapse

Instance Method Details

#displayed_time_entries_for_issue(time_entries) ⇒ Object



44
45
46
# File 'app/helpers/timesheet_helper.rb', line 44

def displayed_time_entries_for_issue(time_entries)
  time_entries.collect(&:hours).sum
end


13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/timesheet_helper.rb', line 13

def link_to_csv_export(timesheet)
  link_to('CSV',
          {
            :controller => 'timesheet',
            :action => 'report',
            :format => 'csv',
            :timesheet => timesheet.to_param
          },
          :method => 'post',
          :class => 'icon icon-timesheet')
end


6
7
8
9
10
11
# File 'app/helpers/timesheet_helper.rb', line 6

def permalink_to_timesheet(timesheet)
  link_to(l(:timesheet_permalink),
          :controller => 'timesheet',
          :action => 'report',
          :timesheet => timesheet.to_param)
end

#showing_users(users) ⇒ Object



2
3
4
# File 'app/helpers/timesheet_helper.rb', line 2

def showing_users(users)
  l(:timesheet_showing_users) + users.collect(&:name).join(', ')
end

#toggle_issue_arrow(issue_id, image, js, hide = false) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'app/helpers/timesheet_helper.rb', line 32

def toggle_issue_arrow(issue_id, image, js, hide=false)
  style = "display:none;" if hide
  style ||= ''

  (:span,
              link_to_function(image_tag(image, :plugin => "timesheet_plugin"), js),
              :class => "toggle-" + issue_id.to_s,
              :style => style
              )
  
end

#toggle_issue_arrows(issue_id) ⇒ Object



25
26
27
28
29
30
# File 'app/helpers/timesheet_helper.rb', line 25

def toggle_issue_arrows(issue_id)
  js = "toggleTimeEntries('#{issue_id}'); return false;"
  
  return toggle_issue_arrow(issue_id, 'toggle-arrow-closed.gif', js, false) +
    toggle_issue_arrow(issue_id, 'toggle-arrow-open.gif', js, true)
end