Module: CalendarDateSelect::IncludesHelper
- Defined in:
- lib/calendar_date_select/includes_helper.rb
Instance Method Summary collapse
-
#calendar_date_select_includes(*args) ⇒ Object
returns html necessary to load javascript and css to make calendar_date_select work.
-
#calendar_date_select_javascripts(options = {}) ⇒ Object
returns an array of javascripts needed for the selected locale, date_format, and calendar control itself.
-
#calendar_date_select_stylesheets(options = {}) ⇒ Object
returns the selected calendar_date_select stylesheet (not an array).
Instance Method Details
#calendar_date_select_includes(*args) ⇒ Object
returns html necessary to load javascript and css to make calendar_date_select work
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/calendar_date_select/includes_helper.rb', line 18 def calendar_date_select_includes(*args) return "" if @cds_already_included @cds_already_included=true = (Hash === args.last) ? args.pop : {} .assert_valid_keys(:style, :locale) [:style] ||= args.shift javascript_include_tag(*calendar_date_select_javascripts(:locale => [:locale])) + "\n" + stylesheet_link_tag(*calendar_date_select_stylesheets(:style => [:style])) + "\n" end |
#calendar_date_select_javascripts(options = {}) ⇒ Object
returns an array of javascripts needed for the selected locale, date_format, and calendar control itself.
9 10 11 12 13 14 15 |
# File 'lib/calendar_date_select/includes_helper.rb', line 9 def calendar_date_select_javascripts( = {}) .assert_valid_keys(:locale) files = ["calendar_date_select/calendar_date_select"] files << "calendar_date_select/locale/#{[:locale]}" if [:locale] files << "calendar_date_select/#{CalendarDateSelect.format[:javascript_include]}" if CalendarDateSelect.format[:javascript_include] files end |
#calendar_date_select_stylesheets(options = {}) ⇒ Object
returns the selected calendar_date_select stylesheet (not an array)
3 4 5 6 |
# File 'lib/calendar_date_select/includes_helper.rb', line 3 def calendar_date_select_stylesheets( = {}) .assert_valid_keys(:style) "calendar_date_select/#{[:style] || "default"}" end |