Merge remote-tracking branch 'origin/develop' into develop

dev_bj
杨树明 5 years ago
commit 5346674266

@ -12,6 +12,35 @@ class CompetitionTeamsController < ApplicationController
@team_user = User.current @team_user = User.current
end end
def show
return render_404 if @competition.identifier != 'gcc-course-2019'
@team_user_ids = @team.team_members.pluck(:user_id)
shixuns = Shixun.where(user_id: @team_user_ids, status: 2).where('shixuns.created_at > ?', Time.parse('2018-06-01'))
shixuns = shixuns.joins('left join shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.status = 2')
shixuns = shixuns.joins('left join myshixuns on myshixuns.shixun_id = shixuns.id and exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)')
shixuns = shixuns.select('shixuns.id, shixuns.identifier, shixuns.user_id, shixuns.myshixuns_count, shixuns.name, shixuns.fork_from, sum(forked_shixuns.myshixuns_count) forked_myshixun_count')
@shixuns = shixuns.group('shixuns.id').order('shixuns.myshixuns_count desc').includes(:creator)
@myshixun_count_map = Myshixun.where(shixun_id: @shixuns.map(&:id))
.where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)')
.group('shixun_id').count
# todo使用新版course_members
course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01'))
.joins('join members on members.course_id = courses.id')
.joins('join member_roles on member_roles.member_id = members.id and member_roles.role_id in (3,7,9)')
.where(members: { user_id: @team_user_ids }).pluck(:id)
courses = Course.where(id: course_ids).joins(:shixun_homework_commons).where('homework_commons.publish_time < now()')
@courses = courses.select('courses.id, courses.name, courses.members_count, count(*) shixun_homework_count')
.group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0')
@course_myshixun_map = Myshixun.joins(student_works: :homework_common)
.where(homework_commons: { course_id: @courses.map(&:id) })
.where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)')
.group('homework_commons.course_id').count
end
def search_teacher def search_teacher
if params[:team] && params[:team] != "" if params[:team] && params[:team] != ""
@team = @competition.competition_teams.where(:id => params[:team]).first @team = @competition.competition_teams.where(:id => params[:team]).first

@ -4,7 +4,7 @@ class CompetitionsController < ApplicationController
:edit_md_content, :update_md_content, :edit_md_content, :update_md_content,
:new_competition_stage, :new_stage_section, :update_competition_stage] :new_competition_stage, :new_stage_section, :update_competition_stage]
before_filter :find_inform, :only => [:edit_inform, :update_inform] before_filter :find_inform, :only => [:edit_inform, :update_inform]
before_filter :require_login, :only => [:enroll_portal] before_filter :require_login, :only => [:enroll_portal, :publish]
skip_before_filter :verify_authenticity_token, :only => [:edit_rule] skip_before_filter :verify_authenticity_token, :only => [:edit_rule]
layout 'base_competition' layout 'base_competition'
@ -25,7 +25,7 @@ class CompetitionsController < ApplicationController
end end
def index def index
@competitions = Competition.where(:status => 1).reorder("online_time desc") @competitions = Competition.where('status = 1 or published_at is not null').reorder("published_at desc, online_time desc")
respond_to do |format| respond_to do |format|
format.html { render :layout => "base_edu"} format.html { render :layout => "base_edu"}
format.js format.js
@ -438,10 +438,10 @@ class CompetitionsController < ApplicationController
def online_switch def online_switch
if @competition.present? if @competition.present?
if @competition.status if @competition.status
@competition.update_attributes(:status => 0) @competition.update_attributes(status: false, published_at: nil)
@btn_html = "上架" @btn_html = "上架"
else else
@competition.update_attributes(:status => 1, :online_time => Time.now) @competition.update_attributes(status: true, online_time: Time.now, published_at: nil)
@btn_html = "下架" @btn_html = "下架"
end end
end end
@ -601,6 +601,12 @@ class CompetitionsController < ApplicationController
@competition.competition_stage_sections.where(:id => params[:section_id]).destroy_all @competition.competition_stage_sections.where(:id => params[:section_id]).destroy_all
end end
def publish
return render_403 unless admin_or_business?
@competition.update_column(:published_at, Time.now)
end
private private
def chart_exp_score_mo myshixuns, s_time, e_time def chart_exp_score_mo myshixuns, s_time, e_time

@ -2,7 +2,7 @@
class Competition < ActiveRecord::Base class Competition < ActiveRecord::Base
# status 0下架 1上架 # status 0下架 1上架
attr_accessible :end_time, :identifier, :name, :online_time, :start_time, :status, :visits, :competition_lists_count, attr_accessible :end_time, :identifier, :name, :online_time, :start_time, :status, :visits, :competition_lists_count,
:min_num, :max_num, :enroll_end_time, :sub_title :min_num, :max_num, :enroll_end_time, :sub_title, :published_at
has_many :competition_modules, :dependent => :destroy has_many :competition_modules, :dependent => :destroy
has_many :competition_stages, :dependent => :destroy has_many :competition_stages, :dependent => :destroy

