Skip to content

Commit

Permalink
show the results using a datatable from http://www.datatables.net/
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit Riessen committed May 10, 2011
1 parent e91b875 commit 76b76c8
Show file tree
Hide file tree
Showing 13 changed files with 705 additions and 18 deletions.
14 changes: 7 additions & 7 deletions app/helpers/surveyor_helper.rb
@@ -1,13 +1,13 @@
module SurveyorHelper
# Layout: stylsheets and javascripts
def surveyor_includes
surveyor_stylsheets + surveyor_javascripts
surveyor_stylsheets + surveyor_javascripts
end
def surveyor_stylsheets
stylesheet_link_tag 'surveyor/reset', 'surveyor/dateinput', 'surveyor'
stylesheet_link_tag 'surveyor/reset', 'surveyor/dateinput', 'surveyor/demo_table', 'surveyor'
end
def surveyor_javascripts
javascript_include_tag 'surveyor/jquery.tools.min', 'surveyor/jquery.surveyor'
javascript_include_tag 'surveyor/jquery.tools.min', 'surveyor/jquery.surveyor', 'surveyor/jquery.dataTables.min'
end
# Helper for displaying warning/notice/error flash messages
def flash_messages(types)
Expand All @@ -34,7 +34,7 @@ def next_section
# use copy in memory instead of making extra db calls
@sections.last == @section ? submit_tag(t('surveyor.click_here_to_finish').html_safe, :name => "finish") : submit_tag(t('surveyor.next_section').html_safe, :name => "section[#{@sections[@sections.index(@section)+1].id}]")
end

# Questions
def q_text(obj)
@n ||= 0
Expand All @@ -48,7 +48,7 @@ def q_text(obj)
# def question_help_helper(question)
# question.help_text.blank? ? "" : %Q(<span class="question-help">#{question.help_text}</span>)
# end

# Answers
def rc_to_attr(type_sym)
case type_sym.to_s
Expand All @@ -69,7 +69,7 @@ def generate_pick_none_input_html(response_class, default_value, css_class)
html[:value] = default_value if response_class.blank?
html
end

# Responses
def response_for(response_set, question, answer = nil, response_group = nil)
return nil unless response_set && question && question.id
Expand All @@ -79,5 +79,5 @@ def response_for(response_set, question, answer = nil, response_group = nil)
def response_idx(increment = true)
@rc ||= 0
(increment ? @rc += 1 : @rc).to_s
end
end
end
28 changes: 17 additions & 11 deletions app/views/results/show.html.haml
@@ -1,16 +1,22 @@
%table.list_table
%tr
%th ID
%th Code
- @questions.each do |question|
- next if question.display_order == 1
%th= "[" +question.display_order.to_s + "]" + question.text
- @response_sets.each do |r_set|
%table#results_list.display
%thead
%tr
%td= h r_set.id
%td= h r_set.access_code
%th ID
%th Code
- @questions.each do |question|
- next if question.display_order == 1
%td!= display_response(r_set,question)
%th= "[" +question.display_order.to_s + "]" + question.text
%tbody
- @response_sets.each do |r_set|
%tr.gradeA
%td= h r_set.id
%td= h r_set.access_code
- @questions.each do |question|
- next if question.display_order == 1
%td!= display_response(r_set,question)
%br/
= link_to "Back", results_path
:javascript
$(document).ready(function(){
$('#results_list').dataTable();
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

0 comments on commit 76b76c8

Please sign in to comment.