From fc72d6f9a9710256f70ee98a9a9db4030b1bcceb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 13 Jan 2015 15:59:02 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E9=97=AE=E5=8D=B7=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E3=80=81=E9=97=AE=E5=8D=B7=E7=AD=94=E5=8D=B7=E7=AD=89?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=B7=B3=E8=BD=AC=EF=BC=8C=E5=B9=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AF=B9=E5=BA=94=E8=B7=AF=E7=94=B1=202.=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F=203.=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 13 +- app/views/poll/index.html.erb | 22 +-- app/views/poll/show.html.erb | 114 +++++++++++ app/views/poll/statistics_result.html.erb | 220 ++++++++++++++++++++++ config/routes.rb | 6 +- public/stylesheets/polls.css | 2 +- 6 files changed, 356 insertions(+), 21 deletions(-) create mode 100644 app/views/poll/show.html.erb create mode 100644 app/views/poll/statistics_result.html.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index d4e2517e7..e5b1025a4 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -1,5 +1,5 @@ class PollController < ApplicationController - before_filter :find_poll_and_course, :only => [:edit,:update,:destroy] + before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result] before_filter :find_container, :only => [:new,:create, :index] before_filter :is_member_of_course, :only => [:index,:show] before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy] @@ -19,6 +19,11 @@ class PollController < ApplicationController def show @poll = Poll.find params[:id] + @poll_questions = @poll.poll_questions + + respond_to do |format| + format.html {render :layout => 'base_courses'} + end end def new @@ -70,6 +75,12 @@ class PollController < ApplicationController end end + def statistics_result + 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/views/poll/index.html.erb b/app/views/poll/index.html.erb index 0b49cd92d..79f930565 100644 --- a/app/views/poll/index.html.erb +++ b/app/views/poll/index.html.erb @@ -1,12 +1,4 @@ - - - - - 问卷调查_列表 - <%= stylesheet_link_tag 'polls', :media => 'all' %> - - - +<%= stylesheet_link_tag 'polls', :media => 'all' %>

所有问卷 @@ -21,15 +13,11 @@ <% @polls.each do |poll|%>

-
- - + \ No newline at end of file diff --git a/app/views/poll/show.html.erb b/app/views/poll/show.html.erb new file mode 100644 index 000000000..66fcd3bcd --- /dev/null +++ b/app/views/poll/show.html.erb @@ -0,0 +1,114 @@ + + + + + 问卷调查_问卷页面 + <%= stylesheet_link_tag 'polls', :media => 'all' %> + + + +
+
+

+ <%= @poll.polls_name%> +

+

+ <%= @poll.polls_description %> +

+
+ + +
+
    + +
  1. +
    + 第1题: 单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题单选题 * +
    +
    + + + + + + + + + + + + +
    + +
    + +
    + +
    +
    +
  2. + +
  3. +
    + 第2题: 多选题 * +
    +
    + + + + + + + + + + + + +
    + +
    + +
    + +
    +
    +
  4. + + +
  5. +
    + 第3题: 单行主观 +
    +
    + +
    +
  6. + +
  7. +
    +
    + 第4题: 多行主观 +
    +
    + +
    +
    +
  8. + +
+ + +
+
答题已完成 0%
+ +
+ + + +
+ + diff --git a/app/views/poll/statistics_result.html.erb b/app/views/poll/statistics_result.html.erb new file mode 100644 index 000000000..f07d17215 --- /dev/null +++ b/app/views/poll/statistics_result.html.erb @@ -0,0 +1,220 @@ + + + + + 问卷调查_问卷结果 + <%= stylesheet_link_tag 'polls', :media => 'all' %> + + + +
+
+

某问卷统计

+
+ + +
+
    +
  1. +
    + 第1题:问题描述问题描述 [单选题] +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    选项 小计 比例
    第一选项 24
    75%
    第二选项 1
    3.13%
    第三选项 1
    3.13%
    本题有效填写人次 26 
    +
    +
  2. +
  3. +
    + 第1题:问题描述问题描述 [单选题] +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    选项 小计 比例
    第一选项 24
    75%
    第二选项 1
    3.13%
    第三选项 1
    3.13%
    本题有效填写人次 26 
    +
    +
  4. +
  5. +
    + 第1题:问题描述问题描述 [单选题] +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    选项 小计 比例
    第一选项 24
    75%
    第二选项 1
    3.13%
    第三选项 1
    3.13%
    本题有效填写人次 26 
    +
    +
  6. +
  7. +
    + 第1题:问题描述问题描述 [单选题] +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    选项 小计 比例
    第一选项 24
    75%
    第二选项 1
    3.13%
    第三选项 1
    3.13%
    本题有效填写人次 26 
    +
    +
  8. +
  9. +
    + 第1题:问题描述问题描述 [单选题] +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    选项 小计 比例
    第一选项 24
    75%
    第二选项 1
    3.13%
    第三选项 1
    3.13%
    本题有效填写人次 26 
    +
    +
  10. + + + + + + + + +
+
+ + +
+
+
答题已完成 0%
+ +
+ + + +
+ + diff --git a/config/routes.rb b/config/routes.rb index 911a0643f..617a5ade4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -58,7 +58,11 @@ RedmineApp::Application.routes.draw do end end - resources :poll + resources :poll do + member do + get 'statistics_result' + end + end resources :contest_notification diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index 641d1726d..3ace9e459 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -46,7 +46,7 @@ ul.wlist li a:hover{ background:#15bccf; color:#fff; text-decoration:none;} .ur_inputs label{ padding-left:10px;} .ur_inputs input{ margin-right:5px;} .ur_text{ height:30px;} -.ur_textbox{ border:1px solid #dcdcdc; color:#676765;} +.ur_textbox{ border:1px solid #dcdcdc !important; color:#676765;} .ur_buttons{ width:250px; margin:20px auto 10px;} a.ur_button{ display:block; width:106px; height:37px; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:3px; float:left; margin-right:15px;} a:hover.ur_button{ background:#0fa9bb; text-decoration:none;}