From 7b9d88ecfeefd465be895efb398d961e6782be8b Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 20 Jan 2015 11:42:28 +0800
Subject: [PATCH 01/14] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E8=B0=83=E6=9F=A5?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=87=8D=E6=96=B0=E5=8F=91=E5=B8=83=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/poll_controller.rb | 20 +++++++++++--
app/views/poll/_poll.html.erb | 43 ++++++++++++++++++++++++++++
app/views/poll/index.html.erb | 39 +------------------------
app/views/poll/republish_poll.js.erb | 1 +
config/routes.rb | 1 +
5 files changed, 63 insertions(+), 41 deletions(-)
create mode 100644 app/views/poll/_poll.html.erb
create mode 100644 app/views/poll/republish_poll.js.erb
diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb
index 739adfe1c..6890b8dd7 100644
--- a/app/controllers/poll_controller.rb
+++ b/app/controllers/poll_controller.rb
@@ -1,8 +1,8 @@
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]
+ 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_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,:publish_poll]
+ before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll]
include PollHelper
def index
if @course
@@ -311,6 +311,19 @@ class PollController < ApplicationController
end
end
+ #重新发布问卷
+ def republish_poll
+ @poll.poll_questions.each do |poll_question|
+ poll_question.poll_votes.destroy_all
+ end
+ @poll.poll_users.destroy_all
+ @poll.polls_status = 1
+ @poll.save
+ respond_to do |format|
+ format.js
+ end
+ end
+
private
def find_poll_and_course
@poll = Poll.find params[:id]
@@ -337,7 +350,8 @@ class PollController < ApplicationController
end
def is_course_teacher
- render_403 unless(@course && User.current.allowed_to?(:as_teacher,@course))
+ @is_teacher = User.current.allowed_to?(:as_teacher,@course)
+ render_403 unless(@course && @is_teacher)
end
#获取未完成的题目
diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb
new file mode 100644
index 000000000..8ae766516
--- /dev/null
+++ b/app/views/poll/_poll.html.erb
@@ -0,0 +1,43 @@
+
+ <% if @is_teacher %>
+ <% if has_commit_poll?(poll.id ,User.current) %>
+ <%= poll.polls_name %>
+ <% else %>
+ <%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %>
+ <% end %>
+ <% else %>
+ <% if has_commit_poll?(poll.id ,User.current) && poll.polls_status == 2 %>
+
+ <%= 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" %>
+ <% 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"%>
+ <% end%>
+
+
+ <% if @is_teacher %>
+
+ <%= link_to(l(:button_delete), poll,
+ method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml20 mr10") %>
+ <% end%>
+
+
+ <% if @is_teacher && poll.polls_status == 1%>
+
+ <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml20"%>
+ <% end%>
+
+
+ <% if @is_teacher && poll.polls_status == 2%>
+ <%= link_to "重新发布", republish_poll_poll_path(poll.id), :remote => true, :class => 'polls_de fr ml20' %>
+ <% end %>
+
+
+ <%= format_time poll.created_at%>
+
\ No newline at end of file
diff --git a/app/views/poll/index.html.erb b/app/views/poll/index.html.erb
index e57674c7a..fa378fc7b 100644
--- a/app/views/poll/index.html.erb
+++ b/app/views/poll/index.html.erb
@@ -12,44 +12,7 @@
<% @polls.each do |poll|%>
- -
- <% if @is_teacher %>
- <% if has_commit_poll?(poll.id ,User.current) %>
- <%= poll.polls_name %>
- <% else %>
- <%= link_to poll.polls_name, poll_path(poll.id), :class => "polls_title fl" %>
- <% end %>
- <% else %>
- <% if has_commit_poll?(poll.id ,User.current) && poll.polls_status == 2 %>
-
- <%= 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" %>
- <% 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"%>
- <% end%>
-
- -
- <% if @is_teacher %>
-
- <%= link_to(l(:button_delete), poll,
- method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml20 mr10") %>
- <% end%>
-
- -
- <% if @is_teacher && poll.polls_status == 1%>
-
- <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml20"%>
- <% end%>
-
- -
- <%= format_time poll.created_at%>
-
+ <%= render :partial => 'poll', :locals => {:poll => poll} %>
<% end%>
diff --git a/app/views/poll/republish_poll.js.erb b/app/views/poll/republish_poll.js.erb
new file mode 100644
index 000000000..a7399af5b
--- /dev/null
+++ b/app/views/poll/republish_poll.js.erb
@@ -0,0 +1 @@
+$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index bd1b27dee..67b0118b0 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -65,6 +65,7 @@ RedmineApp::Application.routes.draw do
post 'create_poll_question'
post 'commit_poll'
get 'publish_poll'
+ get 'republish_poll'
end
collection do
delete 'delete_poll_question'
From 40d6c3b19cdb06be75220d60f9669ae592941681 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Tue, 20 Jan 2015 16:33:59 +0800
Subject: [PATCH 02/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E3=80=8A=E9=82=AE?=
=?UTF-8?q?=E7=AE=B1=E5=9C=B0=E5=9D=80=E9=AA=8C=E8=AF=81=E6=98=AF=E5=90=A6?=
=?UTF-8?q?=E5=AD=98=E5=9C=A8=E5=8F=8A=E5=9B=BD=E9=99=85=E5=8C=96=E7=9A=84?=
=?UTF-8?q?=E7=BC=96=E5=86=99=E3=80=8B=E5=8A=9F=E8=83=BD=20Signed-off-by:?=
=?UTF-8?q?=20alan=20<547533434@qq.com>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Gemfile | 4 +++-
app/controllers/account_controller.rb | 3 +++
app/models/user.rb | 2 +-
config/application.rb | 5 +++++
config/environments/development.rb | 2 +-
config/locales/en.yml | 11 +++++++++++
config/locales/zh.yml | 17 +++++++++++++++++
7 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index 6c2101345..5045cb822 100644
--- a/Gemfile
+++ b/Gemfile
@@ -18,6 +18,7 @@ gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet'
gem 'ruby-ole'
+gem 'email_verifier'
group :development do
gem 'better_errors', path: 'lib/better_errors'
@@ -51,7 +52,8 @@ group :development, :test do
gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/
gem 'pry'
gem 'pry-nav'
-
+ gem 'rspec-rails' , '2.13.1'
+ gem 'guard-rspec','2.5.0'
end
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 6c95294d7..69c2d3002 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -345,7 +345,10 @@ class AccountController < ApplicationController
if user.save and token.save
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
Mailer.register(token).deliver
+
+
flash[:notice] = l(:notice_account_register_done)
+
render action: 'email_valid', locals: {:mail => user.mail}
else
yield if block_given?
diff --git a/app/models/user.rb b/app/models/user.rb
index 52619b038..bef65fe54 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -188,7 +188,7 @@ class User < Principal
validates_confirmation_of :password, :allow_nil => true
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
validate :validate_password_length
-
+ validates_email_realness_of :mail
before_create :set_mail_notification
before_save :update_hashed_password
before_destroy :remove_references_before_destroy
diff --git a/config/application.rb b/config/application.rb
index d37a9eae2..716e3875d 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -16,6 +16,11 @@ module RedmineApp
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
+ # verifier if email is real
+ EmailVerifier.config do |config|
+ config.verifier_email = "lizanle521@126.com"
+ end
+
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W(#{config.root}/lib)
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 9d3cbf244..8bec9789c 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -13,7 +13,7 @@ RedmineApp::Application.configure do
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
- config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.raise_delivery_errors = true
config.active_support.deprecation = :log
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index dd79a546c..d25ba6ae2 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -71,6 +71,14 @@ en:
one: "almost 1 year"
other: "almost %{count} years"
+ errors:
+ messages:
+ email_verifier:
+ email_not_real: must point to a real mail account
+ out_of_mail_server: appears to point to dead mail server
+ no_mail_server: appears to point to domain which doesn't handle e-mail
+ failure: could not be checked if is real
+ exception: could not be sent
number:
format:
separator: "."
@@ -130,6 +138,9 @@ en:
circular_dependency: "This relation would create a circular dependency"
cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks"
+
+
+
actionview_instancetag_blank_option: Please select
attachment_all: "All"
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index ac7c52fe2..ea045f29b 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -2,6 +2,10 @@
# Chinese (China) translations for Ruby on Rails
# by tsechingho (http://github.com/tsechingho)
zh:
+
+
+
+
# Text direction: Left-to-Right (ltr) or Right-to-Left (rtl)
direction: ltr
jquery:
@@ -30,6 +34,17 @@ zh:
- :month
- :day
+
+ errors:
+ messages:
+ email_verifier:
+ email_not_real: 必须指定一个真实的邮箱地址
+ out_of_mail_server: 指向了一个已停用的邮箱服务器
+ no_mail_server: 域名地址没有邮件功能
+ failure: 邮箱地址不能被验证
+ exception: 邮箱不能发送成功
+
+
time:
formats:
default: "%Y年%b%d日 %A %H:%M:%S"
@@ -138,6 +153,8 @@ zh:
circular_dependency: "此关联将导致循环依赖"
cant_link_an_issue_with_a_descendant: "问题不能关联到它的子任务"
+
+
actionview_instancetag_blank_option: 请选择
attachment_all: "全部"
From 77cb2b08934bc5569c0e702db6ab06978665808f Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 20 Jan 2015 16:50:16 +0800
Subject: [PATCH 03/14] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=AD=A6=E7=94=9F?=
=?UTF-8?q?=E5=B7=B2=E5=AE=8C=E6=88=90=E7=9A=84=E9=97=AE=E5=8D=B7=E6=A0=87?=
=?UTF-8?q?=E9=A2=98=E8=BF=87=E9=95=BF=E6=97=B6=E6=98=BE=E7=A4=BA=E5=BC=82?=
=?UTF-8?q?=E5=B8=B8=202.=E5=A2=9E=E5=8A=A0=E5=8F=96=E6=B6=88=E5=8F=91?=
=?UTF-8?q?=E5=B8=83=E6=97=B6=E7=9A=84=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/poll/_poll.html.erb | 4 ++-
app/views/poll/_poll_republish.html.erb | 44 +++++++++++++++++++++++++
app/views/poll/index.html.erb | 27 +++++++++++++++
public/stylesheets/polls.css | 2 +-
4 files changed, 75 insertions(+), 2 deletions(-)
create mode 100644 app/views/poll/_poll_republish.html.erb
diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb
index 8ae766516..dea4e175b 100644
--- a/app/views/poll/_poll.html.erb
+++ b/app/views/poll/_poll.html.erb
@@ -35,7 +35,9 @@
<% if @is_teacher && poll.polls_status == 2%>
- <%= link_to "重新发布", republish_poll_poll_path(poll.id), :remote => true, :class => 'polls_de fr ml20' %>
+
+ 取消发布
+
<% end %>
diff --git a/app/views/poll/_poll_republish.html.erb b/app/views/poll/_poll_republish.html.erb
new file mode 100644
index 000000000..3688ba883
--- /dev/null
+++ b/app/views/poll/_poll_republish.html.erb
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+ 问卷取消发布后学生提交的问卷答案将会被清空,
+
+ 是否确定取消发布该问卷?
+
+
+ <%= link_to "确 定",republish_poll_poll_path(poll.id), :class => "upload_btn", :onclick => "clickCanel();" %>
+
+ 取 消
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/poll/index.html.erb b/app/views/poll/index.html.erb
index fa378fc7b..043e6898b 100644
--- a/app/views/poll/index.html.erb
+++ b/app/views/poll/index.html.erb
@@ -1,4 +1,31 @@
<%= stylesheet_link_tag 'polls', :media => 'all' %>
+
所有问卷
diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css
index 58ae913b0..4141164c4 100644
--- a/public/stylesheets/polls.css
+++ b/public/stylesheets/polls.css
@@ -27,7 +27,7 @@ a.newbtn{ float:right; display:block; width:80px; height:30px; background:#64bdd
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;}
+.polls_title{ font-weight:bold; color:#3e6d8e;max-width: 350px;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;}
From f3062da237ba7a010bc708a1a119a3ab4149b93c Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 21 Jan 2015 09:18:29 +0800
Subject: [PATCH 04/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A9=BA=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E6=97=B6=EF=BC=8C=E8=AF=BE=E7=A8=8B=E9=A6=96=E9=A1=B5?=
=?UTF-8?q?=E6=97=A0=E6=B3=95=E5=8A=A0=E8=BD=BD(=E5=B1=85=E7=84=B6?=
=?UTF-8?q?=E6=98=AF=E6=AD=BB=E5=BE=AA=E7=8E=AF=E3=80=82=E3=80=82=E3=80=82?=
=?UTF-8?q?)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/welcome/course.html.erb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index 927734b24..d427a9aea 100644
--- a/app/views/welcome/course.html.erb
+++ b/app/views/welcome/course.html.erb
@@ -122,6 +122,7 @@
else
course_term = "春季学期"
end%>
+ <%break if Time.new.strftime("%Y").to_i - year_now >= 2%>
<% all_new_hot_course += find_all_new_hot_course(course_count-all_new_hot_course.count, @school_id, year_now, course_term)%>
<% end%>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
@@ -152,6 +153,7 @@
else
course_term = "春季学期"
end%>
+ <%break if Time.new.strftime("%Y").to_i - year_now >= 2%>
<% all_new_hot_course += find_all_new_hot_course(9-(all_new_hot_course.count + cur_school_course.count), @school_id, year_now, course_term)%>
<% end%>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
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 05/14] =?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 06/14] =?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();" %>
取 消
-
-