Merge branch 'develop' into 'develop'

bug修复



See merge request !136
This commit is contained in:
陈晓婷 2017-01-20 17:00:26 +08:00
commit 3a8769bbbc
18 changed files with 80 additions and 5244 deletions

View File

@ -474,8 +474,10 @@ class ApplicationController < ActionController::Base
render_404 unless @object.present?
@project = @object.project
if @project == nil && @object.has_attribute?('course_id')
if @project == nil && !@object.course_id.nil?
@course = @object.course
else
@contest = @object.contest
end
end

View File

@ -113,6 +113,8 @@ class BoardsController < ApplicationController
ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true)
elsif @course
CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true)
elsif @contest
ContestMessage.where("user_id =? and contest_id =? and viewed =?", User.current.id, @contest.id, 0).update_all(:viewed => true)
end
# sort_init 'updated_on', 'desc'

View File

@ -17,6 +17,9 @@ class ContestsController < ApplicationController
layout "base_contests"
def show
#更新创建课程消息状态
contest_request_messages = ContestMessage.where("user_id = #{User.current.id} and contest_id = #{@contest.id} and contest_message_type in ('ContestRequestDealResult', 'JoinContest', 'RemoveFromContest') and viewed = 0")
contest_request_messages.update_all(:viewed => true)
@left_nav_type = 1
respond_to do |format|
@ -26,10 +29,6 @@ class ContestsController < ApplicationController
end
def contest_activities
#更新创建课程消息状态
contest_request_messages = ContestMessage.where(:user_id => User.current.id, :contest_id => @contest.id, :contest_message_type => "ContestRequestDealResult", :viewed => false)
contest_request_messages.update_all(:viewed => true)
contest_activities = @contest.contest_activities
@page = params[:page] ? params[:page].to_i + 1 : 0
if params[:type].present?

View File

@ -500,7 +500,7 @@ class CoursesController < ApplicationController
end
def export_course_member_excel
q = "#{params[:name].strip}"
q = params[:name] ? "#{params[:name].strip}" : ""
if params[:group_id] && params[:group_id] != "0" && params[:group_id] != "-1"
group = CourseGroup.find params[:group_id]
unless group.nil?

View File

