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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'app/helpers/reports_helper.rb', line 10
def how_are_we_doing_chart(form_id,graph_container_id,graph_type,options={})
script = " <script>\n $(\"#\#{form_id} #analyticals\").live('click',function(){\n $(this).attr('size',10);\n });\n \n $('#\#{form_id} #analyticals').live('change',function(){\n $(this).parents('form').find('#analytical_ids').val($(this).val());\n $(this).parents('form').trigger('submit');\n });\n \n \n $('#\#{form_id} input:checkbox').live('change',function(){\n $(this).parents('form').find('#'+$(this).attr('id').replace('include_','exclude_')).val($(this).attr(\"checked\") ? \"\" : true);\n $(this).parents('form').trigger('submit');\n });\n \n $('#\#{form_id}').live('submit',function(){\n var data = {};\n var allowable_params = {\n exclude_totals:1,\n exclude_prints:1,\n exclude_shares:1,\n exclude_views:1,\n start_date:1,\n end_date:1,\n start_date:1,\n parent_type: 1,\n parent_id: 1,\n analytical_ids: 1,\n analytical_type:1\n };\n\n $(this).find('input,select').each(function(i,element){\n if(element.name && allowable_params[element.name] && $(element).val()) {\n data[element.name] = $(element).val();\n }\n });\n\n \n $.ajax({\n url: $(this).attr('action')+\".json\",\n method: 'get',\n data: $.param(data),\n dataType: 'json',\n success: function(data) {\n \#{graph_type}_graph_it(data,'\#{graph_container_id}');\n }\n });\n return false;\n });\n \n $(function(){\n $('#\#{form_id}').trigger('submit');\n $(\".date-selector\").datepicker();\n });\n </script>\n END\n content_for :javascripts do\n script.html_safe\n end\n render :partial => \"reports/\#{graph_type}_graph\", :locals => {:form_id => form_id, :graph_container_id => graph_container_id, :analytical_ids => options[:analytical_ids], :include_comparison => options[:include_comparison]}\nend\n".gsub(/^ {6}/, '')
|