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
- content_for :javascripts do
12
- <<-END.gsub(/^ {6}/, '')
13
- <script>
14
- $("##{form_id} #analyticals").live('click',function(){
15
- $(this).attr('size',10);
16
- });
17
-
18
- $('##{form_id} #analyticals').live('change',function(){
19
- $(this).parents('form').find('#analytical_ids').val($(this).val());
20
- $(this).parents('form').trigger('submit');
21
- });
22
-
23
-
24
- $('##{form_id} input:checkbox').live('change',function(){
25
- $(this).parents('form').find('#'+$(this).attr('id').replace('include_','exclude_')).val($(this).attr("checked") ? "" : true);
26
- $(this).parents('form').trigger('submit');
27
- });
28
-
29
- $('##{form_id}').live('submit',function(){
30
- var data = {};
31
- var allowable_params = {
32
- exclude_totals:1,
33
- exclude_prints:1,
34
- exclude_shares:1,
35
- exclude_views:1,
36
- start_date:1,
37
- end_date:1,
38
- start_date:1,
39
- parent_type: 1,
40
- parent_id: 1,
41
- analytical_ids: 1,
42
- analytical_type:1
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
- $.ajax({
53
- url: $(this).attr('action')+".json",
54
- method: 'get',
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
- $(function(){
65
- $('##{form_id}').trigger('submit');
66
- $(".date-selector").datepicker();
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
- </script>
69
- END
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], :include_comparision => options[:include_comparision]}
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?(include_comparision) and include_comparision %>
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 %>
@@ -42,7 +42,6 @@ function line_graph_it(data,graph_container_id) {
42
42
  hoverable: true
43
43
  }
44
44
  };
45
-
46
45
  $.plot($('#'+graph_container_id),
47
46
  formatted_data,
48
47
  $.extend(true, default_format_options, data.format_options)
@@ -1,3 +1,3 @@
1
1
  module HowAreWeDoing
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: how_are_we_doing
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.7
5
+ version: 0.0.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gunner Technology, Cody Swann