From 402dfc788fbd5840a34984eb7f942f013de2d08d Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 21 Jan 2015 09:55:40 +0800
Subject: [PATCH 01/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=BB=BA?=
=?UTF-8?q?=E9=97=AE=E5=8D=B7=E6=97=B6=E9=97=AE=E5=8D=B7=E5=90=8D=E7=A7=B0?=
=?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=BA=E7=A9=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/poll_controller.rb | 2 +-
app/views/poll/_show_head.html.erb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb
index 6890b8dd7..2fc586711 100644
--- a/app/controllers/poll_controller.rb
+++ b/app/controllers/poll_controller.rb
@@ -40,7 +40,7 @@ class PollController < ApplicationController
def new
if @course
option = {
- :polls_name => l(:label_poll_new),
+ :polls_name => "",
:polls_type => @course.class.to_s,
:polls_group_id => @course.id,
:polls_status => 1,
diff --git a/app/views/poll/_show_head.html.erb b/app/views/poll/_show_head.html.erb
index ce74dc10a..7ab16b24d 100644
--- a/app/views/poll/_show_head.html.erb
+++ b/app/views/poll/_show_head.html.erb
@@ -1,7 +1,7 @@
- <%= poll.polls_name%>
+ <%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
<%= @poll.polls_description%>
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 02/10] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E9=97=AE?=
=?UTF-8?q?=E5=8D=B7=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F?=
=?UTF-8?q?=202=E3=80=81=E9=97=AE=E5=8D=B7=E5=88=97=E8=A1=A8=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E5=8F=91=E5=B8=83=E9=97=AE=E5=8D=B7=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=203=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();" %>
取 消
-
-