@ -240,10 +240,13 @@ class NewsController < ApplicationController
# 更新新闻
query_message_news = ForgeMessage.where("forge_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
# 更新新闻的时候一并更新回复
ForgeMessage.where("forge_message_id in (#{ids}) and forge_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
else
ForgeMessage.where("forge_message_id in (#{ids}) and forge_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
elsif @course
query_message_news = CourseMessage.where("course_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
CourseMessage.where("course_message_id in (#{ids}) and course_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
CourseMessage.where("course_message_id in (#{ids}) and course_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
elsif @contest
query_message_news = ContestMessage.where("contest_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
ContestMessage.where("contest_message_id in (#{ids}) and contest_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
end
query_message_news.update_attribute(:viewed, true) unless query_message_news.nil?
# over

View File

@ -16,5 +16,15 @@ class OrgCoursesController < ApplicationController
@course = Course.find(params[:course_id])
@org_course = OrgCourse.find(params[:id])
@org_course.destroy
course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{@course.id}").map(&:organization_id)
if course_org_ids.empty?
@orgs_not_in_course = User.current.organizations
else
course_org_ids = "(" + course_org_ids.join(',') + ")"
@orgs_not_in_course = User.current.organizations.where("organizations.id not in #{course_org_ids}")
end
respond_to do |format|
format.js
end
end
end

View File

@ -3160,13 +3160,13 @@ module ApplicationHelper
project = cur_user_projects_for_homework homework
if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "查看详情", homework_common_index_path(:course_id => homework.course_id), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
else
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
end
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "查看详情", homework_common_index_path(:course_id => homework.course_id), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
else
link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'btn_orange_big fr mt5', :target => '_blank'
end

View File

@ -46,7 +46,7 @@
<%= link_to('下移', {:controller => 'boards', :action => 'update_position', :id => board.id, :course_id => @course.id, :opr => 'down'},:remote => true, :method => 'post', :class => "sy_btn_blue mr5", :title => '下移') %>
<% end %>
<a href="javascript:void(0);" class="sy_btn_blue mr5" onclick="edit('#board_sub_show_<%= board.id %>','#board_sub_edit_<%= board.id %>');">编辑</a>
<a href="javascript:void(0);" class="sy_btn_blue mr5" onclick="delete_confirm_box_2('<%=course_board_path(board, :course_id => @course.id) %>', '确定删除<%=board.name %>吗?')">删除</a>
<a href="javascript:void(0);" class="sy_btn_blue mr5" onclick="delete_confirm_box_2('<%=course_board_path(board, :course_id => @course.id) %>', '您是否确定删除')">删除</a>
</td>
</tr>
<% end %>

View File

@ -60,7 +60,7 @@
$(document).ready(function(){
$.ajax({
url: '<%= url_for(:controller => 'courses', :action => 'search_public_orgs_not_in_course') %>'+'?page=1',
url: "/courses/<%=@course.id.to_s %>/search_public_orgs_not_in_course?page=1" ,
type:'get'
});
});

View File

@ -10,20 +10,20 @@
</thead>
<tbody>
<tr>
<th ><p class="popup_ziyuan_title fl"><%= @attachment.filename %></p><span class="muban_icons_blue ml5 fl mt12">当前版本</span></th>
<th><%= @attachment.downloads %></th>
<th><%= @attachment.try(:quotes).to_i %></th>
<th><%= format_time(@attachment.created_on) %></th>
<td><p class="popup_ziyuan_title fl"><%= @attachment.filename %></p><span class="muban_icons_blue ml5 fl">当前版本</span></td>
<td class="text_c"><%= @attachment.downloads %></td>
<td class="text_c"><%= @attachment.try(:quotes).to_i %></td>
<td class="text_c"><%= format_time(@attachment.created_on) %></td>
<!--<th></th>-->
</tr>
<% @attachment_histories.each do |history| %>
<tr>
<th ><p class="popup_ziyuan_title">
<td ><p class="popup_ziyuan_title">
<%= link_to history.filename, download_history_attachment_path(history.id, history.filename), :title => history.filename+"\n"+history.description.to_s %></p>
</th>
<th><%= history.downloads %></th>
<th><%= history.try(:quotes).to_i %></th>
<th><%= format_time(history.created_on) %></th>
</td>
<td class="text_c"><%= history.downloads %></td>
<td class="text_c"><%= history.try(:quotes).to_i %></td>
<td class="text_c"><%= format_time(history.created_on) %></td>
<!--<th>-->
<%#= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history"),
# :remote => true,

View File

@ -10,29 +10,29 @@
</thead>
<tbody>
<tr>
<th ><p class="popup_ziyuan_title"><%= @attachment.filename %><span class="muban_icons_blue ml5">当前版本</span></p></th>
<th><%= @attachment.downloads %></th>
<th><%= @attachment.try(:quotes).to_i %></th>
<th><%= format_time(@attachment.created_on) %></th>
<th></th>
<td ><p class="popup_ziyuan_title"><%= @attachment.filename %><span class="muban_icons_blue ml5">当前版本</span></p></td>
<td class="text_c"><%= @attachment.downloads %></td>
<td class="text_c"><%= @attachment.try(:quotes).to_i %></td>
<td class="text_c"><%= format_time(@attachment.created_on) %></td>
<td class="text_c"></td>
</tr>
<% @attachment_histories.each do |history| %>
<tr>
<th ><p class="popup_ziyuan_title">
<td ><p class="popup_ziyuan_title">
<%= link_to history.filename, download_history_attachment_path(history.id, history.filename), :title => history.filename+"\n"+history.description.to_s %></p>
</th>
<th><%= history.downloads %></th>
<th><%= history.try(:quotes).to_i %></th>
<th><%= format_time(history.created_on) %></th>
<th>
</td>
<td class="text_c"><%= history.downloads %></td>
<td class="text_c"><%= history.try(:quotes).to_i %></td>
<td class="text_c"><%= format_time(history.created_on) %></td>
<td class="text_c">
<%= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history_delete"),
:remote => true,
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:class => "postOptionLink",
:class => "btn") if allow_to_delete_attachment(history) %>
</th>
</td>
</tr>
<% end %>
</tbody>

View File

@ -79,7 +79,7 @@
</li>
<% end %>
<li>
<%= link_to '我的项目', {:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list', :class => "menuGrey" %>
<%= link_to '我的项目', {:controller => "users", :action => "user_projectlist", :id => User.current}, :class => "menuGrey" %>
</li>
<li>
<%= link_to "我的组织", user_organizations_user_path(:id => User.current), :class => "menuGrey"%>

View File

@ -116,7 +116,7 @@
<li><a href="<%= href %>" target="_blank" title="<%=ma.contest_message.author.show_name %> <%= ma.contest_message.parent_id.nil? ? "发布了竞赛帖子:" : "回复了竞赛帖子:" %><%= content%>"><span class="shadowbox_news_user"><%=ma.contest_message.author.show_name %> </span><%= ma.contest_message.parent_id.nil? ? "发布了竞赛帖子:" : "回复了竞赛帖子:" %><%= content%></a></li>
<% elsif ma.contest_message_type == "JournalsForMessage" %>
<% if ma.contest_message.jour_type == 'Contest' %>
<li><a href="<%= contest_feedback_path(ma.contest_id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> <%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:"%><%= message_content(ma.contest_message.notes)%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span><%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:"%><%= message_content(ma.contest_message.notes)%></a></li>
<li><a href="<%= feedback_contest_path(ma.contest_id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> <%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:"%><%= message_content(ma.contest_message.notes)%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span><%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:"%><%= message_content(ma.contest_message.notes)%></a></li>
<% end %>
<% elsif ma.contest_message_type == "ContestRequestDealResult" %>
<% user = User.find(ma.user_id) %>

View File

@ -1,3 +1,4 @@
hideModal();
<%if @project%>
$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>');
$("#project_members_number").html("<%= @project.members.count %>");

View File

@ -1,9 +1,7 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>');
showModal('ajax-modal', '270px');
$('#ajax-modal').css('height','110px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='hidden_atert_form();'><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","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("alert_box");
<% if @status == 0 %>
notice_box_redirect("<%= poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course') %>", "提交成功!");
<% elsif @status == 1 %>
notice_box("您还有尚未作答的必答题目请完成后再提交!");
<% else %>
notice_box("发生未知错误,请检查您的网络。");
<% end %>

View File

@ -337,7 +337,8 @@
<% end %>
<% end %>
if(!result){
alert("您的多选题答题不符合要求,请检查后再提交");
notice_box("您的多选题答题不符合要求,请检查后再提交");
//alert("");
}
return result;
}

File diff suppressed because it is too large Load Diff

View File

@ -614,13 +614,13 @@ function warnLeavingUnsaved(message) {
$(this).data('changed', 'changed');
});
window.onbeforeunload = function(){
var warn = false;
$('textarea').blur().each(function(){
if ($(this).data('changed')) {
warn = true;
}
});
if (warn) {return warnLeavingUnsavedMessage;}
// var warn = false;
// $('textarea').blur().each(function(){
// if ($(this).data('changed')) {
// warn = true;
// }
// });
// if (warn) {return warnLeavingUnsavedMessage;}
};
}
@ -1773,6 +1773,14 @@ function notice_box(str){
pop_box_new(htmlvalue, 300, 140);
}
//提示框:只有一个确定按钮,点击跳转
function notice_box_redirect(url, str){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">' + str + '</p><div class="cl"></div>'+
'<a href="'+ url +'" class="fr sy_btn_blue mt10 mr10" style="margin-right: 124px;">确定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
}
//删除组织成员
function ifDeleteOrgMember(id,name){
var htmlvalue = "</br><div style='width:550px;text-align:center'>您确定要删除"+name+"吗?</div></br><div style='width:164px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn fl' onclick='deleteOrgMember("+id+")'>确定</a><a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>取消</a></div>" +