Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
0c0160ac2b
4
Gemfile
4
Gemfile
|
@ -18,6 +18,7 @@ gem "builder", "3.0.0"
|
||||||
gem 'acts-as-taggable-on', '2.4.1'
|
gem 'acts-as-taggable-on', '2.4.1'
|
||||||
gem 'spreadsheet'
|
gem 'spreadsheet'
|
||||||
gem 'ruby-ole'
|
gem 'ruby-ole'
|
||||||
|
gem 'email_verifier'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem 'better_errors', path: 'lib/better_errors'
|
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 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/
|
||||||
gem 'pry'
|
gem 'pry'
|
||||||
gem 'pry-nav'
|
gem 'pry-nav'
|
||||||
|
gem 'rspec-rails' , '2.13.1'
|
||||||
|
gem 'guard-rspec','2.5.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -345,7 +345,10 @@ class AccountController < ApplicationController
|
||||||
if user.save and token.save
|
if user.save and token.save
|
||||||
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||||
Mailer.register(token).deliver
|
Mailer.register(token).deliver
|
||||||
|
|
||||||
|
|
||||||
flash[:notice] = l(:notice_account_register_done)
|
flash[:notice] = l(:notice_account_register_done)
|
||||||
|
|
||||||
render action: 'email_valid', locals: {:mail => user.mail}
|
render action: 'email_valid', locals: {:mail => user.mail}
|
||||||
else
|
else
|
||||||
yield if block_given?
|
yield if block_given?
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class PollController < ApplicationController
|
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 :find_container, :only => [:new,:create, :index]
|
||||||
before_filter :is_member_of_course, :only => [:index,:show]
|
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
|
include PollHelper
|
||||||
def index
|
def index
|
||||||
if @course
|
if @course
|
||||||
|
@ -40,7 +40,7 @@ class PollController < ApplicationController
|
||||||
def new
|
def new
|
||||||
if @course
|
if @course
|
||||||
option = {
|
option = {
|
||||||
:polls_name => l(:label_poll_new),
|
:polls_name => "",
|
||||||
:polls_type => @course.class.to_s,
|
:polls_type => @course.class.to_s,
|
||||||
:polls_group_id => @course.id,
|
:polls_group_id => @course.id,
|
||||||
:polls_status => 1,
|
:polls_status => 1,
|
||||||
|
@ -187,7 +187,13 @@ class PollController < ApplicationController
|
||||||
@poll.polls_status = 2
|
@poll.polls_status = 2
|
||||||
@poll.published_at = Time.now
|
@poll.published_at = Time.now
|
||||||
if @poll.save
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -311,6 +317,19 @@ class PollController < ApplicationController
|
||||||
end
|
end
|
||||||
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
|
private
|
||||||
def find_poll_and_course
|
def find_poll_and_course
|
||||||
@poll = Poll.find params[:id]
|
@poll = Poll.find params[:id]
|
||||||
|
@ -337,7 +356,8 @@ class PollController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_course_teacher
|
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
|
end
|
||||||
|
|
||||||
#获取未完成的题目
|
#获取未完成的题目
|
||||||
|
|
|
@ -558,6 +558,11 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
# Show @project
|
# Show @project
|
||||||
def show
|
def show
|
||||||
|
if(@project && !@project.is_public && !User.current.member_of?(@project))
|
||||||
|
render_403
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
@project_type = params[:project_type]
|
@project_type = params[:project_type]
|
||||||
|
|
||||||
# try to redirect to the requested menu item
|
# try to redirect to the requested menu item
|
||||||
|
|
|
@ -111,6 +111,10 @@ module CoursesHelper
|
||||||
#garble count
|
#garble count
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
#获取课程所有成员
|
||||||
|
def course_member course
|
||||||
|
course.members
|
||||||
|
end
|
||||||
# 学生人数计算
|
# 学生人数计算
|
||||||
# add by nwb
|
# add by nwb
|
||||||
def studentCount course
|
def studentCount course
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# Added by young
|
# Added by young
|
||||||
class JournalsForMessageObserver < ActiveRecord::Observer
|
class JournalsForMessageObserver < ActiveRecord::Observer
|
||||||
def after_create(journals_for_message)
|
def after_create(journals_for_message)
|
||||||
|
thread1 = Thread.start do
|
||||||
Mailer.journals_for_message_add(User.current, journals_for_message).deliver
|
Mailer.journals_for_message_add(User.current, journals_for_message).deliver
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -62,13 +62,13 @@ class Mailer < ActionMailer::Base
|
||||||
course = journals_for_message.jour
|
course = journals_for_message.jour
|
||||||
@author = journals_for_message.user
|
@author = journals_for_message.user
|
||||||
#课程的教师
|
#课程的教师
|
||||||
@teachers = searchTeacherAndAssistant journals_for_message.jour
|
@members = course_member journals_for_message.jour
|
||||||
#收件人邮箱
|
#收件人邮箱
|
||||||
@recipients ||= []
|
@recipients ||= []
|
||||||
@teachers.each do |teacher|
|
@members.each do |teacher|
|
||||||
if teacher.user.notify_about? journals_for_message
|
|
||||||
@recipients << teacher.user.mail
|
@recipients << teacher.user.mail
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
mail :to => @recipients,
|
mail :to => @recipients,
|
||||||
|
|
|
@ -188,7 +188,7 @@ class User < Principal
|
||||||
validates_confirmation_of :password, :allow_nil => true
|
validates_confirmation_of :password, :allow_nil => true
|
||||||
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
|
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
|
||||||
validate :validate_password_length
|
validate :validate_password_length
|
||||||
|
validates_email_realness_of :mail
|
||||||
before_create :set_mail_notification
|
before_create :set_mail_notification
|
||||||
before_save :update_hashed_password
|
before_save :update_hashed_password
|
||||||
before_destroy :remove_references_before_destroy
|
before_destroy :remove_references_before_destroy
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
</script>
|
</script>
|
||||||
<%= stylesheet_link_tag 'course_group', :media => 'all' %>
|
<%= stylesheet_link_tag 'course_group', :media => 'all' %>
|
||||||
<script type="text/javascript" src="javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js"></script>
|
<script type="text/javascript" src="javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js"></script>
|
||||||
<div class="st_list">
|
<div class="st_list" id="member_of_course">
|
||||||
<div class="st_search" style="margin-left: 14px" >
|
<div class="st_search" style="margin-left: 14px" >
|
||||||
<span class="f_l"><%= @subPage_title %></span>
|
<span class="f_l"><%= @subPage_title %></span>
|
||||||
<span id = "search_members">
|
<span id = "search_members">
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<div class="ur_editor checkbox">
|
<div class="ur_editor checkbox">
|
||||||
<div class="ur_editor_title">
|
<div class="ur_editor_title">
|
||||||
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
|
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
|
||||||
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入单选题标题" value="<%= poll_question.question_title%>"/>
|
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多选题标题" value="<%= poll_question.question_title%>"/>
|
||||||
<input type="checkbox" name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
|
<input type="checkbox" name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
|
||||||
<label>必答</label>
|
<label>必答</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="ur_editor_title">
|
<div class="ur_editor_title">
|
||||||
<label>问题: </label>
|
<label>问题: </label>
|
||||||
<input type="hidden" name="question_type" value="2"/>
|
<input type="hidden" name="question_type" value="2"/>
|
||||||
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题题标题"/>
|
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题标题"/>
|
||||||
<input type="checkbox" name="is_necessary" value="true" checked/>
|
<input type="checkbox" name="is_necessary" value="true" checked/>
|
||||||
<label>必答</label>
|
<label>必答</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
<% has_commit = has_commit_poll?(poll.id ,User.current)%>
|
||||||
|
<li title="<%= poll.polls_name %>">
|
||||||
|
<% if @is_teacher %>
|
||||||
|
<% if has_commit %>
|
||||||
|
<sapn class="polls_title fl">
|
||||||
|
<%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
|
||||||
|
</sapn>
|
||||||
|
<% else %>
|
||||||
|
<%= 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.polls_status == 2 %>
|
||||||
|
<sapn class="polls_title fl" style="max-width: 500px;">
|
||||||
|
<%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name %>
|
||||||
|
</sapn>
|
||||||
|
<% 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", :style => "max-width: 550px;width: 550px;" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% if !@is_teacher && has_commit && poll.polls_status == 2%>
|
||||||
|
<li class="pollsbtn_tip fl ml5">已答</li>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%if @is_teacher%>
|
||||||
|
<% if poll.polls_status == 1 %>
|
||||||
|
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
|
||||||
|
<% elsif poll.polls_status == 2%>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
|
||||||
|
</li>
|
||||||
|
<% end%>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<%if @is_teacher %>
|
||||||
|
<% if poll.polls_status == 1 %>
|
||||||
|
<a href="#" class="pollsbtn btn_pu fl ml5" onclick="poll_submit(<%= poll.id%>);">发布问卷</a>
|
||||||
|
<% elsif poll.polls_status == 2%>
|
||||||
|
<a href="#" class="pollsbtn btn_de fl ml5" onclick="republish_poll(<%= poll.id%>);">取消发布</a>
|
||||||
|
<% end%>
|
||||||
|
<% end%>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<% 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%>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<% 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%>
|
||||||
|
<li class="polls_de_grey fr ml20">编辑</li>
|
||||||
|
<% end%>
|
||||||
|
<% end%>
|
||||||
|
</li>
|
||||||
|
<!--<li>-->
|
||||||
|
<!--<% if @is_teacher && poll.polls_status == 2%>-->
|
||||||
|
<!--<a class="polls_de fr ml20" onclick="republish_poll(<%= poll.id%>);">-->
|
||||||
|
<!--取消发布-->
|
||||||
|
<!--</a>-->
|
||||||
|
<!--<% end %>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<li class="polls_date fr mr10">
|
||||||
|
<%= format_time poll.created_at%>
|
||||||
|
</li>
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
function poll_submit()
|
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');
|
showModal('ajax-modal', '310px');
|
||||||
$('#ajax-modal').css('height','110px');
|
$('#ajax-modal').css('height','110px');
|
||||||
$('#ajax-modal').siblings().remove();
|
$('#ajax-modal').siblings().remove();
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
function clickCanel(){hideModal("#popbox02");}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="popbox02">
|
||||||
|
<div class="upload_con">
|
||||||
|
<div class="upload_box">
|
||||||
|
<p class="polls_box_p">
|
||||||
|
问卷取消发布后学生提交的问卷答案将会被清空,
|
||||||
|
<br />
|
||||||
|
是否确定取消发布该问卷?
|
||||||
|
</p>
|
||||||
|
<div class="polls_btn_box">
|
||||||
|
<%= link_to "确 定",republish_poll_poll_path(poll.id), :class => "upload_btn", :onclick => "clickCanel();" %>
|
||||||
|
<a class="upload_btn upload_btn_grey" onclick="clickCanel();">
|
||||||
|
取 消
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
@ -2,18 +2,6 @@
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function clickPublishPoll()
|
|
||||||
{
|
|
||||||
hideModal("#popbox02");
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: "<%= publish_poll_poll_path(poll.id)%>",
|
|
||||||
data: 'text',
|
|
||||||
success: function (data) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function clickCanel(){hideModal("#popbox02");}
|
function clickCanel(){hideModal("#popbox02");}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -27,16 +15,14 @@
|
||||||
是否确定发布该问卷?
|
是否确定发布该问卷?
|
||||||
</p>
|
</p>
|
||||||
<div class="polls_btn_box">
|
<div class="polls_btn_box">
|
||||||
<%= 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();" %>
|
||||||
<a class="upload_btn upload_btn_grey" onclick="clickCanel();">
|
<a class="upload_btn upload_btn_grey" onclick="clickCanel();">
|
||||||
取 消
|
取 消
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="ur_page_head ur_editor02"><!--头部显示 start-->
|
<div class="ur_page_head ur_editor02"><!--头部显示 start-->
|
||||||
<a href="#" class="ur_icon_edit" title="编辑" onclick="pollsEdit();"></a>
|
<a href="#" class="ur_icon_edit" title="编辑" onclick="pollsEdit();"></a>
|
||||||
<h1 class="ur_page_title" id="polls_name_h">
|
<h1 class="ur_page_title" id="polls_name_h">
|
||||||
<%= poll.polls_name%>
|
<%= poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
|
||||||
</h1>
|
</h1>
|
||||||
<p class="ur_prefix_content" id="polls_description_p">
|
<p class="ur_prefix_content" id="polls_description_p">
|
||||||
<%= @poll.polls_description%>
|
<%= @poll.polls_description%>
|
||||||
|
|
|
@ -1,4 +1,55 @@
|
||||||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function republish_poll(poll_id)
|
||||||
|
{
|
||||||
|
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||||
|
"<div class='upload_con'>" +
|
||||||
|
"<div class='upload_box'>" +
|
||||||
|
"<p class='polls_box_p'>取消发布后问卷统计结果将会被清空<br />是否确定取消发布该问卷?</p>" +
|
||||||
|
"<div class='polls_btn_box'>" +
|
||||||
|
"<a href='/poll/"+ poll_id +"/republish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||||
|
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div class='cl'></div>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>");
|
||||||
|
showModal('ajax-modal', '310px');
|
||||||
|
$('#ajax-modal').css('height','110px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||||
|
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
}
|
||||||
|
|
||||||
|
function clickCanel(){hideModal("#popbox02");}
|
||||||
|
|
||||||
|
function poll_submit(poll_id)
|
||||||
|
{
|
||||||
|
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||||
|
"<div class='upload_con'>" +
|
||||||
|
"<div class='upload_box'>" +
|
||||||
|
"<p class='polls_box_p'>问卷发布后将不能对问卷进行修改,<br />是否确定发布该问卷?</p>" +
|
||||||
|
"<div class='polls_btn_box'>" +
|
||||||
|
"<a href='/poll/"+ poll_id +"/publish_poll' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||||
|
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div class='cl'></div>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>");
|
||||||
|
showModal('ajax-modal', '310px');
|
||||||
|
$('#ajax-modal').css('height','110px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||||
|
"<a href='#' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<div class="polls_content" id="polls" style="width:677px;">
|
<div class="polls_content" id="polls" style="width:677px;">
|
||||||
<div class="polls_head">
|
<div class="polls_head">
|
||||||
<h2>所有问卷
|
<h2>所有问卷
|
||||||
|
@ -12,44 +63,7 @@
|
||||||
<div class="polls_list">
|
<div class="polls_list">
|
||||||
<% @polls.each do |poll|%>
|
<% @polls.each do |poll|%>
|
||||||
<ul id="polls_<%= poll.id %>">
|
<ul id="polls_<%= poll.id %>">
|
||||||
<li title="<%= poll.polls_name %>">
|
<%= render :partial => 'poll', :locals => {:poll => poll} %>
|
||||||
<% if @is_teacher %>
|
|
||||||
<% if has_commit_poll?(poll.id ,User.current) %>
|
|
||||||
<sapn class="polls_title fl"> <%= poll.polls_name %></sapn>
|
|
||||||
<% 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 %>
|
|
||||||
<sapn class="polls_title fl" >
|
|
||||||
<%= poll.polls_name %>
|
|
||||||
</sapn>
|
|
||||||
<% 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 %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<%if @is_teacher && poll.polls_status == 2%>
|
|
||||||
<%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
|
|
||||||
<% end%>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<% 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%>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<% if @is_teacher && poll.polls_status == 1%>
|
|
||||||
<!--新建状态的问卷可编辑-->
|
|
||||||
<%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml20"%>
|
|
||||||
<% end%>
|
|
||||||
</li>
|
|
||||||
<li class="polls_date fr">
|
|
||||||
<%= format_time poll.created_at%>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<% end%>
|
<% end%>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
|
||||||
|
alert("发布成功");
|
|
@ -0,0 +1,2 @@
|
||||||
|
$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
|
||||||
|
alert("取消成功");
|
|
@ -122,6 +122,7 @@
|
||||||
else
|
else
|
||||||
course_term = "春季学期"
|
course_term = "春季学期"
|
||||||
end%>
|
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)%>
|
<% all_new_hot_course += find_all_new_hot_course(course_count-all_new_hot_course.count, @school_id, year_now, course_term)%>
|
||||||
<% end%>
|
<% end%>
|
||||||
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
|
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
|
||||||
|
@ -152,6 +153,7 @@
|
||||||
else
|
else
|
||||||
course_term = "春季学期"
|
course_term = "春季学期"
|
||||||
end%>
|
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)%>
|
<% 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%>
|
<% end%>
|
||||||
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
|
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
|
||||||
|
|
|
@ -16,6 +16,21 @@ module RedmineApp
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration should go into files in config/initializers
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- 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
|
||||||
|
|
||||||
|
config.generators do |g|
|
||||||
|
g.test_framework :rspec,
|
||||||
|
fixtures: true,
|
||||||
|
view_specs: false,
|
||||||
|
helper_specs: false,
|
||||||
|
routing_specs: false,
|
||||||
|
controller_specs: true,
|
||||||
|
request_specs: false
|
||||||
|
g.fixture_replacement :factory_girl, dir: "spec/factories"
|
||||||
|
end
|
||||||
# Custom directories with classes and modules you want to be autoloadable.
|
# Custom directories with classes and modules you want to be autoloadable.
|
||||||
config.autoload_paths += %W(#{config.root}/lib)
|
config.autoload_paths += %W(#{config.root}/lib)
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ RedmineApp::Application.configure do
|
||||||
config.action_controller.perform_caching = false
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
# Don't care if the mailer can't send
|
# 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
|
config.active_support.deprecation = :log
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,6 +71,14 @@ en:
|
||||||
one: "almost 1 year"
|
one: "almost 1 year"
|
||||||
other: "almost %{count} years"
|
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:
|
number:
|
||||||
format:
|
format:
|
||||||
separator: "."
|
separator: "."
|
||||||
|
@ -130,6 +138,9 @@ en:
|
||||||
circular_dependency: "This relation would create a circular dependency"
|
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"
|
cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
actionview_instancetag_blank_option: Please select
|
actionview_instancetag_blank_option: Please select
|
||||||
|
|
||||||
attachment_all: "All"
|
attachment_all: "All"
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
# Chinese (China) translations for Ruby on Rails
|
# Chinese (China) translations for Ruby on Rails
|
||||||
# by tsechingho (http://github.com/tsechingho)
|
# by tsechingho (http://github.com/tsechingho)
|
||||||
zh:
|
zh:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Text direction: Left-to-Right (ltr) or Right-to-Left (rtl)
|
# Text direction: Left-to-Right (ltr) or Right-to-Left (rtl)
|
||||||
direction: ltr
|
direction: ltr
|
||||||
jquery:
|
jquery:
|
||||||
|
@ -30,6 +34,17 @@ zh:
|
||||||
- :month
|
- :month
|
||||||
- :day
|
- :day
|
||||||
|
|
||||||
|
|
||||||
|
errors:
|
||||||
|
messages:
|
||||||
|
email_verifier:
|
||||||
|
email_not_real: 必须指定一个真实的邮箱地址
|
||||||
|
out_of_mail_server: 指向了一个已停用的邮箱服务器
|
||||||
|
no_mail_server: 域名地址没有邮件功能
|
||||||
|
failure: 邮箱地址不能被验证
|
||||||
|
exception: 邮箱不能发送成功
|
||||||
|
|
||||||
|
|
||||||
time:
|
time:
|
||||||
formats:
|
formats:
|
||||||
default: "%Y年%b%d日 %A %H:%M:%S"
|
default: "%Y年%b%d日 %A %H:%M:%S"
|
||||||
|
@ -138,6 +153,8 @@ zh:
|
||||||
circular_dependency: "此关联将导致循环依赖"
|
circular_dependency: "此关联将导致循环依赖"
|
||||||
cant_link_an_issue_with_a_descendant: "问题不能关联到它的子任务"
|
cant_link_an_issue_with_a_descendant: "问题不能关联到它的子任务"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
actionview_instancetag_blank_option: 请选择
|
actionview_instancetag_blank_option: 请选择
|
||||||
|
|
||||||
attachment_all: "全部"
|
attachment_all: "全部"
|
||||||
|
|
|
@ -65,6 +65,7 @@ RedmineApp::Application.routes.draw do
|
||||||
post 'create_poll_question'
|
post 'create_poll_question'
|
||||||
post 'commit_poll'
|
post 'commit_poll'
|
||||||
get 'publish_poll'
|
get 'publish_poll'
|
||||||
|
get 'republish_poll'
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
delete 'delete_poll_question'
|
delete 'delete_poll_question'
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
class AddInitialProducts < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
Forum.create(:name =>"new forum", :description => "", :topic_count => "0",
|
||||||
|
:memo_count => "0", :last_memo_id =>"0", :creator_id =>"2",
|
||||||
|
:sticky =>"0", :locked =>"0")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20150114022710) do
|
ActiveRecord::Schema.define(:version => 20150121030451) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
|
#member_of_course{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
|
||||||
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea,form{ margin:0; padding:0;}
|
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea,form{ margin:0; padding:0;}
|
||||||
div,img,tr,td,textarea,form{ border:0;}
|
div,img,tr,td,textarea,form{ border:0;}
|
||||||
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
|
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.4 KiB |
|
@ -19,15 +19,15 @@ div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margi
|
||||||
.polls_btn span{ color:#15bed1; font-size:12px; font-weight:normal;}
|
.polls_btn span{ color:#15bed1; font-size:12px; font-weight:normal;}
|
||||||
|
|
||||||
/*问卷列表*/
|
/*问卷列表*/
|
||||||
.polls_content{ width:615px;}
|
.polls_content{ width:615px;padding-left: 6px;}
|
||||||
.polls_head{ width:677px; height:48px; background:#eaeaea;}
|
.polls_head{ width:677px; height:48px; background:#eaeaea;}
|
||||||
.polls_head h2{ float:left; font-size:14px; color:#585858; margin:11px 0 0 10px;}
|
.polls_head h2{ float:left; font-size:14px; color:#585858; margin:11px 0 0 10px;}
|
||||||
.polls_head span{ font-weight:normal; color:#15bccf;}
|
.polls_head span{ font-weight:normal; color:#15bccf;}
|
||||||
a.newbtn{ float:right; display:block; width:80px; height:30px; background:#64bdd9; color:#fff; font-size:14px; margin:10px; text-align:center;}
|
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;}
|
a:hover.newbtn{ background:#55a1b9; text-decoration:none;}
|
||||||
.polls_list ul{ padding-left:10px; border-bottom:1px dashed #c9c9c9; height:32px; padding-top:8px;}
|
.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;}
|
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;}
|
.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.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;}
|
a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;}
|
||||||
.polls_date{ color:#666666;}
|
.polls_date{ color:#666666;}
|
||||||
|
@ -134,3 +134,14 @@ a:hover.upload_btn_grey{background:#8a8a8a;}
|
||||||
.upload_con a:hover{ text-decoration:none;}
|
.upload_con a:hover{ text-decoration:none;}
|
||||||
.polls_btn_box{ width:145px; margin:0 auto; padding-left:10px;}
|
.polls_btn_box{ width:145px; margin:0 auto; padding-left:10px;}
|
||||||
.polls_btn_box02{ width:80px; 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 -372px 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;}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
|
ENV["RAILS_ENV"] ||= 'test'
|
||||||
|
require File.expand_path("../../config/environment", __FILE__)
|
||||||
|
require 'rspec/rails'
|
||||||
|
require 'rspec/autorun'
|
||||||
|
|
||||||
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
|
# in spec/support/ and its subdirectories.
|
||||||
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
# ## Mock Framework
|
||||||
|
#
|
||||||
|
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||||
|
#
|
||||||
|
# config.mock_with :mocha
|
||||||
|
# config.mock_with :flexmock
|
||||||
|
# config.mock_with :rr
|
||||||
|
|
||||||
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||||
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
|
||||||
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||||
|
# examples within a transaction, remove the following line or assign false
|
||||||
|
# instead of true.
|
||||||
|
config.use_transactional_fixtures = true
|
||||||
|
|
||||||
|
# If true, the base class of anonymous controllers will be inferred
|
||||||
|
# automatically. This will be the default behavior in future versions of
|
||||||
|
# rspec-rails.
|
||||||
|
config.infer_base_class_for_anonymous_controllers = false
|
||||||
|
|
||||||
|
# Run specs in random order to surface order dependencies. If you find an
|
||||||
|
# order dependency and want to debug it, you can fix the order by providing
|
||||||
|
# the seed, which is printed after each run.
|
||||||
|
# --seed 1234
|
||||||
|
config.order = "random"
|
||||||
|
end
|
Loading…
Reference in New Issue