Merge branch 'develop' into rep_quality

This commit is contained in:
huang 2016-08-12 17:14:18 +08:00
commit 75971120f7
14 changed files with 34 additions and 23 deletions

View File

@ -61,7 +61,7 @@ class AdminController < ApplicationController
if params[:syllabus_id] && params[:course_id]
course = Course.where("id = #{params[:course_id].to_i}").first
unless course.nil?
course.update_column('syllabus_id', params[:syllabus_id].to_i)
course.update_attribute(:syllabus_id, params[:syllabus_id].to_i)
@flag = true
end
end
@ -82,7 +82,7 @@ class AdminController < ApplicationController
syllabus.update_attributes(:title => params[:title], :eng_name => params[:eng_name], :user_id => @user.id)
syllabus.description = Message.where("id = 19412").first.nil? ? nil : Message.where("id = 19412").first.content
if syllabus.save
course.update_column('syllabus_id', syllabus.id)
course.update_attribute(:syllabus_id, params[:syllabus_id].to_i)
@flag = params[:flag].to_i
@course = course
respond_to do |format|

View File

@ -599,7 +599,7 @@ class UsersController < ApplicationController
if(params[:type].blank? || params[:type] == "1") #我的题库
courses = @user.courses.where("is_delete = 1")
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and course_id not in #{course_ids}").order("#{@order} #{@b_sort}")
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids}").order("#{@order} #{@b_sort}")
elsif params[:type] == "2" #公共题库
visible_course = Course.where("is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
@ -1460,6 +1460,7 @@ class UsersController < ApplicationController
def user_projects4show
@page = params[:page].to_i + 1
@projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10).offset(@page * 10)
@all_count = @user.projects.visible.count
end
def user_course_activities
@ -1533,7 +1534,7 @@ class UsersController < ApplicationController
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
@receive_homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc").limit(5)
if (@manage_homeworks.empty? && @receive_homeworks.empty?) || (@receive_homeworks.empty?) || (!@manage_homeworks.empty? && !@receive_homeworks.empty? && @manage_homeworks.first.publish_time > @receive_homeworks.first.publish_time)
if (@manage_homeworks.empty? && @receive_homeworks.empty?) || (@receive_homeworks.empty?) || (!@manage_homeworks.empty? && !@receive_homeworks.empty? && @manage_homeworks.first.created_at > @receive_homeworks.first.created_at)
@manage_pre = true
else
@manage_pre = false

View File

@ -2841,7 +2841,7 @@ module ApplicationHelper
#获取当前作业的提交截止时间/互评截止时间
def cur_homework_end_time homework
str = ""
if homework.anonymous_comment == 0 && homework.end_time < Date.today && homework.homework_detail_manual
if homework.anonymous_comment == 0 && homework.end_time && homework.end_time < Date.today && homework.homework_detail_manual
str = "互评截止:#{format_date homework.homework_detail_manual.evaluation_end}"
else
str = "提交截止:#{homework.end_time ? (format_date homework.end_time) : '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'}"

View File

@ -80,6 +80,7 @@ class Course < ActiveRecord::Base
after_update :update_files_public,:update_course_ealasticsearch_index
after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index
before_destroy :delete_all_members,:delete_course_ealasticsearch_index
after_save :log_infor
safe_attributes 'extra',
'time',
@ -504,6 +505,10 @@ class Course < ActiveRecord::Base
ticket
end
def log_infor
Rails.logger.info "##########################################################course's syllabus_id is #{self.syllabus_id}."
end
end

View File

@ -2,5 +2,5 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_su
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().css("top","30%").css("left","40%").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");

View File

@ -3,6 +3,8 @@
<% student_num = studentCount(@course) %>
<% course_file_num = visable_attachemnts_incourse(@course).count %>
<p class="sy_cgrey mb10">
<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cgrey') %>
&nbsp;&gt;&nbsp;
<% if @course.syllabus %>
<%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %>
&nbsp;&gt;&nbsp;
@ -17,7 +19,9 @@
<ul class="sy_class_setting_text">
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "sy_class_option" %></li>
<li><%= link_to "复制班级", copy_course_course_path(@course.id),:remote=>true, :class => "sy_class_option" %></li>
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "sy_class_option", :target => "_blank" %></li>
<% if @course.syllabus %>
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "sy_class_option", :target => "_blank" %></li>
<% end %>
</ul>
</li>
</ul>

View File

