From adac1d3d7ad8fd0bcf686aa813980efcf4d9df79 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 2 Dec 2016 14:53:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E9=97=AE=E5=8D=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 3 + app/views/exercise/_exercise.html.erb | 2 +- app/views/poll/_poll.html.erb | 135 +++++++++++++++----------- app/views/poll/_poll_list.html.erb | 2 +- app/views/poll/_polls_list.html.erb | 6 +- app/views/poll/close_poll.js.erb | 2 +- app/views/poll/destroy.js.erb | 1 + app/views/poll/index.html.erb | 21 ++-- app/views/poll/publish_poll.js.erb | 2 +- app/views/poll/republish_poll.js.erb | 2 +- public/stylesheets/css/common.css | 1 + public/stylesheets/css/courses.css | 4 +- public/stylesheets/polls.css | 4 +- 13 files changed, 111 insertions(+), 74 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 08e221d5e..325517e4b 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -270,6 +270,7 @@ class PollController < ApplicationController #发布问卷 def publish_poll + @index = params[:index] @poll.polls_status = 2 @poll.published_at = Time.now @poll.show_result = params[:show_result].to_i if params[:show_result] @@ -508,6 +509,7 @@ class PollController < ApplicationController #重新发布问卷 def republish_poll + @index = params[:index] @poll.poll_questions.each do |poll_question| poll_question.poll_votes.destroy_all end @@ -530,6 +532,7 @@ class PollController < ApplicationController #关闭问卷 def close_poll + @index = params[:index] @poll.polls_status = 3 @poll.closed_at = Time.now if @poll.save diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index a1dd20627..daa732fbe 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -36,7 +36,7 @@ 测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %> 截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %> 发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %> - <% if @is_teacher && exercise.exercise_status > 1 %> + <% if exercise.exercise_status > 1 %> 已提交:<%= exercise.exercise_users.where("commit_status = 1").count %> 未提交:<%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %> <% end %> diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index b04f96db5..d56af64f0 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -1,68 +1,93 @@ <% 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 %> - <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%> - <% else %> - <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %> - <% end %> +
    +
    +
    + <% if has_commit %> + <%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %> + <% else %> + <%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %> + <% end %> + <% if poll.polls_status == 1 %> + + <% elsif poll.polls_status == 2 %> + + <% else %> + + <% end%> +
    +
    + +
    + + <% if poll.polls_status == 1 %> + <%= link_to '', edit_poll_path(poll.id), :title => "编辑试卷", :class => "ex_icon_edit mt0"%> + <% end%> +
    -
  • +
    - <% if poll.polls_status == 1%> -
  • 统计结果
  • - <% elsif poll.polls_status == 2 || poll.polls_status == 3 %> -
  • <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
  • - <% end%> +
    + 创建时间:<%= format_time(poll.created_at) %> + <% if poll.polls_status > 1 %> + 发布时间:<%= poll.published_at.nil? ? '未设置' : format_time(poll.published_at) %> + <% end %> + <% if poll.polls_status > 1 %> + 答题:<%= poll.poll_users.count %> / <%=@course.student.count %> + <% end %> - <% if poll.polls_status == 1 %> -
  • 发布问卷
  • - <% elsif poll.polls_status == 2%> -
  • 取消发布
  • - <% else%> -
  • 发布问卷
  • - <% end%> + <% if poll.polls_status == 1 %> +
    发布问卷
    + <% elsif poll.polls_status == 2%> +
    取消发布
    + <% else%> +
    发布问卷
    + <% end%> - <%= link_to(l(:button_delete), poll,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %> + <% if poll.polls_status == 1%> +
    统计结果
    + <% elsif poll.polls_status == 2 || poll.polls_status == 3 %> +
    <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr ml10"%>
    + <% end%> - <% if poll.polls_status == 1 %> -
  • <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml5"%>
  • - <% else%> -
  • 编辑
  • - <% end%> + <% if poll.polls_status == 2 %> +
  • 关闭
  • + <% else %> +
  • 关闭
  • + <% end%> - <% if poll.polls_status == 2 %> -
  • 关闭
  • - <% else %> -
  • 关闭
  • - <% end%> - - <% if poll.polls_status == 1%> -
  • 导出
  • - <% elsif poll.polls_status == 2 || poll.polls_status == 3 %> -
  • <%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "polls_de fr ml5"%>
  • - - <% end%> - - -
  • <%= format_date poll.created_at.to_date%>
  • + <% if poll.polls_status == 1%> +
  • 导出
  • + <% elsif poll.polls_status == 2 || poll.polls_status == 3 %> +
  • <%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "pollsbtn fr ml10"%>
  • + <% end%> +
    +
    <% else%> <% if poll.polls_status == 2%> - <% if has_commit%> -
  • <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %>
  • -
  • 已答
  • - <%else%> - <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue"%> - <%end%> +
    + <% if has_commit%> + <%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%> + + <%else%> + <%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%> + + <%end%> +
    +
    +
    + 发布时间:<%= format_time(poll.published_at) %> + 答题:<%= poll.poll_users.count %> / <%=@course.student.count %> + + <% if poll.show_result == 1 %> + <% if has_commit%> +
  • <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr"%>
  • + <%else%> +
  • 统计结果
  • + <%end%> + <% end %> +
    +
    <% end%> -
  • <%= format_date poll.created_at.to_date%>
  • - <% if poll.show_result == 1 %> - <% if has_commit%> -
  • <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr mr10"%>
  • - <%else%> -
  • 统计结果
  • - <%end%> - <% end %> <% end%> \ No newline at end of file diff --git a/app/views/poll/_poll_list.html.erb b/app/views/poll/_poll_list.html.erb index fb8b765a3..be2d6919d 100644 --- a/app/views/poll/_poll_list.html.erb +++ b/app/views/poll/_poll_list.html.erb @@ -1,4 +1,4 @@ -
    +

    所有问卷 (<%= @obj_count%>)

    diff --git a/app/views/poll/_polls_list.html.erb b/app/views/poll/_polls_list.html.erb index c096f396d..a23af8e73 100644 --- a/app/views/poll/_polls_list.html.erb +++ b/app/views/poll/_polls_list.html.erb @@ -1,6 +1,6 @@ -<% polls.each do |poll|%> -
      - <%= render :partial => 'poll', :locals => {:poll => poll} %> +<% polls.each_with_index do |poll, i|%> +
        + <%= render :partial => 'poll', :locals => {:poll => poll, :index => i} %>
      <% end%> diff --git a/app/views/poll/close_poll.js.erb b/app/views/poll/close_poll.js.erb index 222ea7976..4cfe48f3f 100644 --- a/app/views/poll/close_poll.js.erb +++ b/app/views/poll/close_poll.js.erb @@ -1,2 +1,2 @@ -$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); +$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>"); alert("关闭成功"); \ No newline at end of file diff --git a/app/views/poll/destroy.js.erb b/app/views/poll/destroy.js.erb index 8bb67f20a..f7a31c9d2 100644 --- a/app/views/poll/destroy.js.erb +++ b/app/views/poll/destroy.js.erb @@ -1 +1,2 @@ +hideModal(); $("#polls").html("<%= escape_javascript(render :partial => 'poll_list') %>"); \ No newline at end of file diff --git a/app/views/poll/index.html.erb b/app/views/poll/index.html.erb index 8b87d737d..87477a537 100644 --- a/app/views/poll/index.html.erb +++ b/app/views/poll/index.html.erb @@ -1,13 +1,13 @@ <%= stylesheet_link_tag 'polls', :media => 'all' %>
      -
      +
      <%= render :partial => 'poll_list'%>
      \ No newline at end of file diff --git a/app/views/poll/publish_poll.js.erb b/app/views/poll/publish_poll.js.erb index 91dcdc882..6e24cbc0a 100644 --- a/app/views/poll/publish_poll.js.erb +++ b/app/views/poll/publish_poll.js.erb @@ -1,4 +1,4 @@ -$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); +$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>"); $('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>"); showModal('ajax-modal', '250px'); //$('#ajax-modal').css('height','111px'); diff --git a/app/views/poll/republish_poll.js.erb b/app/views/poll/republish_poll.js.erb index 1d025a5b2..27169a413 100644 --- a/app/views/poll/republish_poll.js.erb +++ b/app/views/poll/republish_poll.js.erb @@ -1,4 +1,4 @@ -$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); +$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll, :index => @index}) %>"); $('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>"); showModal('ajax-modal', '250px'); //$('#ajax-modal').css('height','80px'); diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index aeb817e76..931aeb39e 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -183,6 +183,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .mw380 {max-width: 380px !important;} .mw400 {max-width: 400px !important;} .mw450 {max-width: 450px !important;} +.mw550 {max-width: 550px !important;} .mt-20 {margin-top:-20px;} .mt-10 {margin-top:-10px;} .mt-4 {margin-top:-4px;} diff --git a/public/stylesheets/css/courses.css b/public/stylesheets/css/courses.css index 91a22a177..97ba3801f 100644 --- a/public/stylesheets/css/courses.css +++ b/public/stylesheets/css/courses.css @@ -594,9 +594,9 @@ a:hover.blueCir{ background:#3598db; color:#fff;} .exercise_status_end{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -659px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;} .exercise_status_com{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -681px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;} .exercise_status_nocom{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -705px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;} -a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:27px; display:block;float:right;} +a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:25px; display:block;float:right;} a:hover.ex_icon_de{ background:url(/images/course/icons.png) -20px -342px no-repeat;} -.ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:27px; display:block;float:right; margin-right:10px;} +.ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:25px; display:block;float:right; margin-right:10px;} a:hover.ex_icon_edit{ background:url(/images/course/icons.png) -21px -276px no-repeat;} /*首页课程列表归档按钮提示*/ diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index 085acd80f..2ceb11f20 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -15,7 +15,7 @@ a.newbtn{ float:right; display:block; width:80px; height:27px; padding-top:3px; a:hover.newbtn{ background:#55a1b9; text-decoration:none;} .polls_list_ul{ padding-left:10px; border-bottom:1px dashed #c9c9c9; height:32px; padding-top:8px;} a.polls_title{ font-weight:bold; color:#3e6d8e; margin-top:3px;} -a.pollsbtn{ display:block; width:66px; height:20px; padding-top:2px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;} +a.pollsbtn{ display:block; height:20px; padding:0 9px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;} a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;} .polls_date{ color:#666666;margin-top:3px; } .polls_de{ color:#6883b6; margin-top:3px;} @@ -129,7 +129,7 @@ a.btn_de{ border:1px solid #ff5d31; color:#ff5d31; } a:hover.btn_de{ background:#ff5d31;} a.btn_pu{ border:1px solid #3cb761; color:#3cb761; } a:hover.btn_pu{ background:#3cb761;} -.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; } +.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:20px;} .polls_title_w { max-width:280px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_title_st { max-width:450px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_de_grey{ color:#b1b1b1; margin-top:3px;}