Sha256: bddf2ae19c525f3d920c007c77e7da8bce34b663489a03b0490ee85cecb9b0ca
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
class BootstrapMonthCalendar < SimpleCalendar::MonthCalendar def initialize_with_bootstrap(view_context, opts={}) opts.reverse_merge!( table: { class: 'table calendar' }, header: { class: 'pagination' }, previous_link: bootstrap_previous_link, next_link: bootstrap_next_link, ) initialize_without_bootstrap(view_context, opts) end alias_method_chain :initialize, :bootstrap def default_title_with_bootstrap ->(start_date) { content_tag(:li, content_tag(:span, month_name(start_date)), class: 'disabled') } end alias_method_chain :default_title, :bootstrap def render_header_with_bootstrap capture do content_tag :ul, { class: 'pagination' }.merge(get_option(:header)) do concat get_option(:previous_link, param_name, date_range) concat get_option(:title, start_date) concat get_option(:next_link, param_name, date_range) end end end alias_method_chain :render_header, :bootstrap def bootstrap_previous_link ->(param, date_range) { content_tag :li, link_to(raw("«"), param => date_range.first - 1.day) } end def bootstrap_next_link ->(param, date_range) { content_tag :li, link_to(raw("»"), param => date_range.last + 1.day) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appt-0.0.1.beta.2 | lib/bootstrap_month_calendar.rb |