@ -66,18 +66,6 @@ class Shixun < ActiveRecord::Base
#scope :visible, -> { where(status: -1) } #scope :visible, -> { where(status: -1) }
after_create :send_tiding after_create :send_tiding
def description
self.has_attribute?(:description) ? self[:description] : ""
end
def propaedeutics
self.has_attribute?(:propaedeutics) ? self[:propaedeutics] : ""
end
def evaluate_script
self.has_attribute?(:evaluate_script) ? self[:evaluate_script] : ""
end
def should_compile? def should_compile?
self.mirror_repositories.published_main_mirror.first.try(:should_compile) self.mirror_repositories.published_main_mirror.first.try(:should_compile)
end end

@ -1,6 +1,6 @@
<div class="librariesField"> <div class="librariesField pointer" onclick="$('#_file').click();">
<li> <li>
<a href="javascript:void(0)" class="color-blue font-18" onclick="$('#_file').click();" data-tip-down="请选择文件上传">上传附件</a> <a href="javascript:void(0)" class="color-blue font-18" data-tip-down="请选择文件上传">上传附件</a>
<!--<p class="color-grey-c">(单个文件<%#= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>以内)</p>--> <!--<p class="color-grey-c">(单个文件<%#= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>以内)</p>-->
<p class="color-grey-c mt7">从我的电脑选择要上传的文档按住CTRL可以上传多份文档</p> <p class="color-grey-c mt7">从我的电脑选择要上传的文档按住CTRL可以上传多份文档</p>
<div id="network_issue" class="fl ml10 color-red none">上传出现错误,请检查您的网络环境,并刷新页面重新上传。</div> <div id="network_issue" class="fl ml10 color-red none">上传出现错误,请检查您的网络环境,并刷新页面重新上传。</div>

@ -24,13 +24,12 @@
<div class="df pl20 pr20"> <div class="df pl20 pr20">
<label class="ml10 mt3">导师:</label> <label class="ml10 mt3">导师:</label>
<div class="flex1 pr search-new"> <div class="flex1 pr search-new">
<input type="text" class="input-100-35 fl" <%= @team_user.user_extensions.identity == 0 ? "disabled" : "" %> autocomplete="off" placeholder="请您输入老师姓名进行搜索;可以后续再添加导师" id="teacher_search_input" <input type="text" class="input-100-35 fl" autocomplete="off" placeholder="请您输入老师姓名进行搜索;可以后续再添加导师" id="teacher_search_input" value="">
value="<%= @team.try(:id).present? ? @team.teacher.try(:show_name) : (@team_user.user_extensions.identity == 0 ? @team_user.show_name : "") %>">
<input type="hidden" id="teacher_id" data-select="0" value="<%= @team.try(:id).present? ? @team.try(:teacher_id) : (@team_user.user_extensions.identity == 0 ? @team_user.id : "") %>"> <input type="hidden" id="teacher_id" data-select="0" value="<%= @team.try(:id).present? ? @team.try(:teacher_id) : (@team_user.user_extensions.identity == 0 ? @team_user.id : "") %>">
<input type="hidden" id="teacher_name" value="<%= @team.try(:id).present? ? @team.teacher.try(:show_name) : (@team_user.user_extensions.identity == 0 ? @team_user.show_name : "") %>"> <input type="hidden" id="teacher_name" value="<%= @team.try(:id).present? ? @team.teacher.try(:show_name) : (@team_user.user_extensions.identity == 0 ? @team_user.show_name : "") %>">
<input type="hidden" id="teacher_school"> <input type="hidden" id="teacher_school">
<input type="hidden" id="teacher_title"> <input type="hidden" id="teacher_title">
<a class="fl searchicon" style="top:0px;" onclick="<%= @team_user.user_extensions.identity == 0 ? '' : 'search_teacher_user()' %>"><i class="iconfont icon-sousuo fl"></i></a> <a class="fl searchicon" style="top:0px;" onclick="search_teacher_user()"><i class="iconfont icon-sousuo fl"></i></a>
<ul class="pointerTeacher none" id="pointerTeacher"> <ul class="pointerTeacher none" id="pointerTeacher">
</ul> </ul>
</div> </div>

@ -0,0 +1,120 @@
<div class="educontent mb50">
<p class="edu-back-white mb20 padding30 mt10 clearfix lineh-20">
<span class="color-grey-3 font-18 fl">战队详情</span>
<%= link_to '返回', enroll_competition_path(@competition), class: 'color-grey-9 fr' %>
</p>
<div class="edu-back-white mb20">
<p class="pt20 pb20 font-16"><span class="modalTitle">实训项目</span></p>
<table width="100%" class="tBodyScroll edu-txt-center" cellpadding="0" cellspacing="0">
<thead class="lastPart">
<tr>
<th width="10%">创建者</th>
<th width="40%" class="edu-txt-left">名称</th>
<th width="10%">学习人数</th>
<th width="15%" data-tip-down="fork该实训产生的新实训学习总人数">fork版的学习人数</th>
<th width="10%" data-tip-down="至少完成了1个关卡">有效作品数</th>
<th width="15%">经验值</th>
</tr>
</thead>
<tbody>
<%
total_myshixun_count = 0
total_forked_myshixun_count = 0
%>
<% @shixuns.each do |shixun| %>
<%
total_myshixun_count += shixun.myshixuns_count
total_forked_myshixun_count += shixun['forked_myshixun_count'].to_i
%>
<tr>
<td width="10%"><%= shixun.creator.show_real_name %></td>
<td width="40%" class="edu-txt-left">
<%= link_to shixun_path(shixun), target: '_blank' do %>
<span class="task-hide fl" style="max-width: 410px;"><%= shixun.name %></span>
<% end %>
<% if shixun.fork_from.blank? %>
<span class="connectTag ml10">原创</span>
<% end %>
</td>
<td width="10%"><%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %></td>
<td width="15%"><%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %></td>
<td width="10%"><%= @myshixun_count_map.fetch(shixun.id, '--') %></td>
<td width="15%">--</td>
</tr>
<% end %>
</tbody>
<tfoot class="tfootLastPart">
<tr class="color-orange font-16">
<th width="10%" class="color-grey-6">合计</th>
<th width="40%" class="edu-txt-left"><%= @shixuns.size %></th>
<th width="10%"><%= total_myshixun_count %></th>
<th width="15%"><%= total_forked_myshixun_count %></th>
<th width="10%"><%= @myshixun_count_map.values.reduce(:+) %></th>
<th width="15%">--</th>
</tr>
</tfoot>
</table>
</div>
<div class="edu-back-white mb20">
<p class="pt20 pb20 font-16"><span class="modalTitle">翻转课堂</span></p>
<table width="100%" class="tBodyScroll edu-txt-center" cellpadding="0" cellspacing="0">
<thead class="lastPart">
<tr>
<th width="10%">创建者</th>
<th width="40%" class="edu-txt-left">名称</th>
<th width="10%">学生数量</th>
<th width="15%">发布的实训作业数量</th>
<th width="10%" data-tip-down="至少完成了1个关卡">有效作品数</th>
<th width="15%">经验值</th>
</tr>
</thead>
<tbody>
<%
total_members_count = 0
total_shixun_homework_count = 0
%>
<% @courses.each do |course| %>
<%
total_members_count += course.members_count.to_i
total_shixun_homework_count += course['shixun_homework_count'].to_i
%>
<tr>
<td width="10%"><%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %></td>
<td width="40%" class="edu-txt-left">
<%= link_to course_path(course), target: '_blank' do %>
<span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span>
<% end %>
</td>
<td width="10%"><%= course.members_count %></td>
<td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td>
<td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td>
<td width="15%">--</td>
</tr>
<% end %>
</tbody>
<tfoot class="tfootLastPart">
<tr class="color-orange font-16">
<th width="10%" class="color-grey-6">合计</th>
<th width="40%" class="edu-txt-left"><%= @courses.size %></th>
<th width="10%"><%= total_members_count %></th>
<th width="15%"><%= total_shixun_homework_count %></th>
<th width="10%"><%= @course_myshixun_map.values.reduce(:+) %></th>
<th width="15%">--</th>
</tr>
</tfoot>
</table>
</div>
</div>
<script>
$(function(){
if($(".tBodyScroll tbody").get(0).scrollHeight > 420){
$(".tBodyScroll thead").addClass("lastPart");
$(".tBodyScroll tfoot").addClass("tfootLastPart");
}else{
$(".tBodyScroll thead").removeClass("lastPart");
$(".tBodyScroll tfoot").removeClass("tfootLastPart");
}
})
</script>

@ -1,39 +0,0 @@
<div class="educontent">
<p class="edu-back-white mb20 padding30 mt10 clearfix">
<span class="color-grey-3 font-18 fl">战队详情</span>
<a href="javascript:void(0)" class="color-grey-9 fr">返回</a>
</p>
<div class="edu-back-white mb50">
<p class="padding20-30">实训项目</p>
<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>

@ -46,7 +46,7 @@
<a href="<%= charts_competition_path(@competition) %>" >排行榜</a> <a href="<%= charts_competition_path(@competition) %>" >排行榜</a>
</li> </li>
<% when '报名' %> <% when '报名' %>
<li class="<%= params[:action] == 'enroll' ? 'active' : '' %>"> <li class="<%= params[:action] == 'enroll' || (params[:controller] == 'competition_teams' && params[:action] == 'show') ? 'active' : '' %>">
<a href="<%= enroll_competition_path(@competition) %>">报名</a> <a href="<%= enroll_competition_path(@competition) %>">报名</a>
</li> </li>
<% else %> <% else %>

@ -5,10 +5,10 @@
<% index += 1 %> <% index += 1 %>
<% @competition.competition_stages.each_with_index do |stage, i| %> <% @competition.competition_stages.each_with_index do |stage, i| %>
<div class="second_3" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"> <div class="<%= i == 1 ? "second_3_small" :"second_3" %>" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;">
<div class="enter_panel"> <div class="enter_panel">
<% stage.competition_stage_sections.each do |section| %> <% stage.competition_stage_sections.each do |section| %>
<ul class="mb40"> <ul class="mb30">
<p class="mb30 font-22 enter_title"> <p class="mb30 font-22 enter_title">
<span class="mr20 font-bd"><%= section.name %></span> <span class="mr20 font-bd"><%= section.name %></span>
<span><%= format_time section.start_time %> ~ <%= com_end_time section.end_time %></span> <span><%= format_time section.start_time %> ~ <%= com_end_time section.end_time %></span>

@ -0,0 +1,71 @@
<% index = 0 %>
<div class="openSource_1" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<div class="openSource_2" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<% @competition.competition_stages.each_with_index do |stage, i| %>
<div class="openSource_<%= index + 1 %>" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;">
<%
first_section = stage.competition_stage_sections[0]
second_section = stage.competition_stage_sections[1]
%>
<div class="enter_panel" style="height: 285px">
<ul>
<p class="font-22 enter_title padding30 clearfix">
<span class="fl ml30">
<span class="mr20 font-bd"><%= first_section.try(:name) %></span>
<span><%= first_section.start_time.try(:strftime, '%Y年%m月%d日') %>~<%= first_section.end_time.try(:strftime, '%Y年%m月%d日') %></span>
</span>
<span class="fr mr30">
<span class="mr20 font-bd"><%= second_section.try(:name) %></span>
<span><%= second_section.try(:start_time).try(:strftime, '%Y年%m月%d日') %>~<%= second_section.try(:end_time).try(:strftime, '%Y年%m月%d日') %></span>
</span>
</p>
<li class="inline enter_btn mt20">
<% is_start = Time.now > first_section.start_time %>
<% first_section.competition_entries.each_with_index do |entry, j| %>
<%
competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
%>
<a class="li-1 <%= is_start ? 'active' : '' %>"
href="javascript:void(0);"
data-url="<%= btn_url %>"><%= entry.name %></a>
<% end %>
</li>
</ul>
</div>
</div>
<% index += 1 %>
<% end %>
<div class="openSource_5" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<div class="openSource_6" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<% index += 1 %>
<div class="openSource_7" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
$(".enter_btn .li-1.active").on("click", function(){
var url = $(this).data("url");
if (!userLogged) {
location.href = "<%= signin_url(back_url: competition_path(id: params[:id])) %>";
return;
}
if (!userEnrolled) {
sure_box_redirect_without_newtab_btn("<%= enroll_competition_path(id: params[:id]) %>", "完成报名后即可参赛", "我要报名");
return;
}
var newTab = window.open("_blank");
newTab.location = url;
})
})
</script>

