Merge branch 'develop' into educoder

dev_bj
daiao 5 years ago
commit 36966110ac

@ -1,7 +1,7 @@
class CompetitionTeamsController < ApplicationController class CompetitionTeamsController < ApplicationController
include ApplicationHelper include ApplicationHelper
before_filter :find_team, :except => [:new, :create, :join_team, :search_non_user, :personal_enroll, :check_team_identity, :search_teacher] before_filter :find_team, :except => [:new, :create, :join_team, :search_non_user, :personal_enroll, :check_team_identity, :search_teacher]
before_filter :find_competition, :only => [:new, :create, :join_team, :search_non_user, :personal_enroll] before_filter :find_competition, :only => [:new, :create, :join_team, :search_teacher, :search_non_user, :personal_enroll]
before_filter :require_login before_filter :require_login
skip_before_filter :verify_authenticity_token, :only => [:edit_rule] skip_before_filter :verify_authenticity_token, :only => [:edit_rule]
layout 'base_competition' layout 'base_competition'
@ -13,6 +13,10 @@ class CompetitionTeamsController < ApplicationController
end end
def search_teacher def search_teacher
if params[:team] && params[:team] != ""
@team = @competition.competition_teams.where(:id => params[:team]).first
end
condition = "%#{params[:search].strip}%".gsub(" ","") condition = "%#{params[:search].strip}%".gsub(" ","")
@teachers = User.joins(:user_extensions).where("status = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}' and user_extensions.identity = 0") @teachers = User.joins(:user_extensions).where("status = 1 and LOWER(concat(lastname, firstname, login, nickname)) LIKE '#{condition}' and user_extensions.identity = 0")
end end
@ -271,7 +275,7 @@ class CompetitionTeamsController < ApplicationController
repeat_teachers = competition.team_members.where(user_id: user_ids).includes(:user).to_a repeat_teachers = competition.team_members.where(user_id: user_ids).includes(:user).to_a
if repeat_teachers.size > 0 if repeat_teachers.size > 0
@status, @message = -1, "导师#{repeat_teachers.map{|t| t.user.show_real_name}}已经加入其它战队了" @status, @message = -1, "导师#{repeat_teachers.map{|t| t.user.show_real_name}.join('')}已经加入其它战队了"
return false return false
end end
@ -284,7 +288,7 @@ class CompetitionTeamsController < ApplicationController
repeat_members = competition.team_members.where(user_id: user_ids).includes(:user).to_a repeat_members = competition.team_members.where(user_id: user_ids).includes(:user).to_a
if repeat_members.size > 0 if repeat_members.size > 0
@status, @message = -1, "成员#{repeat_members.map{|t| t.user.show_real_name}}已经加入其它战队了" @status, @message = -1, "成员#{repeat_members.map{|t| t.user.show_real_name}.join('')}已经加入其它战队了"
return false return false
end end

@ -247,8 +247,8 @@
function search_teacher_user(){ function search_teacher_user(){
if($("#teacher_search_input").val().trim() != ""){ if($("#teacher_search_input").val().trim() != ""){
$.post("<%= search_teacher_competition_teams_path() %>", $.post("<%= search_teacher_competition_teams_path(:com_id => @competition.id) %>",
{"search": $("#teacher_search_input").val().trim()}); {"search": $("#teacher_search_input").val().trim(), "team": $("#team_id").val()});
} }
} }

