how_are_we_doing 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,66 +8,67 @@ module ReportsHelper
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def how_are_we_doing_chart(form_id,graph_container_id,graph_type,options={})
|
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
|
-
$(this).find('input,select').each(function(i,element){
|
46
|
-
if(element.name && allowable_params[element.name] && $(element).val()) {
|
47
|
-
data[element.name] = $(element).val();
|
48
|
-
}
|
49
|
-
});
|
11
|
+
script = <<-END.gsub(/^ {6}/, '')
|
12
|
+
<script>
|
13
|
+
$("##{form_id} #analyticals").live('click',function(){
|
14
|
+
$(this).attr('size',10);
|
15
|
+
});
|
16
|
+
|
17
|
+
$('##{form_id} #analyticals').live('change',function(){
|
18
|
+
$(this).parents('form').find('#analytical_ids').val($(this).val());
|
19
|
+
$(this).parents('form').trigger('submit');
|
20
|
+
});
|
21
|
+
|
22
|
+
|
23
|
+
$('##{form_id} input:checkbox').live('change',function(){
|
24
|
+
$(this).parents('form').find('#'+$(this).attr('id').replace('include_','exclude_')).val($(this).attr("checked") ? "" : true);
|
25
|
+
$(this).parents('form').trigger('submit');
|
26
|
+
});
|
27
|
+
|
28
|
+
$('##{form_id}').live('submit',function(){
|
29
|
+
var data = {};
|
30
|
+
var allowable_params = {
|
31
|
+
exclude_totals:1,
|
32
|
+
exclude_prints:1,
|
33
|
+
exclude_shares:1,
|
34
|
+
exclude_views:1,
|
35
|
+
start_date:1,
|
36
|
+
end_date:1,
|
37
|
+
start_date:1,
|
38
|
+
parent_type: 1,
|
39
|
+
parent_id: 1,
|
40
|
+
analytical_ids: 1,
|
41
|
+
analytical_type:1
|
42
|
+
};
|
50
43
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
data: $.param(data),
|
56
|
-
dataType: 'json',
|
57
|
-
success: function(data) {
|
58
|
-
#{graph_type}_graph_it(data,'#{graph_container_id}');
|
59
|
-
}
|
60
|
-
});
|
61
|
-
return false;
|
44
|
+
$(this).find('input,select').each(function(i,element){
|
45
|
+
if(element.name && allowable_params[element.name] && $(element).val()) {
|
46
|
+
data[element.name] = $(element).val();
|
47
|
+
}
|
62
48
|
});
|
49
|
+
|
63
50
|
|
64
|
-
|
65
|
-
$(
|
66
|
-
|
51
|
+
$.ajax({
|
52
|
+
url: $(this).attr('action')+".json",
|
53
|
+
method: 'get',
|
54
|
+
data: $.param(data),
|
55
|
+
dataType: 'json',
|
56
|
+
success: function(data) {
|
57
|
+
#{graph_type}_graph_it(data,'#{graph_container_id}');
|
58
|
+
}
|
67
59
|
});
|
68
|
-
|
69
|
-
|
60
|
+
return false;
|
61
|
+
});
|
62
|
+
|
63
|
+
$(function(){
|
64
|
+
$('##{form_id}').trigger('submit');
|
65
|
+
$(".date-selector").datepicker();
|
66
|
+
});
|
67
|
+
</script>
|
68
|
+
END
|
69
|
+
content_for :javascripts do
|
70
|
+
script.html_safe
|
70
71
|
end
|
71
|
-
render "reports/#{graph_type}_graph", :locals => {:form_id => form_id, :graph_container_id => graph_container_id, analytical_ids => options[:analytical_ids], :
|
72
|
+
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]}
|
72
73
|
end
|
73
74
|
end
|
@@ -14,14 +14,14 @@
|
|
14
14
|
<%= hidden_field_tag 'exclude_shares' %>
|
15
15
|
<%= hidden_field_tag 'analytical_type', (params[:analytical_type]||params[:default_analytical_type]) %>
|
16
16
|
<% if defined?(analytical_ids) %>
|
17
|
-
<%= hidden_field_tag 'analytical_ids', (analytical_ids||[]) %>
|
17
|
+
<%= hidden_field_tag 'analytical_ids', (analytical_ids||[]).join(",") %>
|
18
18
|
<% end %>
|
19
19
|
|
20
20
|
<%= submit_tag(t(:submit)) %>
|
21
21
|
<%= image_submit_tag("hawd/blank.png") %>
|
22
22
|
</div>
|
23
23
|
|
24
|
-
<% if defined?(
|
24
|
+
<% if defined?(include_comparison) and include_comparison %>
|
25
25
|
<fieldset class="graph-compare">
|
26
26
|
<%= label_tag 'analyticals', t('hawd.comparision', :analytical => (params[:analytical_type]||params[:default_analytical_type]||"")) %>
|
27
27
|
<%= select_tag "analyticals", options_from_collection_for_select(@analyticals, "id", "to_s", {:selected => lambda { |analytical| @analytical_ids.include?(analytical.id) }}), :multiple => true, :size => 1 %>
|