From 3bdaeb20c217bac98a682aa3b88ecb1dbd7536c3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 21 Jan 2015 11:14:01 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F=202?= =?UTF-8?q?=E3=80=81=E9=97=AE=E5=8D=B7=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=97=AE=E5=8D=B7=E5=8A=9F=E8=83=BD=203?= =?UTF-8?q?=E3=80=81=E5=A2=9E=E5=8A=A0js=E8=BF=94=E5=9B=9E=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=204=E3=80=81=E5=8E=BB=E6=8E=89=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84js=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 8 +++- app/views/poll/_poll.html.erb | 64 +++++++++++++++++-------- app/views/poll/_poll_form.html.erb | 2 +- app/views/poll/_poll_republish.html.erb | 12 ----- app/views/poll/_poll_submit.html.erb | 16 +------ app/views/poll/index.html.erb | 24 ++++++++++ app/views/poll/publish_poll.js.erb | 2 + app/views/poll/republish_poll.js.erb | 3 +- public/stylesheets/polls.css | 15 +++++- 9 files changed, 94 insertions(+), 52 deletions(-) create mode 100644 app/views/poll/publish_poll.js.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 2fc586711..42ab98e10 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -187,7 +187,13 @@ class PollController < ApplicationController @poll.polls_status = 2 @poll.published_at = Time.now if @poll.save - redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id) + if params[:is_remote] + redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id) + else + respond_to do |format| + format.js + end + end end end diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index dea4e175b..cc7e88547 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -1,23 +1,44 @@ +<% has_commit = has_commit_poll?(poll.id ,User.current)%>
  • <% if @is_teacher %> - <% if has_commit_poll?(poll.id ,User.current) %> - <%= poll.polls_name %> + <% if has_commit %> + + <%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%> + <% else %> - <%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %> + <%= link_to (poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name), poll_path(poll.id), :class => "polls_title polls_title_w fl" %> <% end %> <% else %> - <% if has_commit_poll?(poll.id ,User.current) && poll.polls_status == 2 %> + <% if has_commit && poll.polls_status == 2 %> - <%= poll.polls_name %> + <%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name %> - <% elsif (!has_commit_poll?(poll.id ,User.current)) && poll.polls_status == 2 %> - <%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %> + <% 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" %> <% end %> <% end %>
  • +<% if !@is_teacher && has_commit && poll.polls_status == 2%> +
  • 已答
  • +<% end %> + +<%if @is_teacher%> + <% if poll.polls_status == 1 %> +
  • 统计结果
  • + <% elsif poll.polls_status == 2%> +
  • + <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%> +
  • + <% end%> +<% end%> +
  • - <%if @is_teacher && poll.polls_status == 2%> - <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%> + <%if @is_teacher %> + <% if poll.polls_status == 1 %> + 发布问卷 + <% elsif poll.polls_status == 2%> + 取消发布 + <% end%> <% end%>
  • @@ -28,18 +49,21 @@ <% end%>
  • - <% if @is_teacher && poll.polls_status == 1%> - - <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml20"%> + <% if @is_teacher%> + <% if poll.polls_status == 1 %> + <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml20"%> + <% elsif poll.polls_status == 2%> +
  • 编辑
  • + <% end%> <% end%> -
  • - <% if @is_teacher && poll.polls_status == 2%> - - 取消发布 - - <% end %> -
  • -
  • + + + + + + + +
  • <%= format_time poll.created_at%>
  • \ No newline at end of file diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index bbf71e0ce..6ce4137a3 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -57,7 +57,7 @@ function poll_submit() { - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { poll: @poll}) %>'); + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll},:is_remote => false) %>'); showModal('ajax-modal', '310px'); $('#ajax-modal').css('height','110px'); $('#ajax-modal').siblings().remove(); diff --git a/app/views/poll/_poll_republish.html.erb b/app/views/poll/_poll_republish.html.erb index 3688ba883..3f93b6b3d 100644 --- a/app/views/poll/_poll_republish.html.erb +++ b/app/views/poll/_poll_republish.html.erb @@ -2,18 +2,6 @@ diff --git a/app/views/poll/_poll_submit.html.erb b/app/views/poll/_poll_submit.html.erb index cdc41dd9d..af3ca2d42 100644 --- a/app/views/poll/_poll_submit.html.erb +++ b/app/views/poll/_poll_submit.html.erb @@ -2,18 +2,6 @@ @@ -27,16 +15,14 @@ 是否确定发布该问卷?

    - <%= link_to "确 定",publish_poll_poll_path(poll.id), :class => "upload_btn", :onclick => "clickCanel();" %> + <%= link_to "确 定",publish_poll_poll_path(poll.id,:is_remote => is_remote), :class => "upload_btn", :onclick => "clickCanel();" %> 取  消
    - - diff --git a/app/views/poll/index.html.erb b/app/views/poll/index.html.erb index 043e6898b..de30b5deb 100644 --- a/app/views/poll/index.html.erb +++ b/app/views/poll/index.html.erb @@ -25,6 +25,30 @@ } function clickCanel(){hideModal("#popbox02");} + + function poll_submit(poll_id) + { + $('#ajax-modal').html("
    " + + "
    " + + "
    " + + "

    问卷发布后将不能对问卷进行修改,
    是否确定发布该问卷?

    " + + "
    " + + "确  定" + + "取  消" + + "
    " + + "
    " + + "
    " + + "
    " + + "
    "); + showModal('ajax-modal', '310px'); + $('#ajax-modal').css('height','110px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().removeClass("alert_praise"); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("popbox_polls"); + }
    diff --git a/app/views/poll/publish_poll.js.erb b/app/views/poll/publish_poll.js.erb new file mode 100644 index 000000000..ad052f8f2 --- /dev/null +++ b/app/views/poll/publish_poll.js.erb @@ -0,0 +1,2 @@ +$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); +alert("发布成功"); \ No newline at end of file diff --git a/app/views/poll/republish_poll.js.erb b/app/views/poll/republish_poll.js.erb index a7399af5b..a2d8e28fa 100644 --- a/app/views/poll/republish_poll.js.erb +++ b/app/views/poll/republish_poll.js.erb @@ -1 +1,2 @@ -$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); \ No newline at end of file +$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); +alert("取消成功"); \ No newline at end of file diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index 4141164c4..e46aa5124 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -26,8 +26,8 @@ div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margi a.newbtn{ float:right; display:block; width:80px; height:30px; background:#64bdd9; color:#fff; font-size:14px; margin:10px; text-align:center;} 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;max-width: 350px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;} -.polls_title{ font-weight:bold; color:#3e6d8e;max-width: 350px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;} +a.polls_title{ font-weight:bold; color:#3e6d8e;max-width: 300px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;} +.polls_title{ font-weight:bold; color:#3e6d8e;max-width: 300px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;} a.pollsbtn{ display:block; width:66px; height:22px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;} a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;} .polls_date{ color:#666666;} @@ -134,3 +134,14 @@ a:hover.upload_btn_grey{background:#8a8a8a;} .upload_con a:hover{ text-decoration:none;} .polls_btn_box{ width:145px; margin:0 auto; padding-left:10px;} .polls_btn_box02{ width:80px; margin:0 auto; padding-left:10px;} + +/***新增20150120***/ +.pollsbtn_tip{ width:30px; height:17px; display:block;background:url(images/icons.png) 0 -417px no-repeat;padding-left:7px; color:#fff;} +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; } +.polls_title_w { width:330px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} +.polls_de_grey{ color:#b1b1b1;} +.ml5{ margin-left:5px;}