@ -5,7 +5,15 @@
<% @teams.each do |team| %> <% @teams.each do |team| %>
<li class="clearfix"> <li class="clearfix">
<%= link_to image_tag(url_to_avatar(team.user), :width => "40", :height => "40", :class => "radius fl mr10"), user_path(team.user), :title => team.user.show_name, :target => "_blank", :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(team.user), :width => "40", :height => "40", :class => "radius fl mr10"), user_path(team.user), :title => team.user.show_name, :target => "_blank", :alt => "用户头像" %>
<span class="fl task-hide mr20 mt10" style="width: 130px;" data-tip-down="<%= @maximum_staff > 1 ? team.name : team.user.show_name %>"><%= @maximum_staff > 1 ? team.name : team.user.show_name %></span>
<% if @competition.identifier == 'gcc-course-2019' %>
<%= link_to competition_team_path(id: team.id) do %>
<span class="fl task-hide mr20 mt10" style="width: 130px;" data-tip-down="<%= @maximum_staff > 1 ? team.name : team.user.show_name %>"><%= @maximum_staff > 1 ? team.name : team.user.show_name %></span>
<% end %>
<% else %>
<span class="fl task-hide mr20 mt10" style="width: 130px;" data-tip-down="<%= @maximum_staff > 1 ? team.name : team.user.show_name %>"><%= @maximum_staff > 1 ? team.name : team.user.show_name %></span>
<% end %>
<% if @maximum_staff > 1 %> <% if @maximum_staff > 1 %>
<span class="fl mr40 mt10" style="width: 270px;"> <span class="fl mr40 mt10" style="width: 270px;">
<% team.teachers.each do |teacher| %> <% team.teachers.each do |teacher| %>

