diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb
index 42ab98e10..4abddaa5e 100644
--- a/app/controllers/poll_controller.rb
+++ b/app/controllers/poll_controller.rb
@@ -1,7 +1,7 @@
class PollController < ApplicationController
- before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll]
+ before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result]
before_filter :find_container, :only => [:new,:create, :index]
- before_filter :is_member_of_course, :only => [:index,:show]
+ before_filter :is_member_of_course, :only => [:index,:show,:poll_result]
before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll]
include PollHelper
def index
@@ -330,6 +330,14 @@ class PollController < ApplicationController
end
end
+ #显示某个学生某份问卷的填写结果
+ def poll_result
+ @poll_questions = paginateHelper @poll.poll_questions,5
+ respond_to do |format|
+ format.html{render :layout => 'base_courses'}
+ end
+ end
+
private
def find_poll_and_course
@poll = Poll.find params[:id]
diff --git a/app/helpers/poll_helper.rb b/app/helpers/poll_helper.rb
index 17ef02a36..60d82c096 100644
--- a/app/helpers/poll_helper.rb
+++ b/app/helpers/poll_helper.rb
@@ -73,5 +73,5 @@ module PollHelper
"多行主观题"
end
end
-
+
end
\ No newline at end of file
diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb
index 3290ff2dc..c53f09361 100644
--- a/app/views/poll/_poll.html.erb
+++ b/app/views/poll/_poll.html.erb
@@ -1,20 +1,19 @@
<% has_commit = has_commit_poll?(poll.id ,User.current)%>
+<% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
<% if @is_teacher %>
<% if has_commit %>
- <%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
+ <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %>
<% else %>
- <%= link_to (poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name), poll_path(poll.id), :class => "polls_title polls_title_w fl" %>
+ <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl" %>
<% end %>
<% else %>
<% if has_commit && poll.polls_status == 2 %>
-
- <%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name %>
-
+ <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 500px;width: auto;" %>
<% elsif !has_commit && poll.polls_status == 2 %>
- <%= link_to (poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name), poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %>
+ <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl", :style => "max-width: 550px;width: 550px;" %>
<% end %>
<% end %>
diff --git a/app/views/poll/_show_MCQ_result.html.erb b/app/views/poll/_show_MCQ_result.html.erb
new file mode 100644
index 000000000..f46882881
--- /dev/null
+++ b/app/views/poll/_show_MCQ_result.html.erb
@@ -0,0 +1,26 @@
+
+
+
+ 第<%= poll_question.question_number%>题:
+
+ <%= poll_question.question_title %>
+ [多选题]
+ <%if poll_question.is_necessary == 1%>
+ *
+ <%end%>
+
+
+
+
\ No newline at end of file
diff --git a/app/views/poll/_show_MC_result.html.erb b/app/views/poll/_show_MC_result.html.erb
new file mode 100644
index 000000000..7f2cbbd83
--- /dev/null
+++ b/app/views/poll/_show_MC_result.html.erb
@@ -0,0 +1,27 @@
+
+
+
+ 第<%= poll_question.question_number%>题:
+
+ <%= poll_question.question_title %>
+ [单选题]
+ <%if poll_question.is_necessary == 1%>
+ *
+ <%end%>
+
+
+
+
\ No newline at end of file
diff --git a/app/views/poll/_show_mulit_result.html.erb b/app/views/poll/_show_mulit_result.html.erb
new file mode 100644
index 000000000..e54cca505
--- /dev/null
+++ b/app/views/poll/_show_mulit_result.html.erb
@@ -0,0 +1,20 @@
+
+
+
+
+ 第<%= poll_question.question_number%>题:
+
+ <%= poll_question.question_title %>
+ [多行主观]
+ <%if poll_question.is_necessary == 1%>
+ *
+ <%end%>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/poll/_show_single_result.html.erb b/app/views/poll/_show_single_result.html.erb
new file mode 100644
index 000000000..07559773d
--- /dev/null
+++ b/app/views/poll/_show_single_result.html.erb
@@ -0,0 +1,18 @@
+
+
+
+ 第<%= poll_question.question_number%>题:
+
+ <%= poll_question.question_title %>
+ [单行主观]
+ <%if poll_question.is_necessary == 1%>
+ *
+ <%end%>
+
+
+
+
\ No newline at end of file
diff --git a/app/views/poll/poll_result.html.erb b/app/views/poll/poll_result.html.erb
new file mode 100644
index 000000000..a7cb415b3
--- /dev/null
+++ b/app/views/poll/poll_result.html.erb
@@ -0,0 +1,36 @@
+<%= stylesheet_link_tag 'polls', :media => 'all' %>
+
+
+
+ <%= @poll.polls_name.empty? ? l(:label_poll_new) : @poll.polls_name %>
+
+
+ <%= @poll.polls_description%>
+
+
+
+
+ <% @poll_questions.each do |poll_question|%>
+ <% if poll_question.question_type == 1%>
+ <%= render :partial => 'show_MC_result', :locals => {:poll_question => poll_question} %>
+ <% elsif poll_question.question_type == 2%>
+ <%= render :partial => 'show_MCQ_result', :locals => {:poll_question => poll_question} %>
+ <% elsif poll_question.question_type == 3%>
+ <%= render :partial => 'show_single_result', :locals => {:poll_question => poll_question} %>
+ <% elsif poll_question.question_type == 4%>
+ <%= render :partial => 'show_mulit_result', :locals => {:poll_question => poll_question} %>
+ <% end%>
+ <% end%>
+
+
+
+
+
+
+
+ <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 67b0118b0..524373378 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -66,6 +66,7 @@ RedmineApp::Application.routes.draw do
post 'commit_poll'
get 'publish_poll'
get 'republish_poll'
+ get 'poll_result'
end
collection do
delete 'delete_poll_question'