public
Rubygem
Fork of timcharper/calendar_date_select
Description: A popular and flexible JavaScript DatePicker for RubyOnRails (and others)
Homepage: http://code.google.com/p/calendardateselect/
Clone URL: git://github.com/ewildgoose/calendar_date_select.git
Search Repo:
Add helpers to give the list of javascripts and stylesheets - useful with 
AS
ewildgoose (author)
Thu Jul 24 12:05:23 -0700 2008
commit  b244d98b931d002137018374bba746096c11487e
tree    83ac9b421b0ef50e3362dea69ae1cd9544de6568
parent  35c193c89d1b7b54853f9673db2849206c1464d0
0
...
1
2
3
4
5
 
 
6
7
 
 
 
 
 
 
8
9
10
 
11
12
13
14
15
16
17
18
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
21
22
...
1
2
 
 
 
3
4
5
 
6
7
8
9
10
11
12
13
 
14
15
16
17
18
 
 
 
 
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
0
@@ -1,22 +1,38 @@
0
 class CalendarDateSelect
0
   module IncludesHelper
0
- def calendar_date_select_includes(*args)
0
- return "" if @cds_already_included
0
- @cds_already_included=true
0
+ def calendar_date_select_stylesheets(options = {})
0
+ options.assert_valid_keys(:style, :format, :locale)
0
       
0
- options = (Hash === args.last) ? args.pop : {}
0
+ style = options[:style]
0
+ cds_css_file = style ? "calendar_date_select/#{style}" : "calendar_date_select/default"
0
+ return cds_css_file
0
+ end
0
+
0
+ def calendar_date_select_javascripts(options = {})
0
       options.assert_valid_keys(:style, :format, :locale)
0
       
0
- style = options[:style] || args.shift
0
+ style = options[:style]
0
       locale = options[:locale]
0
       cds_css_file = style ? "calendar_date_select/#{style}" : "calendar_date_select/default"
0
       
0
       output = []
0
- output << javascript_include_tag("calendar_date_select/calendar_date_select")
0
- output << javascript_include_tag("calendar_date_select/locale/#{locale}") if locale
0
- output << javascript_include_tag(CalendarDateSelect.javascript_format_include) if CalendarDateSelect.javascript_format_include
0
- output << stylesheet_link_tag(cds_css_file)
0
- output * "\n"
0
+ output << "calendar_date_select/calendar_date_select"
0
+ output << "calendar_date_select/locale/#{locale}" if locale
0
+ output << CalendarDateSelect.javascript_format_include if CalendarDateSelect.javascript_format_include
0
+ return output
0
+ end
0
+
0
+ def calendar_date_select_includes(*args)
0
+ return "" if @cds_already_included
0
+ @cds_already_included=true
0
+
0
+ options = (Hash === args.last) ? args.pop : {}
0
+ options.assert_valid_keys(:style, :format, :locale)
0
+ options[:style] ||= args.shift
0
+
0
+ js = javascript_include_tag(*calendar_date_select_javascripts(options))
0
+ css = stylesheet_link_tag(*calendar_date_select_stylesheets(options))
0
+ "#{js}\n#{css}\n"
0
     end
0
   end
0
 end

Comments

  • timcharper Thu Jul 24 12:22:46 -0700 2008

    This is fantastic Ed W – I’ve been meaning to get this done. I’ll pull it in.

    Thanks,
    Tim