@ -1,5 +1,5 @@
<div class="enroll-b"> <div class="enroll-b">
<div class="enroll-t" style="background:url('/images/educoder/competition/anon.png') no-repeat top center;"> <div class="enroll-t" style="background:url('/images/educoder/competition/anon.png') no-repeat top center;">
<div class="educontent edu-txt-center"> <div class="educontent edu-txt-center">
<p class="main_title"><%= @competition.name %></p> <p class="main_title"><%= @competition.name %></p>
<% if @maximum_staff > 1 %> <% if @maximum_staff > 1 %>
@ -67,7 +67,7 @@
<div class="clearfix mt30 pr88"> <div class="clearfix mt30 pr88">
<% @is_enroll.each do |team| %> <% @is_enroll.each do |team| %>
<li class="clearfix joinTeamInfo"> <li class="clearfix joinTeamInfo">
<span class="fl mr20 ml35"> <span class="fl mr20 ml20">
<%= link_to image_tag(url_to_avatar(team.user), :width => "48", :height => "48", :class => "radius fl mr10"), user_path(team.user), :title => team.user.show_name, :target => "_blank", :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(team.user), :width => "48", :height => "48", :class => "radius fl mr10"), user_path(team.user), :title => team.user.show_name, :target => "_blank", :alt => "用户头像" %>
<span class="fl task-hide mt12 font-16" style="width: 140px;"><span data-tip-down="<%= team.name %>"><%= team.name %></span></span> <span class="fl task-hide mt12 font-16" style="width: 140px;"><span data-tip-down="<%= team.name %>"><%= team.name %></span></span>
</span> </span>
@ -84,22 +84,22 @@
<% end %> <% end %>
</span> </span>
</span> </span>
<span class="fl mr40 mt13 font-16">邀请码:<label class="color-orange"><%= team.invite_code %></label></span> <span class="fl mr10 mt13 font-16">邀请码:<label class="color-orange"><%= team.invite_code %></label></span>
<% if @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %> <% if @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %>
<% if User.current.admin? || User.current == team.user %> <% if User.current.admin? || User.current == team.user %>
<a href="<%= edit_competition_team_path(team) %>" data-remote="true" class="fl mt13 mr20" data-tip-down="编辑"><i class="iconfont icon-bianjidaibeijing color-blue fl"></i></a> <a href="<%= edit_competition_team_path(team) %>" data-remote="true" class="fl mt13 mr10" data-tip-down="编辑"><i class="iconfont icon-bianjidaibeijing color-blue fl"></i></a>
<% end %> <% end %>
<% else %> <% else %>
<% if User.current.admin? || User.current == team.user %> <% if User.current.admin? || User.current == team.user %>
<a href="<%= edit_competition_team_path(team) %>" data-remote="true" class="fl mt13 mr20" data-tip-down="编辑"><i class="iconfont icon-bianjidaibeijing color-blue fl"></i></a> <a href="<%= edit_competition_team_path(team) %>" data-remote="true" class="fl mt13 mr10" data-tip-down="编辑"><i class="iconfont icon-bianjidaibeijing color-blue fl"></i></a>
<a href="javascript:void(0)" class="font-16 color-grey-c fl mt12" onclick="delete_confirm_box('<%= exit_team_competition_team_path(team) %>', '是否确认删除战队')" data-tip-down="删除"><i class="iconfont icon-shanchu color-grey-c font-15"></i></a> <a href="javascript:void(0)" class="font-16 color-grey-c fl mt12" onclick="delete_confirm_box('<%= exit_team_competition_team_path(team) %>', '是否确认删除战队')" data-tip-down="删除"><i class="iconfont icon-shanchu color-grey-c font-15"></i></a>
<% else %> <% else %>
<a href="javascript:void(0)" class="font-16 color-grey-c fl mt12" onclick="delete_confirm_box('<%= exit_team_competition_team_path(team) %>', '是否确认退出战队')">退出</a> <a href="javascript:void(0)" class="font-16 color-grey-c fl mt12" onclick="delete_confirm_box('<%= exit_team_competition_team_path(team) %>', '是否确认退出战队')">退出</a>
<% end %> <% end %>
<% end %> <% end %>
<%= link_to '进入大赛', competition_path(@competition), class: 'enrollOperation' %>
<% if @competition.identifier == 'gcc-course-2019' %> <% if @competition.identifier == 'gcc-course-2019' %>
<%= link_to '战队详情', competition_team_path(id: @competition.id) %> <%= link_to '战队详情', competition_team_path(id: team.id), class: 'enrollOperation' %>
<% end %> <% end %>
</li> </li>
<% end %> <% end %>

