Class: Achoo::HourRegistrationFormRanged

Inherits:
HourRegistrationForm show all
Defined in:
lib/achoo/hour_registration_form_ranged.rb

Instance Method Summary collapse

Methods inherited from HourRegistrationForm

#all_projects, #billing=, #billing_options, #hours=, #phase, #phase=, #phases_for_selected_project, #print_values, #project, #project=, #recent_projects, #remark=, #submit, #workperiod=, #worktime_periods

Constructor Details

#initialize(agent) ⇒ HourRegistrationFormRanged

Returns a new instance of HourRegistrationFormRanged.



5
6
7
8
9
10
# File 'lib/achoo/hour_registration_form_ranged.rb', line 5

def initialize(agent)
  super
  
  @page = @agent.get(atk_submit_to_url(@page.link_with(:text => 'Select range').href))
  @form = @page.form('entryform')
end

Instance Method Details

#dateObject



20
21
22
23
24
25
# File 'lib/achoo/hour_registration_form_ranged.rb', line 20

def date
  start = super
  finish = Date.new(to_year_field.value.to_i, to_month_field.value.to_i, 
                    to_day_field.value.to_i)
  [start, finish]
end

#date=(date_range) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/achoo/hour_registration_form_ranged.rb', line 12

def date=(date_range)
  super(date_range[0])

  to_day_field.value   = date_range[1].strftime('%d')
  to_month_field.value = date_range[1].strftime('%m')
  to_year_field.value  = date_range[1].year
end