Sha256: 904bf659cd1818a9928dd9e8f33a2e8dc97c5043cf720a5bce7c44a115607524

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

module CalendarDateSelect::IncludesHelper
  # returns the selected calendar_date_select stylesheet (not an array)
  def calendar_date_select_stylesheets(options = {})
    options.assert_valid_keys(:style)
    "calendar_date_select/#{options[:style] || "default"}"
  end

  # returns an array of javascripts needed for the selected locale, date_format, and calendar control itself.
  def calendar_date_select_javascripts(options = {})
    options.assert_valid_keys(:format, :locale)
    files = ["calendar_date_select/calendar_date_select"]
    files << "calendar_date_select/locale/#{options[:locale]}" if options[:locale]
    files << "calendar_date_select/#{CalendarDateSelect.format[:javascript_include]}" if CalendarDateSelect.format[:javascript_include]
    files
  end

  # returns html necessary to load javascript and css to make calendar_date_select work
  def calendar_date_select_includes(*args)
    return "" if @cds_already_included
    @cds_already_included=true
    
    options = (Hash === args.last) ? args.pop : {}
    options.assert_valid_keys(:style, :format, :locale)
    options[:style] ||= args.shift
    
    javascript_include_tag(*calendar_date_select_javascripts(:locale => options[:locale], :format => options[:format])) + "\n" +
    stylesheet_link_tag(*calendar_date_select_stylesheets(:style => options[:style])) + "\n"
  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
atd-calendar_date_select-1.11.20090108 lib/calendar_date_select/includes_helper.rb
edwinmoss-calendar_date_select-1.11.1 lib/calendar_date_select/includes_helper.rb
calendar_date_select-1.13 lib/calendar_date_select/includes_helper.rb
spree-0.6.0 vendor/plugins/calendar_date_select/lib/calendar_date_select/includes_helper.rb
spree-0.7.0 vendor/plugins/calendar_date_select/lib/calendar_date_select/includes_helper.rb
spree-0.7.1 vendor/plugins/calendar_date_select/lib/calendar_date_select/includes_helper.rb