@ -2,6 +2,7 @@
<% if @competitions.count > 0 %> <% if @competitions.count > 0 %>
<div class="clearfix competitionsList"> <div class="clearfix competitionsList">
<% @competitions.each do |competition| %> <% @competitions.each do |competition| %>
<% if competition.status? %>
<div class="competitionsList-item mb20"> <div class="competitionsList-item mb20">
<div class="edu-back-white"> <div class="edu-back-white">
<a href="<%= competition_path(competition) %>" class="competition-Img" target="_blank"> <a href="<%= competition_path(competition) %>" class="competition-Img" target="_blank">
@ -67,9 +68,43 @@
</p> </p>
</div> </div>
</div> </div>
<% elsif competition.published_at.present? %>
<% url = admin_or_business? ? competition_path(competition) : 'javascript:void(0)' %>
<div class="competitionsList-item mb20">
<div class="edu-back-white">
<a href="<%= url %>" class="competition-Img">
<%= image_tag(url_to_avatar(competition), :width => "100%", :height => "100%") %>
</a>
<div class="pt20 pl20 mb10 clearfix">
<a href="<%= url %>" style="max-width: 400px;" class="font-16 task-hide fl"><%= [competition.name, competition.sub_title.presence].compact.join('——') %></a>
<div class="fr status-orange">
<img src="/images/educoder/competition/home/orange.png" class="fl">
<span class="status-tag fl">即将发布</span>
</div>
</div>
<p class="color-grey-B3 clearfix pl20 pr20 pb20"></p>
</div>
<div class="competitionsList-item-tip strongNone">
<div class="color-white font-26">
<p>即将发布</p><p>敬请期待</p>
</div>
</div>
</div>
<% end %>
<% end %> <% end %>
</div> </div>
<% else %> <% else %>
<%= render :partial => "welcome/no_data" %> <%= render :partial => "welcome/no_data" %>
<% end %> <% end %>
</div> </div>
<script>
$(function(){
<% unless admin_or_business? %>
$(".competitionsList-item").hover(function(){
$(this).find(".competitionsList-item-tip").removeClass("strongNone");
},function(){
$(this).find(".competitionsList-item-tip").addClass("strongNone");
});
<% end %>
})
</script>

@ -0,0 +1 @@
notice_box_redirect('<%= competition_managements_path %>', '发布成功')