@ -175,17 +175,17 @@
</li>
<% if is_current_user %>
<li id="user_02" class="user_icons_new">
<%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank"%>
<%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_03" class="user_icons_new">
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank"%>
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_04" class="user_icons_addclass">
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true, :method => "post"%>
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true, :method => "post", :style => "font-size:14px;" %>
</li>
<% if @user == User.current %>
<li id="user_05" class="user_icons_myhw">
<%=link_to '我的作业', my_homeworks_user_path(@user.id), :target => "_blank" %>
<%=link_to '我的作业', my_homeworks_user_path(@user.id), :target => "_blank", :style => "font-size:14px;" %>
</li>
<% end %>
<% end %>
@ -212,10 +212,10 @@
</li>
<% if is_current_user %>
<li id="user_07" class="user_icons_new">
<%= link_to "新建项目", new_project_path(:host=> Setting.host_name), :target => "_blank"%>
<%= link_to "新建项目", new_project_path(:host=> Setting.host_name), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_08" class="user_icons_addproject">
<%= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post"%>
<%= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :style => "font-size:14px;" %>
</li>
<!--<li id="user_09" class="user_icons_myissues">-->
<!--<a href="#user_09" >我的任务</a>-->

View File

@ -1,4 +1,4 @@
<div class="hw_popup_box">
<div class="hw_popup_box" style="padding-bottom:30px;">
<div class="hw_popup_top clear">
<a href="javascript:void(0);" class="hw_icons_close fr" style="outline: none;" onclick="hideModal()"></a>
</div>

View File

@ -601,7 +601,7 @@
</p>
<p>申请班级:<%= Course.find(ma.course_id).name%></p>
<div class="fl">班级描述:</div>
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe %></div>
<div class="ml60"><%= Course.find(ma.course_id).description.nil? ? "" : Course.find(ma.course_id).description.html_safe %></div>
<p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -3,5 +3,5 @@
$("#choose_courses_notice").html("");
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'users/homework_repository_detail') %>";
pop_box_new(htmlvalue,820,155);
pop_box_new(htmlvalue,820,800);
<% end %>

View File

@ -1 +1 @@
$("#user_show_more_project").replaceWith("<%= escape_javascript( render :partial => 'layouts/user_projects',:locals => {:projects => @projects,:user => @user, :page => @page} )%>");
$("#user_show_more_project").replaceWith("<%= escape_javascript( render :partial => 'layouts/user_projects',:locals => {:projects => @projects,:user => @user, :page => @page, :all_count => @all_count} )%>");

View File

@ -1495,12 +1495,12 @@ function pop_up_box(value,tWidth,tTop,tLeft){
// 公共弹框样式
function pop_box_new(value, Width, Height){
w = ($(window).width() - Width)/2;
h = ($(window).height() - Height)/2 - 100;
h = ($(window).height() - Height)/2;
$("#ajax-modal").html(value);
showModal('ajax-modal', Width + 'px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed"});
$('#ajax-modal').css({"padding":"0"});
$('#ajax-modal').css({"padding":"0","overflow":"hidden"});
$('#ajax-modal').parent().attr("id","popupWrap");
//拖拽

View File

@ -234,7 +234,7 @@ a.sy_icons_close{
.hw_popup_top a.hw_icons_close{display:block;width:26px; height:26px;background: url(../images/hw/icons_hw.png) 0 -95px no-repeat; transition: all 0s linear;}
.hw_popup_top a:hover.hw_icons_close{background: url(../images/hw/icons_hw.png) -41px -95px no-repeat; }
.hw_popup_con{ width:770px; max-height:770px; margin:0 auto;}
.hw_popup_txt{width:770px; max-height:700px; margin:15px auto;overflow:auto;}
.hw_popup_txt{width:770px; max-height:680px; margin:15px auto;overflow:auto;}
/* 题库发送弹框 */
.hw_sendpopup_box{ width:460px;background:#fff;padding-bottom:15px;-webkit-border-radius:5px;-moz-border-radius:5px;-o-border-radius:5px;border-radius:5px;-webkit-box-shadow: 0px 0px 8px rgba(146, 153, 169, 0.5);-moz-box-shadow: 0px 0px 8px rgba(146, 153, 169, 0.5);box-shadow: 0px 0px 8px rgba(146, 153, 169, 0.5);}
.hw_sendpopup_top{background:#3b94d6;height:40px;-webkit-border-radius: 5px 5px 0px 0px;-o-border-radius: 5px 5px 0px 0px;border-radius: 5px 5px 0px 0px;}

View File

@ -324,9 +324,10 @@ a.sy_class_option:hover {
height:110px;
}
.sy_class_id{
width:110px;
height:80px;
background:#f1f1f1;
width:108px;
height:78px;
border:1px solid #f1f1f1;
background:#fff;
text-align:center;
padding-top:30px;
}