Module: CalendarsHelper
- Defined in:
- app/helpers/calendars_helper.rb
Instance Method Summary collapse
- #link_to_month(link_name, year, month, options = {}) ⇒ Object
- #link_to_next_month(year, month, options = {}) ⇒ Object
- #link_to_previous_month(year, month, options = {}) ⇒ Object
Instance Method Details
#link_to_month(link_name, year, month, options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'app/helpers/calendars_helper.rb', line 34 def link_to_month(link_name, year, month, ={}) project_id = [:project].present? ? [:project].to_param : nil link_target = calendar_path(:year => year, :month => month, :project_id => project_id) link_to_remote(link_name, {:update => "content", :url => link_target, :method => :put}, {:href => link_target}) end |
#link_to_next_month(year, month, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/calendars_helper.rb', line 18 def link_to_next_month(year, month, ={}) target_year, target_month = if month == 12 [year + 1, 1] else [year, month + 1] end name = if target_month == 1 "#{month_name(target_month)} #{target_year}" else "#{month_name(target_month)}" end link_to_month((name + ' »'), target_year, target_month, ) end |
#link_to_previous_month(year, month, options = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/calendars_helper.rb', line 2 def link_to_previous_month(year, month, ={}) target_year, target_month = if month == 1 [year - 1, 12] else [year, month - 1] end name = if target_month == 12 "#{month_name(target_month)} #{target_year}" else "#{month_name(target_month)}" end link_to_month(('« ' + name), target_year, target_month, ) end |