@ -13,5 +13,7 @@
<%= render :partial => "gq_second_code_competition" %> <%= render :partial => "gq_second_code_competition" %>
<% elsif @competition.identifier == "gcc-course-2019" %> <% elsif @competition.identifier == "gcc-course-2019" %>
<%= render :partial => "qg_second_course_competition" %> <%= render :partial => "qg_second_course_competition" %>
<% elsif @competition.identifier == "gcc-project-2019" %>
<%= render :partial => "qg_second_opensource" %>
<% end %> <% end %>
</div> </div>

@ -15,9 +15,9 @@
</div> </div>
<div class="padding30 bor-top-greyE"> <div class="padding30 bor-top-greyE">
<div class="clearfix df"> <div class="clearfix">
<span class="upload_Title">描述</span> <span class="upload_Title">描述</span>
<div class="flex1"> <div class="fl" style="width: 1078px">
<div id="libraries_description" style="margin:0px"> <div id="libraries_description" style="margin:0px">
<%= f.text_area :content %> <%= f.text_area :content %>
</div> </div>
@ -25,7 +25,7 @@
</div> </div>
</div> </div>
<div> <div style="padding-left: 62px">
<%= render partial: 'attachments/from_libraries', locals: { container: @library } %> <%= render partial: 'attachments/from_libraries', locals: { container: @library } %>
<p s <p s
tyle="height:22px;line-height:22px;"><span class="color-red none" id="file_notice">请上传附件</span></p> tyle="height:22px;line-height:22px;"><span class="color-red none" id="file_notice">请上传附件</span></p>

@ -5,8 +5,8 @@
<span class="font-18 fl color-grey-3">教学案例</span> <span class="font-18 fl color-grey-3">教学案例</span>
<%= link_to '新建', new_library_path, class: 'fr color-blue font-16 mt3' %> <%= link_to '新建', new_library_path, class: 'fr color-blue font-16 mt3' %>
</p> </p>
<div class="clearfix pt20 pl30 pr30"> <div class="clearfix pl30 pr30">
<ul class="fl library_nav"> <ul class="fl library_nav mt20">
<li class="<%= params[:type] == 'mine' ? '' : 'active' %>"> <li class="<%= params[:type] == 'mine' ? '' : 'active' %>">
<%= link_to '全部', libraries_path(search: params[:search]), remote: true %> <%= link_to '全部', libraries_path(search: params[:search]), remote: true %>
</li> </li>
@ -14,7 +14,7 @@
<%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %> <%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %>
</li> </li>
</ul> </ul>
<div class="edu-position fr"> <div class="edu-position fr mt12">
<%= hidden_field_tag(:type, params[:type]) %> <%= hidden_field_tag(:type, params[:type]) %>
<input class="winput-300-35 panel-box-sizing" placeholder="输入教学案例标题、编号进行检索" type="text" id="search_name"> <input class="winput-300-35 panel-box-sizing" placeholder="输入教学案例标题、编号进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a> <a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a>

@ -50,7 +50,7 @@
<%= link_to '编辑', edit_library_path(id: @library.id), class: 'white-btn edu-blueline-btn fr' %> <%= link_to '编辑', edit_library_path(id: @library.id), class: 'white-btn edu-blueline-btn fr' %>
<% end %> <% end %>
</p> </p>
<div class="df mb20"> <div class="df">
<%= link_to image_tag(url_to_avatar(@library.user), width: 50, height: 50, class: 'radius mr15 mt3'), user_path(@library.user) %> <%= link_to image_tag(url_to_avatar(@library.user), width: 50, height: 50, class: 'radius mr15 mt3'), user_path(@library.user) %>
<div class="flex1"> <div class="flex1">
<li class="font-16"><%= @library.user.show_real_name %></li> <li class="font-16"><%= @library.user.show_real_name %></li>

@ -65,6 +65,10 @@
<a href="javascript:void(0)" class="mr10 none" onclick="cancel_edit(this)">取消</a> <a href="javascript:void(0)" class="mr10 none" onclick="cancel_edit(this)">取消</a>
<a href="javascript:void(0)" class="mr10 none" onclick="update_competition(<%= competition.id %>)">保存</a> <a href="javascript:void(0)" class="mr10 none" onclick="update_competition(<%= competition.id %>)">保存</a>
<a id="competition_status_<%= competition.id %>" data-remote="true" href="<%= online_switch_competition_path(competition) %>" class="mr10"><%= competition.status ? "下架" : "上架" %></a> <a id="competition_status_<%= competition.id %>" data-remote="true" href="<%= online_switch_competition_path(competition) %>" class="mr10"><%= competition.status ? "下架" : "上架" %></a>
<% if !competition.status? && competition.published_at.blank? %>
<%= link_to '发布', publish_competition_path(competition), class: 'mr10', method: :post, remote: true %>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>

@ -260,6 +260,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'send_message' get 'send_message'
get 'export_chart_score' get 'export_chart_score'
post 'competition_images' post 'competition_images'
post 'publish'
end end
collection do collection do
post 'new_competition' post 'new_competition'

@ -0,0 +1,5 @@
class AddPublishedAtToCompetitions < ActiveRecord::Migration
def change
add_column :competitions, :published_at, :datetime
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 177 KiB