@ -1,10 +1,15 @@
<p class="pl30 color-orange-tip mt5 pb5 bor-bottom-greyE">请选择指导老师,允许修改</p> <p class="pl30 color-orange-tip mt5 pb5 bor-bottom-greyE">请选择指导老师,允许修改</p>
<% @teachers.each do |teacher| %> <% @teachers.each do |teacher| %>
<li class="clearfix"> <% has_enroll = @competition.teacher_enroll_mutiple_limited && (@team.present? ? @competition.team_members.where("user_id = '#{teacher.id}' and id != #{@team.id}").count > 0 : @competition.team_members.where("user_id = '#{teacher.id}'").count > 0) %>
<li class="clearfix <%= has_enroll ? 'added' : 'unadded' %>">
<input type="hidden" value="<%= teacher.id %>"> <input type="hidden" value="<%= teacher.id %>">
<span class="pt-s task-hide"><%= teacher.show_name %></span> <span class="pt-s task-hide"><%= teacher.show_name %></span>
<span class="pt-s-n task-hide"><%= teacher.identity %></span> <span class="pt-s-n task-hide"><%= teacher.identity %></span>
<span class="pt-l task-hide"><%= teacher.school_name %></span> <span class="pt-l task-hide"><%= teacher.school_name %></span>
<% if has_enroll %>
<span class="pt-s color-orange-tip task-hide">已加入其他战队</span>
<% end %>
</li> </li>
<% end %> <% end %>
@ -14,7 +19,7 @@
e.stopPropagation(); e.stopPropagation();
}); });
/*从下拉列表中选择指导老师*/ /*从下拉列表中选择指导老师*/
$("#pointerTeacher li").click(function(e){ $("#pointerTeacher li.unadded").click(function(e){
var name=$(this).find(".pt-s").html().trim(); var name=$(this).find(".pt-s").html().trim();
$("#pointerTeacher").siblings("#teacher_search_input").val(name); $("#pointerTeacher").siblings("#teacher_search_input").val(name);
$("#pointerTeacher").siblings("#teacher_id").val($(this).find("input").val().trim()); $("#pointerTeacher").siblings("#teacher_id").val($(this).find("input").val().trim());

@ -1,10 +1,39 @@
<div class="educontent mt10 mb50"> <div class="educontent">
<p class="edu-back-white mb20 padding30 clearfix"> <p class="edu-back-white mb20 padding30 mt10 clearfix">
<span class="color-grey-3 font-18 fl">战队详情</span> <span class="color-grey-3 font-18 fl">战队详情</span>
<a href="javascript:void(0)" class="color-grey-9 fr">返回</a> <a href="javascript:void(0)" class="color-grey-9 fr">返回</a>
</p> </p>
<div class="edu-back-white"> <div class="edu-back-white mb50">
<p class="padding20-30">实训项目</p> <p class="padding20-30">实训项目</p>
<table></table> <table class="edu-pop-table head-color" cellspacing="0" cellpadding="0">
<thead>
<th>创建者</th>
<th>名称</th>
<th>学习人数</th>
<th>fork版的学习人数</th>
<th>有效作品数</th>
<th>制作应用经验值</th>
</thead>
<tbody>
<tr>
<td>胡莎莎</td>
<td>
<span>单链表的学习与应用I</span>
</td>
<td>2.5万</td>
<td>1456</td>
<td>2.5万</td>
<td>4545667</td>
</tr>
</tbody>
<tfoot class="color-orange">
<th class="color-grey-6">合计:</th>
<th>6</th>
<th>5.5万</th>
<th>7878</th>
<th>2.5万</th>
<th>245364</th>
</tfoot>
</table>
</div> </div>
</div> </div>

@ -14,7 +14,7 @@
is_start = Time.now > first_section.start_time is_start = Time.now > first_section.start_time
%> %>
<div class="second_course_5" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"> <div class="second_course_5" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;">
<div class="enter_panel" style="height: 500px"> <div class="enter_panel" style="height: 437px">
<div class="course_competition_panel"> <div class="course_competition_panel">
<a href="<%= is_start ? first_section.competition_entries[0].url : 'javascript:void(0)'%>" <a href="<%= is_start ? first_section.competition_entries[0].url : 'javascript:void(0)'%>"
class="<%= is_start ? 'active' : '' %>" target="_blank"><%= first_section.competition_entries[0].name %></a> class="<%= is_start ? 'active' : '' %>" target="_blank"><%= first_section.competition_entries[0].name %></a>

Loading…
Cancel
Save