Sha256: 3e9ad26a3f9f82b8aff5971b7ccb243c7569a13740c72da425152c367f720386

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

module ReportsHelper
  def how_are_we_doing_chart(form_id,graph_container_id,graph_type) 
    <<-END.gsub(/^ {6}/, '')
      <script>
        $('##{form_id} input:checkbox').live('change',function(){
          $('#'+$(this).attr('id').replace('include_','exclude_')).val($(this).attr("checked") ? "" : true);
        });
        
        $('##{form_id}').live('submit',function(){
          var data = {};

          $(this).find('input,select').each(function(i,element){
            if(element.id && element.id.match(/exclude_/) && $(element).val()) {
              data[element.name] = $(element).val();
            }
          })
          
          $.ajax({
            url: "#{reports_path(:json)}",
            method: 'get',
            data: $.param(data),
            dataType: 'json',
            success: function(data) {
              #{graph_type}_graph_it(data,'#{graph_container_id}');
            }
          });
          return false;
        });
        
        $(function(){
          $('##{form_id}').trigger('submit');
        });
      </script>
    END
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
how_are_we_doing-0.0.4 app/helpers/reports_helper.rb