@ -628,6 +628,7 @@ p .activity-item:first-child{border-top: 1px solid #eee;}
.enterTo span.f-cart{width: 246px;text-align: center;color: #29BD8B;font-size: 20px;line-height: 20px;float: left;display: block;font-weight: bold;margin-right: 20px;} .enterTo span.f-cart{width: 246px;text-align: center;color: #29BD8B;font-size: 20px;line-height: 20px;float: left;display: block;font-weight: bold;margin-right: 20px;}
.enterTo span.d-cart{box-sizing:border-box;width: 246px;text-align: center;color: #989898;font-size: 16px;line-height: 22px;float: left;display: block;margin-right: 20px;} .enterTo span.d-cart{box-sizing:border-box;width: 246px;text-align: center;color: #989898;font-size: 16px;line-height: 22px;float: left;display: block;margin-right: 20px;}
.partGame.largepart .partborder .enterTo a:last-child,.enterTo span.f-cart:last-child,.enterTo span.d-cart:last-child{margin-right:0px;} .partGame.largepart .partborder .enterTo a:last-child,.enterTo span.f-cart:last-child,.enterTo span.d-cart:last-child{margin-right:0px;}
/*.partTime.active .time{color:#ff3232; }*/ /*.partTime.active .time{color:#ff3232; }*/
.partTime.active .enterTo a{cursor: pointer;background-color: #29bd8b;box-shadow: 0px 10px 10px rgba(41,189,139,0.2)} .partTime.active .enterTo a{cursor: pointer;background-color: #29bd8b;box-shadow: 0px 10px 10px rgba(41,189,139,0.2)}
a.enterLink{cursor: pointer;color: #418CCD!important;background: none!important;box-shadow: none!important;font-size: 14px!important;text-align: left;line-height: 20px;height: 20px;padding-bottom: 1px;border-bottom: 1px solid #418ccd;width: auto!important;border-radius: 0px;} a.enterLink{cursor: pointer;color: #418CCD!important;background: none!important;box-shadow: none!important;font-size: 14px!important;text-align: left;line-height: 20px;height: 20px;padding-bottom: 1px;border-bottom: 1px solid #418ccd;width: auto!important;border-radius: 0px;}
@ -643,7 +644,8 @@ a.enterLink{cursor: pointer;color: #418CCD!important;background: none!important;
/*第二次竞赛-全国*/ /*第二次竞赛-全国*/
.second_1{min-height: 832px;} .second_1{min-height: 832px;}
.second_2{min-height: 446px;} .second_2{min-height: 446px;}
.second_3{min-height: 595px;padding-top: 190px;box-sizing: border-box;position: relative} .second_3{min-height: 766px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_3_small{min-height: 595px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_4{min-height: 610px;padding-top: 190px;box-sizing: border-box;position: relative} .second_4{min-height: 610px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_5{min-height: 617px;padding-top: 190px;box-sizing: border-box;position: relative} .second_5{min-height: 617px;padding-top: 190px;box-sizing: border-box;position: relative}
.second_6{min-height: 1053px;} .second_6{min-height: 1053px;}
@ -659,6 +661,15 @@ a.enterLink{cursor: pointer;color: #418CCD!important;background: none!important;
.second_code_6{min-height: 1060px;} .second_code_6{min-height: 1060px;}
.second_code_7{min-height: 1116px;} .second_code_7{min-height: 1116px;}
.second_code_8{min-height: 711px;} .second_code_8{min-height: 711px;}
/*开源创新竞赛*/
.openSource_1{min-height: 803px;}
.openSource_2{min-height: 427px;}
.openSource_3{min-height: 524px;padding-top: 190px;box-sizing: border-box;position: relative}
.openSource_4{min-height: 526px;padding-top: 190px;box-sizing: border-box;position: relative}
.openSource_5{min-height: 1061px;}
.openSource_6{min-height: 1090px;}
.openSource_7{min-height: 683px;}
.challenge_title{ .challenge_title{
color: #41ABEF;font-size: 30px;font-weight: bold;text-align: center;letter-spacing: 1px;line-height: 60px;margin-bottom: 20px; color: #41ABEF;font-size: 30px;font-weight: bold;text-align: center;letter-spacing: 1px;line-height: 60px;margin-bottom: 20px;
} }
@ -728,6 +739,47 @@ li.challenge_box:last-child{
width: 360px;height: 70px;background: #2CDAD4;color: #fff!important;font-size: 30px;line-height: 70px;text-align: center; width: 360px;height: 70px;background: #2CDAD4;color: #fff!important;font-size: 30px;line-height: 70px;text-align: center;
margin:0px auto;display: block; margin:0px auto;display: block;
} }
table.tBodyScroll tbody tr td{
padding:6px 5px;box-sizing: border-box;font-size: 16px;color: #05101A;font-weight: normal;
}
table.tBodyScroll tbody {
display:block;
max-height:420px;
overflow-y:auto;
}
.connectTag{
display: inline-block;background: #4CACFF;border-radius: 12px;height: 24px;line-height: 24px;color: #fff;
padding:0px 12px;font-size: 14px;
}
table.tBodyScroll thead,table.tBodyScroll tfoot,table.tBodyScroll tbody tr {
display:table;
width:100%;
table-layout:fixed;
}
table.tBodyScroll thead,table.tBodyScroll tfoot {
width:100%;
}
table.tBodyScroll tfoot tr th{
padding:10px 5px;box-sizing: border-box;border-top: 1px solid #eaeaea;font-weight: normal!important;
}
.lastPart,.tfootLastPart{
width: calc( 100% - 1em )!important;
}
.lastPart tr th:last-child,.tfootLastPart tr th:last-child{position: relative;}
.tfootLastPart tr th:last-child:after{
content: '';width: 1em;height: 100%;position: absolute;right: -1em;top:0px;border-top: 1px solid #eaeaea;
}
.lastPart tr th:last-child:after{
content: '';background: #F5F5F5;width: 1em;height: 100%;position: absolute;right: -1em;top:0px
}
table.tBodyScroll thead th{
background: #F5F5F5;color: #656565;padding:10px 5px;box-sizing: border-box;
}
.modalTitle{display: block;padding: 0px 30px;position: relative;line-height: 20px}
.modalTitle:before{
position: absolute;height: 100%;width: 2px;content: '';background: #4cacff;left: 0px;top: 0px;
}
@ -802,6 +854,18 @@ li.challenge_box:last-child{
.joinTeamInfo{background-image:url('/images/educoder/competition/enroll-item.png');height:202px;width: 934px;padding: 10px 35px;box-sizing: border-box;margin: 0px auto;padding-top: 60px;} .joinTeamInfo{background-image:url('/images/educoder/competition/enroll-item.png');height:202px;width: 934px;padding: 10px 35px;box-sizing: border-box;margin: 0px auto;padding-top: 60px;}
.joinTeamInfo span,.joinTeamInfo a{line-height: 30px;} .joinTeamInfo span,.joinTeamInfo a{line-height: 30px;}
.enrollOperation{
float: left;
padding: 0px 8px;
border-radius: 27px;
background: #459be5;
color: #fff!important;
font-size: 12px!important;
height: 20px;
line-height: 19px!important;
margin-top: 18px;
margin-left: 10px;
}
/*弹框*/ /*弹框*/
.c-l-box{background: rgba(139,163,183,0.08);height: 226px;overflow-y: auto;width: 100%;padding: 20px 20px 0px 20px;box-sizing: border-box;} .c-l-box{background: rgba(139,163,183,0.08);height: 226px;overflow-y: auto;width: 100%;padding: 20px 20px 0px 20px;box-sizing: border-box;}
.c-l-box li,.c-r-box li{margin-bottom: 15px;line-height: 25px;} .c-l-box li,.c-r-box li{margin-bottom: 15px;line-height: 25px;}
@ -834,9 +898,14 @@ li.challenge_box:last-child{
.homePageBtn{position: absolute;width: 100%;top: 510px;} .homePageBtn{position: absolute;width: 100%;top: 510px;}
.homeBtn{display: block;float: left;border-radius: 30px;width: 168px;height: 60px;line-height: 60px;background-color: #21B351;font-size: 30px;color: #fff!important;text-align: center} .homeBtn{display: block;float: left;border-radius: 30px;width: 168px;height: 60px;line-height: 60px;background-color: #21B351;font-size: 30px;color: #fff!important;text-align: center}
.competitionsList-item{width: 50%;float: left;box-sizing: border-box;} .competitionsList-item{width: 50%;float: left;box-sizing: border-box;position: relative}
.competitionsList-item:nth-of-type(odd){padding-right: 10px;} .competitionsList-item:nth-of-type(odd){padding-right: 10px;}
.competitionsList-item:nth-of-type(even){padding-left: 10px;} .competitionsList-item:nth-of-type(even){padding-left: 10px;}
.competitionsList-item-tip{
position: absolute;top: 0px;left: 0px;height: 100%;background: rgba(0,0,0,0.5);right: 10px;justify-content: center;
align-items: center;display: -webkit-flex;
}
.strongNone{display: none!important;}
.competition-Img{width: 100%;height: 340px;} .competition-Img{width: 100%;height: 340px;}
.competition-Img img{border-radius: 4px 4px 0px 0px;} .competition-Img img{border-radius: 4px 4px 0px 0px;}
.status-tag {display: block;height: 30px;line-height: 30px;color: #fff;padding: 0px 20px;} .status-tag {display: block;height: 30px;line-height: 30px;color: #fff;padding: 0px 20px;}
@ -3399,10 +3468,10 @@ line-height: 16px;display: inline-block;color: rgba(65, 140, 205, 1) !important;
background: #fff;padding:30px;margin-bottom: 15px;display: flex; background: #fff;padding:30px;margin-bottom: 15px;display: flex;
} }
.upload_Title{ .upload_Title{
position: relative;margin-right: 30px;float: left;line-height: 35px;font-size: 16px; position: relative;margin-right: 30px;float: left;line-height: 35px;font-size: 16px;width: 32px;
} }
.upload_Title:before{ .upload_Title:before{
position: absolute;left: -10px;top:2px;content: '*';color: #FE4F4C; position: absolute;left: -10px;top:2px;content: '*';color: #FE4F4C;width: 32px;
} }
.librariesField{ .librariesField{
width: 100%;background: #F2F9FF;justify-content: center;align-items: center;display: -webkit-flex;text-align: center; width: 100%;background: #F2F9FF;justify-content: center;align-items: center;display: -webkit-flex;text-align: center;

@ -0,0 +1,5 @@
FactoryGirl.define do
factory :shixun_info do
end
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ShixunInfo, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save