竞赛头部调整
This commit is contained in:
parent
a03c0f68c2
commit
86bd5b97b1
|
@ -1,5 +1,6 @@
|
|||
#encoding: utf-8
|
||||
class ContestantWorksController < ApplicationController
|
||||
layout "base_contests"
|
||||
include ContestantWorksHelper
|
||||
include ApplicationHelper
|
||||
require 'bigdecimal'
|
||||
|
@ -90,7 +91,16 @@ class ContestantWorksController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
|
||||
#@score = student_work_score @work,User.current
|
||||
@is_teacher = User.current.admin_of_contest?(@contest) || User.current.judge_of_contest?(@contest) || User.current.admin?
|
||||
# if @homework.homework_detail_manual.comment_status == 2 && !@is_teacher && @work.user != User.current
|
||||
# @student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
|
||||
# else
|
||||
# @student_work_scores = student_work_score_record(@work)
|
||||
# end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -163,15 +173,88 @@ class ContestantWorksController < ApplicationController
|
|||
end
|
||||
|
||||
def edit
|
||||
|
||||
@user = User.current
|
||||
if Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") #编程作业不能修改作业|| 截止日期已到不能修改作业
|
||||
render_403
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html{ render :layout => "base_contests"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:student_work]
|
||||
@submit_result = true
|
||||
@work.name = params[:student_work][:name]
|
||||
@work.description = params[:student_work][:description]
|
||||
@work.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@work)
|
||||
if @work.save
|
||||
#如果学生作品被打分后修改,应该给老师提示
|
||||
#send_message_to_teacher(@work)
|
||||
if @contestwork.work_type == 3
|
||||
@student_work_project = @contestwork.contestant_work_projects.where("user_id=?",User.current.id).first
|
||||
student_work_projects = @contestwork.contestant_work_projects.where("contestant_work_id=? and is_leader =?",@work.id,0)
|
||||
user_ids = student_work_projects.empty? ? "(-1)" : "(" + student_work_projects.map{|stu|stu.user_id}.join(",") + ")"
|
||||
student_works = @contestwork.contestant_works.where("user_id in #{user_ids}")
|
||||
student_works.delete_all
|
||||
student_work_projects.delete_all
|
||||
members = params[:group_member_ids].split(',')
|
||||
for i in 1 .. members.count-1
|
||||
stu_work = ContestantWork.new(:name => @work.name, :description => @work.description,:user_id=> members[i].to_i, :work_id => @contestwork.id, :project_id => @work.project_id, :work_status => 3, :commit_time => @work.commit_time)
|
||||
if stu_work.save
|
||||
stu_project = ContestantWorkProject.new(:work_id => @contestwork.id, :contestant_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0, :contest_id => @contestwork.contest_id)
|
||||
stu_project.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
contest_message = ContestMessage.new(:user_id =>User.current.id,:content=>"edit",:contest_message_id=>@work.id,:contest_id => @contest.id,:contest_message_type=>"ContestantWork", :status => 9) #作品提交记录
|
||||
contest_message.save
|
||||
@student_work = @work
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
=begin
|
||||
respond_to do |format|
|
||||
format.html{redirect_to edit_student_work_url(@work)}
|
||||
end
|
||||
=end
|
||||
@submit_result = false
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @contestwork.work_type == 3
|
||||
pros = @work.contestant_work_projects.where("is_leader = 0")
|
||||
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||
student_works = @contestwork.contestant_works.where("user_id in #{user_ids}")
|
||||
student_works.delete_all
|
||||
pros.delete_all
|
||||
|
||||
project = @work.contestant_work_projects.where("is_leader = 1").first
|
||||
if @contestwork.work_detail_group.base_on_project
|
||||
project.update_attributes(:contestant_work_id => nil)
|
||||
else
|
||||
project.destroy
|
||||
end
|
||||
end
|
||||
@work.destroy
|
||||
@work.attachments.destroy_all
|
||||
#@work.student_works_scores.destroy_all
|
||||
@work.contest_messages.destroy_all
|
||||
#@work.student_work_tests.destroy_all
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
redirect_to contestant_works_path(:work => @contestwork.id)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def delete_work
|
||||
|
|
|
@ -3,7 +3,7 @@ class ContestsController < ApplicationController
|
|||
|
||||
include ContestsHelper
|
||||
|
||||
before_filter :find_contest, :only => [:show, :settings, :update, :contest_activities]
|
||||
before_filter :find_contest, :only => [:show, :settings, :update, :contest_activities, :search_member, :private_or_public, :switch_role]
|
||||
before_filter :is_logged, :only => [:index, :new, :create]
|
||||
layout "base_contests"
|
||||
|
||||
|
@ -100,6 +100,14 @@ class ContestsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def private_or_public
|
||||
@contest.update_attributes(:is_public => !@contest.is_public)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def settings
|
||||
@roles = ["管理人员","开发者","报告人员"]
|
||||
@members = @contest.member_principals.includes(:roles, :principal).all.sort
|
||||
|
@ -167,6 +175,33 @@ class ContestsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def switch_role
|
||||
members = @contest.contest_members.where("user_id = #{params[:user_id]}")
|
||||
unless members.blank?
|
||||
curr_role = ContestMemberRole.find_by_contest_member_id_and_role_id(members.first.id, params[:curr_role])
|
||||
tar_role = ContestMemberRole.find_by_contest_member_id_and_role_id(members.first.id, params[:tar_role])
|
||||
unless (curr_role.nil? || tar_role.nil?)
|
||||
curr_role.update_column('is_current', 0)
|
||||
tar_role.update_column('is_current', 1)
|
||||
end
|
||||
end
|
||||
redirect_to contest_path(@contest)
|
||||
end
|
||||
|
||||
def search_member
|
||||
if User.current.admin_of_contest?(@contest) || User.current.admin?
|
||||
q = "#{params[:name].strip}"
|
||||
@roles = Role.givable.all[11..13]
|
||||
if q.nil? || q == ""
|
||||
@members = @contest.member_principals.includes(:roles, :principal).all.sort
|
||||
else
|
||||
@members = searchmember_by_name(@contest.member_principals.includes(:roles, :principal).all.sort,q)
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_contest
|
||||
|
|
|
@ -52,6 +52,17 @@ class ZipdownController < ApplicationController
|
|||
else
|
||||
zipfile = {:message => "no file"}
|
||||
end
|
||||
elsif params[:obj_class] == "Work"
|
||||
homework = Work.find params[:obj_id]
|
||||
render_403 if User.current.admin_of_contest?(homework.contest)
|
||||
file_count = 0
|
||||
homework.contestant_works.map { |work| file_count += work.attachments.count}
|
||||
if file_count > 0
|
||||
zipfile = zip_homework_common homework
|
||||
else
|
||||
zipfile = {:message => "no file"}
|
||||
end
|
||||
|
||||
else
|
||||
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"
|
||||
end
|
||||
|
@ -159,6 +170,33 @@ class ZipdownController < ApplicationController
|
|||
}]
|
||||
end
|
||||
|
||||
def zip_contest_work homework_common
|
||||
bid_homework_path = []
|
||||
digests = []
|
||||
homework_common.contestant_works.each do |work|
|
||||
unless work.attachments.empty?
|
||||
out_file = zip_student_work_by_user(work)
|
||||
|
||||
bid_homework_path << out_file.file_path
|
||||
digests << out_file.file_digest
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
homework_id = homework_common.id
|
||||
user_id = homework_common.user_id
|
||||
out_file = find_or_pack(homework_id, user_id, digests.sort){
|
||||
zipping("#{Time.now.to_i}_#{homework_common.name}.zip",
|
||||
bid_homework_path, OUTPUT_FOLDER)
|
||||
}
|
||||
[{files:[out_file.file_path], count: 1, index: 1,
|
||||
real_file: out_file.file_path,
|
||||
file: File.basename(out_file.file_path),
|
||||
base64file: encode64(File.basename(out_file.file_path)),
|
||||
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
|
||||
}]
|
||||
end
|
||||
|
||||
def zip_homework_by_user(homework_attach)
|
||||
homeworks_attach_path = []
|
||||
not_exist_file = []
|
||||
|
@ -216,6 +254,39 @@ class ZipdownController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def zip_student_work_by_user(work)
|
||||
homeworks_attach_path = []
|
||||
not_exist_file = []
|
||||
# 需要将所有homework.attachments遍历加入zip
|
||||
digests = []
|
||||
work.attachments.each do |attach|
|
||||
if File.exist?(attach.diskfile)
|
||||
homeworks_attach_path << attach.diskfile
|
||||
digests << attach.digest
|
||||
else
|
||||
not_exist_file << attach.filename
|
||||
digests << 'not_exist_file'
|
||||
end
|
||||
end
|
||||
|
||||
#单个文件的话,不需要压缩,只改名
|
||||
out_file = nil
|
||||
if homeworks_attach_path.size == 1
|
||||
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
|
||||
des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work)}_#{File.basename(homeworks_attach_path.first)}"
|
||||
FileUtils.cp homeworks_attach_path.first, des_path
|
||||
des_path
|
||||
}
|
||||
else
|
||||
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
|
||||
zipping("#{make_zip_name(work)}.zip",
|
||||
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
|
||||
}
|
||||
end
|
||||
out_file
|
||||
|
||||
end
|
||||
|
||||
|
||||
def find_or_pack(homework_id, user_id, digests)
|
||||
raise "please given a pack block" unless block_given?
|
||||
|
|
|
@ -3048,10 +3048,10 @@ module ApplicationHelper
|
|||
|
||||
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
|
||||
def user_for_contest_work homework,is_contestant,work
|
||||
count = homework.contestant_works.count
|
||||
count = homework.contestant_works.has_committed.count
|
||||
if User.current.member_of_contest?(homework.contest)
|
||||
if !is_contestant #老师显示作品数量
|
||||
link_to "作品(#{count})", contestant_work_index_url_in_org(homework.id, 2), :class => "c_blue"
|
||||
link_to "作品(#{count})", contestant_works_path(:work =>homework.id, :tab => 2), :class => "c_blue"
|
||||
else #学生显示提交作品、修改作品等按钮
|
||||
work = cur_user_works_for_work homework
|
||||
project = cur_user_projects_for_work homework
|
||||
|
@ -3069,14 +3069,14 @@ module ApplicationHelper
|
|||
end
|
||||
else
|
||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
|
||||
link_to "修改作品(#{count})", edit_contestant_works_path(work.id),:class => 'c_blue'
|
||||
link_to "修改作品(#{count})", edit_contestant_work_path(work.id),:class => 'c_blue'
|
||||
else
|
||||
link_to "查看作品(#{count})", contestant_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "作业截止后不可修改作品"
|
||||
link_to "查看作品(#{count})", contestant_works_path(:work =>homework.id, :tab => 2), :class => 'c_blue', :title => "作业截止后不可修改作品"
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
link_to "作品(#{count})",contestant_work_index_url_in_org(homework.id, 2),:class => "c_blue"
|
||||
link_to "作品(#{count})",contestant_works_path(:work =>homework.id, :tab => 2),:class => "c_blue"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,2 +1,16 @@
|
|||
#encoding: utf-8
|
||||
module ContestantWorksHelper
|
||||
|
||||
def get_status status
|
||||
str = ""
|
||||
case status
|
||||
when 0
|
||||
str = "未提交"
|
||||
when 1
|
||||
str = "已提交"
|
||||
when 2
|
||||
str = "迟交"
|
||||
end
|
||||
str
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,4 +44,21 @@ module ContestsHelper
|
|||
def contest_contestants contest
|
||||
contest.contest_members.select{|cm| cm.roles.to_s.include?("Contestant")}
|
||||
end
|
||||
|
||||
def searchmember_by_name members, name
|
||||
#searchPeopleByRoles(project, StudentRoles)
|
||||
mems = []
|
||||
if name != ""
|
||||
name = name.to_s.downcase
|
||||
members.each do |m|
|
||||
username = m.user[:lastname].to_s.downcase + m.user[:firstname].to_s.downcase
|
||||
if(m.user[:login].to_s.downcase.include?(name) || m.user.user_extensions[:student_id].to_s.downcase.include?(name) || username.include?(name))
|
||||
mems << m
|
||||
end
|
||||
end
|
||||
else
|
||||
mems = members
|
||||
end
|
||||
mems
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<div class="syllabus_courses_box">
|
||||
<% @stundet_works.each_with_index do |student_work, i| %>
|
||||
<div class="syllabus_courses_list" id="student_work_<%= student_work.id%>" onclick="show_student_work('<%= contestant_work_path(student_work)%>');" style="cursor: default; background-color:#f6f6f6;">
|
||||
<%= render :partial => 'contest_evaluation_un_group_work', :locals => {:student_work => student_work} %>
|
||||
</div>
|
||||
<div id="about_hwork_<%= student_work.id %>" class="about_hwork"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1,65 @@
|
|||
<div class="sy_courses_open f14 fontGrey3">
|
||||
<div>
|
||||
<span class="fl" style="width:280px;">
|
||||
<span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span>
|
||||
<span class="fontGrey2 ml5 fl">
|
||||
<% if student_work.work_status %>
|
||||
<%= get_status student_work.work_status %>
|
||||
<% end %>
|
||||
</span>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<% if @contestwork.work_detail_group.base_on_project %>
|
||||
<div class="pr">
|
||||
<span class="fl fontGrey2">关联项目:</span>
|
||||
<div class="fl projectName">
|
||||
<% if student_work.project.status != 9 && (student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? || User.current.admin_of_contest?(@contestwork.contest) || User.current.judge_of_contest?(@contestwork.contest)) %>
|
||||
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称", :target => "_blank" %>
|
||||
<% elsif student_work.project.status != 9 %>
|
||||
<span class="fontBlue fr hidden" style="max-width:550px;" title="该项目是私有的"><%= student_work.project.name %></span>
|
||||
<% else %>
|
||||
<span class="fontGrey2 fr hidden" style="max-width:550px;" title="该项目已删除"><%= student_work.project.name %>(已删除)</span><% end %>
|
||||
<% project = student_work.project %>
|
||||
<div class="score-tip none tl f12" style="width:300px; top:-48px; right:-372px;">
|
||||
<em style="bottom:45px;"></em>
|
||||
<font style="bottom:45px;"></font>
|
||||
|
||||
<p class="fb break_word mw280"><%= project.name %><%= project.status == 9 ? "(已删除)" : ""%></p>
|
||||
|
||||
<p class="mb10">
|
||||
<span class="mr15">创建者:<%= project.creater %></span><span>成员数量:<%= project.members.count %></span></p>
|
||||
<% project_score = project.project_score %>
|
||||
<p>项目综合得分:<%= project.status == 9 ? 0 : static_project_score(project_score).to_i %></p>
|
||||
|
||||
<% if project.status != 9 %>
|
||||
<p>= 代码提交得分 + issue得分 + 资源得分 + 帖子得分</p>
|
||||
|
||||
<p>= <%= (project_score.changeset_num||0) * 4 %>
|
||||
+ <%= project_score.issue_num * 4 + project_score.issue_journal_num %> + <%= project_score.attach_num * 5 %>
|
||||
+ <%= project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="fl sy_p_grey" style="margin-left: 0px;">
|
||||
<span class="fl" style="width:180px;">提交时间:<%= format_date(student_work.commit_time) %></span>
|
||||
<span class="fl" style="width:105px; text-align: center">人数:<%=student_work.contestant_work_projects.count %>人</span>
|
||||
|
||||
<div class="flex-container fl" style="width:400px;">
|
||||
<div class="flex-cell">评委评分:--</div>
|
||||
<div class="flex-cell">最终成绩:--</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<script>
|
||||
$(".projectName").mouseenter(function () {
|
||||
$(this).children().next().show();
|
||||
}).mouseleave(function () {
|
||||
$(this).children().next().hide();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,42 @@
|
|||
<table class="hwork-table-wrap" id="homework_table">
|
||||
<%# if @homework.homework_type == 1 %>
|
||||
<%#= render :partial => 'evaluation_un_common_title' %>
|
||||
<%# elsif @homework.homework_type == 2 %>
|
||||
<%#= render :partial => 'evaluation_un_pro_title' %>
|
||||
<%# elsif @homework.homework_type == 3 %>
|
||||
<%#= render :partial => 'evaluation_un_group_title' %>
|
||||
<%# else %>
|
||||
<tr class="b_grey hworkH30">
|
||||
<th class="hworkList40 hworkH30 pl5 pr5">序号</th>
|
||||
<th class="hworkList50"> </th>
|
||||
<th class="hworkList190 pl5 pr5 hide-text">
|
||||
姓名
|
||||
</th>
|
||||
|
||||
<th class="hworkList80 pl5 pr5 hide-text">
|
||||
</th>
|
||||
|
||||
<th class="hworkList130">
|
||||
状态
|
||||
</th>
|
||||
<th class="hworkList100">
|
||||
评委评分
|
||||
</th>
|
||||
|
||||
<th class="hworkList100">
|
||||
最终成绩
|
||||
</th>
|
||||
</tr>
|
||||
<%# end %>
|
||||
<% @stundet_works.each_with_index do |student_work, i| %>
|
||||
<% score_open = true %>
|
||||
<a name="<%= student_work.id%>"></a>
|
||||
<%= render :partial => "contest_evaluation_un_work", :locals => {:student_work => student_work, :index => i, :score_open => score_open} %>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<div id="about_hwork_<%= student_work.id %>" class="about_hwork">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
|
@ -0,0 +1,37 @@
|
|||
<tr class="hworkListRow" id="student_work_<%= student_work.id%>">
|
||||
<td class="hworkList40 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
|
||||
<td class="hworkPortrait pr10 float-none">
|
||||
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_path(student_work.user), :target => '_blank') %>
|
||||
</td>
|
||||
<td class="hworkStName190 pr10 float-none hidden" title="<%= student_work.user.show_name%>" style="cursor:pointer;">
|
||||
<%= link_to student_work.user.show_name ,user_path(student_work.user), :target => '_blank' %>
|
||||
</td>
|
||||
|
||||
<td class="hworkList80 student_work_<%= student_work.id%>" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">
|
||||
</td>
|
||||
|
||||
<td class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= contestant_work_path(student_work)%>');" style="cursor: pointer;">
|
||||
<% if student_work.work_status%>
|
||||
<%=get_status student_work.work_status %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="hworkList100 <%= score_color nil %>">
|
||||
--
|
||||
</td>
|
||||
|
||||
<td class="hworkList100 <%= score_color nil %> student_final_scor_info pr">
|
||||
--
|
||||
</td>
|
||||
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>
|
||||
</tr>
|
||||
<%# end %>
|
||||
<script type="text/javascript">
|
||||
$(".student_work_<%= student_work.id%>").mouseenter(function(){
|
||||
if($("#about_hwork_<%= student_work.id%>").html().trim() == "") {
|
||||
$("#work_click_<%= student_work.id%>").show();
|
||||
}
|
||||
}).mouseleave(function(){
|
||||
$("#work_click_<%= student_work.id%>").hide();
|
||||
}).mouse;
|
||||
</script>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<% attachments.each_with_index do |attachment,i| %>
|
||||
<div id="attachment_<%= attachment.id%>">
|
||||
<span class="fl">
|
||||
<span title="点击可下载">
|
||||
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%>
|
||||
</span>
|
||||
</span>
|
||||
<% if attachment.id && User.current == attachment.author && (attachment.attachtype == 7 || @contestwork.end_time >= Date.today) %>
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
|
||||
<% end %>
|
||||
<span class="postAttSize">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
<span class="author">
|
||||
<%= format_time(attachment.created_on) %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end -%>
|
|
@ -0,0 +1,55 @@
|
|||
<div class="fl pr" style="padding-bottom:10px; width:720px;">
|
||||
<span class="c_dark f14 fb fl mr10">
|
||||
作品
|
||||
<font class="f12 c_red">
|
||||
<% if @contestwork.work_type == 3 %>
|
||||
<% member_count = @contestwork.contestant_works.where("work_status != 0").count %>
|
||||
(<%= @student_work_count%>组<%=member_count %>人已交)
|
||||
<% else %>
|
||||
(<%= @student_work_count%>人已交)
|
||||
<% end %>
|
||||
</font>
|
||||
<%# my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
|
||||
<% my_work = cur_user_works_for_work @contestwork %>
|
||||
<% if !@is_teacher && !@is_judge && my_work.nil? && User.current.member_of_contest?(@contest) %>
|
||||
<span class="f12 c_red">您尚未提交作品</span>
|
||||
<% unless @contestwork.work_type == 3 && @contestwork.work_detail_group.base_on_project %>
|
||||
<%=link_to "提交作品", new_contestant_work_path(:work => @contestwork.id),:class => 'blueCir ml5 f12' %>
|
||||
<% end %>
|
||||
<% elsif !@is_teacher && !@is_judge && my_work &&Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">截止日期已过,已提交且不可修改</span>
|
||||
<% elsif !@is_teacher && !@is_judge && my_work &&Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<% if @contestwork.work_type == 3 %>
|
||||
<span class="f12 c_red">组长已提交,组长还可修改</span>
|
||||
<% else %>
|
||||
<span class="f12 c_red">您已提交,您还可以修改</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
<%# if !@is_teacher && !@is_judge && @contestwork.work_type == 3 && my_work && my_work.user == User.current && Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") %>
|
||||
<!--<div class="mt5 fr">-->
|
||||
<!--<a href="javascript:void(0);" class="memberBtn fl mt3" title="添加小组成员" onclick="add_or_delete_group_member();">合作成员</a>-->
|
||||
<!--</div>-->
|
||||
<%# end %>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="fl">
|
||||
<% if @contestwork.work_type != 3%>
|
||||
<%= render :partial => "contest_evaluation_un_title"%>
|
||||
<% else %>
|
||||
<%= render :partial => "contest_evaluation_un_group"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
// function add_or_delete_group_member() {
|
||||
// var html_value = "<%#= escape_javascript(render :partial => 'student_work/add_or_delete_member',:locals => {:homework=>@homework,:edit_mode => true}) %>";
|
||||
// pop_up_box(html_value, 530);
|
||||
// }
|
||||
</script>
|
|
@ -0,0 +1,49 @@
|
|||
<div class="syllabus_courses_box">
|
||||
<% projects.each do |project|%>
|
||||
<% allow_visit = project.status != 9 && (project.is_public || User.current.member_of?(project) || User.current.admin? || User.current.admin_of_contest?(@contestwork.contest) || User.current.judge_of_contest?(@contestwork.contest)) %>
|
||||
<div class="syllabus_courses_list" style="cursor: default">
|
||||
<div class="sy_courses_open">
|
||||
<% projectUser = User.where("id=?",project.user_id).first %>
|
||||
<% is_change = project.status == 9 && projectUser == User.current && @contestwork.contestant_works.has_committed.where("user_id = #{User.current.id}").count == 1 %>
|
||||
<h3>
|
||||
<% if allow_visit %>
|
||||
<%= link_to "#{project.name}", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
|
||||
<% elsif project.status != 9 %>
|
||||
<a href="javascript:void(0)" class="new_project_title fl" title="私有项目不可访问"><%=project.name %></a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0)" onclick="alert_notice_box();" class="new_project_title fl" title="项目已删除"><%=project.name %></a>
|
||||
<% end %>
|
||||
</h3>
|
||||
<span class="<%= project.is_public? ? 'syllabus_class_open' : 'syllabus_class_private' %> fl ml10 mt3 syllabus_class_property"><%= project.is_public? ? '公开' : '私有' %></span>
|
||||
<%# if is_change %>
|
||||
<!--<a href="javascript:void(0)" onclick="alert_change_project();" class="btn_grey_mid mt-5 ml10 fr">更换项目</a>-->
|
||||
<%# end %>
|
||||
<%=link_to "<span class='fr grayTxt hidden mw150'>创建者:#{projectUser.show_name}</span>".html_safe, user_path(projectUser), :title => "#{projectUser.show_name}" %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div>
|
||||
<p class="fl sy_p_grey" style="margin-left: 0">更新时间:<%= format_date(project.updated_on) %></p>
|
||||
<div class=" fr">
|
||||
<p class="list-info fr grayTxt">
|
||||
<%= link_to project.members.count, allow_visit ? member_project_path(project) : 'javascript:void(0)', :class => "c_blue" %><span class="mr5">成员 |</span>
|
||||
<%= link_to project.project_score.issue_num, allow_visit ? project_issues_path(project) : 'javascript:void(0)', :class => "c_blue" %><span class="mr5">问题 |</span>
|
||||
<%= link_to project.project_score.changeset_num, visible_repository?(project) ? ({:controller => 'repositories', :action => 'show', :id => project, :repository_id => gitlab_repository(project).try(:identifier)}) : 'javascript:void(0)', :class => "c_blue" %><span>提交</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div><!--syllabus_courses_box end-->
|
||||
<script>
|
||||
function alert_notice_box(){
|
||||
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">项目已删除,链接无效</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
}
|
||||
// function alert_change_project(){
|
||||
// var htmlvalue = "<%#= escape_javascript(render :partial => 'student_work/change_project') %>";
|
||||
// pop_box_new(htmlvalue, 400, 285);
|
||||
// }
|
||||
</script>
|
|
@ -0,0 +1,149 @@
|
|||
<div class="show_hwork_arrow"></div>
|
||||
<div class="showHwork">
|
||||
<% is_teacher = User.current.admin_of_contest?(@contestwork.contest) || User.current.judge_of_contest?(@contestwork.contest) || User.current.admin? %>
|
||||
<% if @contestwork.work_type != 3 %>
|
||||
<% is_my_work = work.user == User.current%>
|
||||
<% else %>
|
||||
<% pro = @contestwork.contestant_work_projects.where(:user_id => User.current.id).first %>
|
||||
<% is_my_work = pro && pro.contestant_work_id == work.id%>
|
||||
<% end %>
|
||||
<% is_member_work = @contestwork.work_type == 3 && work.contestant_work_projects.empty? %>
|
||||
<% if !is_member_work %>
|
||||
<ul>
|
||||
<li class="fl" >
|
||||
<span class="tit_fb">上交时间:</span>
|
||||
<%=format_time work.commit_time %>
|
||||
</li>
|
||||
|
||||
<% if work.user == User.current && Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
|
||||
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
|
||||
<li class="fr" >
|
||||
<%= link_to("", contestant_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %>
|
||||
</li>
|
||||
<li class="fr mr5" >
|
||||
<%= link_to "",edit_contestant_work_path(work),:class => "pic_edit",:title => "修改"%>
|
||||
</li>
|
||||
<% end%>
|
||||
|
||||
<div class="cl"></div>
|
||||
|
||||
<!--<li ><span class="tit_fb"> 参与人员:</span>程梦雯 王强</li>-->
|
||||
<% if @contestwork.work_type == 3 && work.contestant_work_projects %>
|
||||
<div class="cl"></div>
|
||||
<li>
|
||||
<span class="tit_fb"> 参与人员:</span>
|
||||
<%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%>
|
||||
<% members = work.contestant_work_projects.where("is_leader = 0") %>
|
||||
<% members.each do |member| if !members.empty? %>
|
||||
、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% if @contestwork.work_detail_group.base_on_project %>
|
||||
<li>
|
||||
<span class="tit_fb"> 关联项目:</span>
|
||||
<% if work.project_id == 0 || work.project_id.nil? %>
|
||||
<span>暂无</span>
|
||||
<% elsif work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %>
|
||||
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
|
||||
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
|
||||
<% else %>
|
||||
<span title ="该项目是私有的"><%=work.project.name %></span>
|
||||
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
|
||||
<% end %>
|
||||
<%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end%>
|
||||
|
||||
<li>
|
||||
<span class="tit_fb ">内容:</span>
|
||||
<div class="showHworkP break_word upload_img" id="student_work_img_<%=work.id %>">
|
||||
<%= work.description.html_safe if work.description%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<span class="tit_fb"> 附件:</span>
|
||||
<% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %>
|
||||
<% if com_attachments.empty?%>
|
||||
<span style="color: #999999">尚未提交附件</span>
|
||||
<% else%>
|
||||
<div class="fl" style="width: 90%;">
|
||||
<%= render :partial => 'contest_work_attachments_status', :locals => {:attachments => com_attachments, :status => 1} %>
|
||||
</div>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<!--<li >-->
|
||||
<!--<%# if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>-->
|
||||
<!--<!– 老师 || 开启匿评状态 && 不是当前用户自己的作品 –>-->
|
||||
<!--<div id="add_student_score_<%#= work.id%>" class="mt10 evaluation">-->
|
||||
<!--<%#= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>-->
|
||||
<!--</div>-->
|
||||
<!--<%# end%>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</li>-->
|
||||
</ul>
|
||||
|
||||
<!--<div id="revise_attachment">-->
|
||||
<!--<%#= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>-->
|
||||
<!--</div>-->
|
||||
<div class="cl"></div>
|
||||
<% else %>
|
||||
<!--<ul>-->
|
||||
<!--<li >-->
|
||||
<!--<%# if @is_teacher %>-->
|
||||
<!--<!– 老师 –>-->
|
||||
<!--<div id="add_student_score_<%#= work.id%>" class="mt10 evaluation">-->
|
||||
<!--<%#= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>-->
|
||||
<!--</div>-->
|
||||
<!--<%# end%>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<% end %>
|
||||
|
||||
<!--<div class="ping_box fl" id="score_list_<%#= work.id%>" style="<%#= student_work_scores.empty? ? 'padding:0px;' : ''%>">-->
|
||||
<!--<%#= render :partial => 'student_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => is_member_work} %>-->
|
||||
<!--</div>-->
|
||||
<div class="cl"></div>
|
||||
<!---ping_box end--->
|
||||
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('student_work_img_<%=work.id %>');
|
||||
<% if defined?(is_focus) && is_focus.to_i == 1 %>
|
||||
$("#upload_revise_attachment").click();
|
||||
<% end %>
|
||||
});
|
||||
// function show_upload(){
|
||||
// var htmlvalue = "<%#= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>";
|
||||
// pop_box_new(htmlvalue, 500, 230);
|
||||
// }
|
||||
function regex_des() {
|
||||
if ($.trim($("#attachment_des").val()) == "") {
|
||||
$("#hint_message").text("附件描述不能为空");
|
||||
$("#hint_message").css('color','#ff0000');
|
||||
return false;
|
||||
} else {
|
||||
$("#hint_message").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function submit_revise_files(){
|
||||
if (regex_des()) {
|
||||
$("#upload_form").submit();
|
||||
}
|
||||
}
|
||||
function closeModal(){
|
||||
hideModal($(".uploadBoxContainer"));
|
||||
}
|
||||
function disable_choose(){
|
||||
if ($("#attachments_fields .attachment").size() >= 1) {
|
||||
$("#choose_revise_attach").attr("onclick","return false;").addClass(disable_link);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,43 @@
|
|||
<div id="popbox02">
|
||||
<div class="ni_con">
|
||||
<span class="f16 fontBlue fb">请您确认刚刚上传的作品信息</span>
|
||||
<p class="f14 mt5">
|
||||
<span class="fb">作品名称:</span><%=@student_work.name%>
|
||||
</p>
|
||||
<div class="f14 mt5 break_word" style="max-width: 425px; color:#808181; max-height:300px; overflow-x:hidden; overflow-y: auto;">
|
||||
<div class="fb fl dis">作品描述:</div>
|
||||
<div class="upload_img fl" style="max-width: 330px;"><%=@student_work.description.html_safe %></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="mt5">
|
||||
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
|
||||
<% if @student_work.attachments.empty? %>
|
||||
<span class="fl c_red"><%= "无附件"%></span>
|
||||
<% else %>
|
||||
<div class="fl grey_c">
|
||||
<% @student_work.attachments.each_with_index do |attachment,i| %>
|
||||
<div id="attachment_<%= attachment.id%>">
|
||||
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
|
||||
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end -%>
|
||||
<%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<div class="ni_btn mt10">
|
||||
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 15px; margin-left: 55px;" >
|
||||
确 定
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function clickOK() {
|
||||
window.location.href= "<%= contestant_works_path(:work =>@contestwork.id, :tab => 2) %>"
|
||||
}
|
||||
</script>
|
|
@ -39,6 +39,6 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
function clickOK() {
|
||||
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/contestant_work?work=" + "<%= @contestwork.id%>&tab=2"
|
||||
window.location.href= "<%= contestant_works_path(:work =>@contestwork.id, :tab => 2) %>"
|
||||
}
|
||||
</script>
|
|
@ -11,26 +11,25 @@
|
|||
</div>
|
||||
<%=get_cw_status(homework).html_safe %>
|
||||
<div class="cl"></div>
|
||||
<% if homework.work_type == 3 && work.work_detail_group.base_on_project %>
|
||||
<% if homework.work_type == 3 && homework.work_detail_group.base_on_project %>
|
||||
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
|
||||
<% elsif homework.work_type == 3 && !homework.work_detail_group.base_on_project%>
|
||||
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
|
||||
<% end %>
|
||||
|
||||
<% is_pro = homework.homework_type == 2 && is_teacher %>
|
||||
<% is_base_group = homework.homework_type == 3 && (homework.homework_detail_group.base_on_project == 1 || !(cur_user_works_for_homework(homework).nil?)) && !is_teacher %>
|
||||
<% is_base_group = homework.work_type == 3 && (homework.work_detail_group.base_on_project || !(cur_user_works_for_work(homework).nil?)) && !is_teacher %>
|
||||
<div class="mt8 mb5">
|
||||
<%= render :partial => 'users/homework_opr', :locals => {:activity => homework, :is_teacher => is_teacher, :hw_status => 5, :user_activity_id => homework.id} %>
|
||||
<% if is_pro || is_base_group %>
|
||||
<%= render :partial => 'users/work_opr', :locals => {:activity => homework, :is_teacher => is_teacher, :hw_status => 5, :user_activity_id => homework.id} %>
|
||||
<% if is_base_group %>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% if !homework.publish_time.nil? %>
|
||||
<div class="homepagePostDeadline <%= (is_pro || is_base_group) ? 'mt8' : '' %>">
|
||||
<div class="homepagePostDeadline <%= is_base_group ? 'mt8' : '' %>">
|
||||
<%= l(:label_publish_time)%>:<%= homework.publish_time%> 00:00
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !homework.end_time.nil? %>
|
||||
<div class="homepagePostDeadline ml15 <%= (is_pro || is_base_group) ? 'mt8' : '' %>">提交截止时间:<%= homework.end_time.to_s %> 23:59</div>
|
||||
<div class="homepagePostDeadline ml15 <%= is_base_group ? 'mt8' : '' %>">提交截止时间:<%= homework.end_time.to_s %> 23:59</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
@ -41,47 +40,18 @@
|
|||
<%= homework.description.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<% if is_pro %>
|
||||
<div class="mt10"> <span class="fontGrey3">测试集:<%=homework.homework_tests.count %>组</span>
|
||||
<table class="mt5 test-set-table">
|
||||
<tr>
|
||||
<th width="25"> </th>
|
||||
<th width="290" style="max-width:290px;">测试集输入</th>
|
||||
<th width="290" style="max-width:290px;">测试集输出</th>
|
||||
</tr>
|
||||
<% homework.homework_tests.each_with_index do |test, i| %>
|
||||
<tr>
|
||||
<td class="test_td_min"><%=i+1 %></td>
|
||||
<td><pre style="max-width:290px; word-wrap:break-word; white-space:pre-wrap;"><%=test.input %></pre></td>
|
||||
<td><pre style="max-width:290px; word-wrap:break-word; white-space:pre-wrap;"><%=test.output %></pre></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<% if homework.homework_detail_manual%>
|
||||
<% if homework.homework_detail_manual.comment_status == 1%>
|
||||
<% end_time = homework.end_time.to_time.to_i + 24*60*60 - 1 %>
|
||||
<% if end_time >= Time.now.to_i %>
|
||||
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
|
||||
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
|
||||
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
|
||||
<% else %>
|
||||
<div class="fontGrey2 db fr c_red">提交已截止</div>
|
||||
<% end %>
|
||||
<% elsif homework.homework_detail_manual.comment_status == 2%>
|
||||
<% end_time = homework.homework_detail_manual.evaluation_end.to_time.to_i + 24*60*60 - 1 %>
|
||||
<% if end_time >= Time.now.to_i %>
|
||||
<div class="fontGrey2 db fr">匿评剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60)%></span> 天
|
||||
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
|
||||
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
|
||||
<% else %>
|
||||
<div class="fontGrey2 db fr c_red">匿评已截止</div>
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% end%>
|
||||
<% if homework.work_status == 1%>
|
||||
<% end_time = homework.end_time.to_time.to_i + 24*60*60 - 1 %>
|
||||
<% if end_time >= Time.now.to_i %>
|
||||
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
|
||||
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
|
||||
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
|
||||
<% else %>
|
||||
<div class="fontGrey2 db fr c_red">提交已截止</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -91,6 +61,6 @@
|
|||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => homework} %>
|
||||
</div>
|
||||
|
||||
<%= render :partial => "users/homework_base_info", :locals =>{:activity => homework, :user_activity_id =>homework.id, :is_teacher => is_teacher, :hw_status => 5} %>
|
||||
<%= render :partial => "users/contest_work_base_info", :locals =>{:activity => homework, :user_activity_id =>homework.id, :is_teacher => is_teacher, :hw_status => 5} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1,250 @@
|
|||
<% content_for :header_tags do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<%= javascript_include_tag 'homework','baiduTemplate' %>
|
||||
<% end %>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner mb10">
|
||||
<div class="NewsBannerName">编辑作品</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="HomeWork" id="users_setting">
|
||||
|
||||
<div class="HomeWorkBox">
|
||||
<div class="">
|
||||
<div class="homepagePostTitle fl m_w530 hidden">
|
||||
<%= @contestwork.name%>(作业名称)
|
||||
</div>
|
||||
<span class="fr c_grey">
|
||||
截止时间:<%= @contestwork.end_time%>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class="c_blue">
|
||||
<%= link_to @contestwork.user.show_name, user_activities_path(@contestwork.user_id), :class => "c_blue"%>
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
<div class="HomeWorkP break_word">
|
||||
<%= @contestwork.description.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
</div><!----HomeWorkBox end-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="HomeWorkCon mt15" nhname='student_work_form'>
|
||||
<%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%>
|
||||
<div class="cl"></div>
|
||||
<% if @contestwork.work_type == 3 %>
|
||||
<span id="min_num_member" style="display: none"><%=@contestwork.work_detail_group.min_num %></span>
|
||||
<span id="max_num_member" style="display: none"><%=@contestwork.work_detail_group.max_num %></span>
|
||||
<% str = User.current.id.to_s%>
|
||||
<% @work.contestant_work_projects.where("is_leader = ?", 0).each do |pro| %>
|
||||
<% str += ','+pro.user_id.to_s %>
|
||||
<% end %>
|
||||
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %>
|
||||
<% end %>
|
||||
<div>
|
||||
<input type="text" name="student_work[name]" id="student_work_name" placeholder="请输入作品名称" class="InputBox W700" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_name_span" class="c_red mb10"></p>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<textarea placeholder="请输入作品描述" style="display: none" nhname='student_work_textarea' name="student_work[description]"><%= @work.description%></textarea>
|
||||
<!--<textarea name="student_work[description]" id="student_work_description" placeholder="请输入作品描述" class="InputBox W700 H150" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%#= @work.description%></textarea>-->
|
||||
<!--<script>
|
||||
var text = document.getElementById("student_work_description");
|
||||
autoTextarea(text);// 调用
|
||||
</script>-->
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_description_textarea" class="c_red mb10"></p>
|
||||
<p id="e_tip" class="c_grey"></p>
|
||||
<p id="e_tips" class="c_grey"></p>
|
||||
</div>
|
||||
|
||||
<div class="mt10 mb10">
|
||||
<span class="fl fontGrey2 group_detail_info"></span>
|
||||
<div class="cl"></div>
|
||||
<span class="fl fontGrey2" id="group_members"></span>
|
||||
<div class="cl"></div>
|
||||
<% if @contestwork && @contestwork.work_type == 3 %>
|
||||
<sapn class="fl fontGrey2" id="group_members_show">
|
||||
合作成员:<%= User.current.show_name %>(组长)
|
||||
</sapn>
|
||||
<span id="student_work_group_textarea" class="ml10 c_red fl"></span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<span class="fl fontGrey2" id="relate_project_show">
|
||||
<% if @contestwork && @contestwork.work_type == 3 && @contestwork.work_detail_group.base_on_project %>
|
||||
<% unless @contestwork.contestant_work_projects.where("user_id = #{User.current.id}").empty? %>
|
||||
<% project = Project.find @contestwork.contestant_work_projects.where("user_id = #{User.current.id}").first.project_id %>
|
||||
关联项目:<%= project.name %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="homework_attachments">
|
||||
<%= render :partial => 'contestant_work_attachment', :locals => {:container => @work} %>
|
||||
</div>
|
||||
|
||||
<% if @contestwork.work_type == 3 %>
|
||||
<div class="mt5 fl">
|
||||
<a href="javascript:void(0);" class="memberBtn fl mt3 mr15" title="请添加小组的其他成员" onclick="show_group_member();">合作成员</a>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="mt5">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<%= link_to "取消", contestant_work_path(:work => @contestwork.id), :class => "fr mr10 mt3"%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
</div><!----HomeWorkCon end-->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
<% if @contestwork.work_detail_group %>
|
||||
$(function(){
|
||||
<%members = @work.contestant_work_projects.where("is_leader =?",0) %>
|
||||
var str = $('#group_members_show').html();
|
||||
<% members.each do |member| %>
|
||||
str += '、<%= (User.find member.user_id).show_name %>';
|
||||
<% end %>
|
||||
$('#group_members_show').html(str);
|
||||
$('span.group_detail_info').text('分组人数:<%=@contestwork.work_detail_group.min_num %>-<%=@contestwork.work_detail_group.max_num %> 人');
|
||||
});
|
||||
<% end %>
|
||||
// 添加组成员
|
||||
function show_group_member() {
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'choose_group_member',:locals => {:homework=>@contestwork,:edit_mode => true}) %>');
|
||||
showModal('ajax-modal', '528px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("addMemberCP");
|
||||
}
|
||||
|
||||
function popupRegex(){
|
||||
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
|
||||
function nh_check_field(params){
|
||||
var result=true;
|
||||
if(!regexStudentWorkName()) {
|
||||
result=false;
|
||||
return result;
|
||||
}
|
||||
if(params.content!=undefined){
|
||||
if(params.content.isEmpty()){
|
||||
result=false;
|
||||
}
|
||||
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
||||
params.textarea.html(params.content.html());
|
||||
params.content.sync();
|
||||
|
||||
if(params.content.isEmpty()){
|
||||
params.contentmsg.html('作品描述不能为空');
|
||||
}else{
|
||||
params.contentmsg.html('');
|
||||
}
|
||||
}
|
||||
if(!result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if($("#group_member_ids").length > 0) {
|
||||
result=regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function init_homework_form(params){
|
||||
params.form.submit(function(){
|
||||
params.textarea.html(params.editor.html());
|
||||
params.editor.sync();
|
||||
var flag = false;
|
||||
if(params.form.attr('data-remote') != undefined ){
|
||||
flag = true
|
||||
}
|
||||
var is_checked = nh_check_field({
|
||||
issubmit:true,
|
||||
content:params.editor,
|
||||
contentmsg:params.contentmsg,
|
||||
textarea:params.textarea
|
||||
});
|
||||
|
||||
if(is_checked){
|
||||
if(flag){
|
||||
popupRegex();
|
||||
return true;
|
||||
}else{
|
||||
$(this)[0].submit();
|
||||
$("#ajax-indicator").hide();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function init_homework_editor(params){
|
||||
params.textarea.removeAttr('placeholder');
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px",
|
||||
items : ['code','emoticons','fontname',
|
||||
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
|
||||
'formatblock', 'fontsize', '|','indent', 'outdent',
|
||||
'|','imagedirectupload','table', 'media', 'preview',"more"
|
||||
],
|
||||
afterChange:function(){//按键事件
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
//paramsHeight = params.kindutil.removeUnit(this.height);
|
||||
edit.iframe.height(150);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150));
|
||||
},
|
||||
afterCreate:function(){
|
||||
//init
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.iframe[0].scroll = 'no';
|
||||
body.style.overflowY = 'hidden';
|
||||
//reset height
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.html(params.textarea.innerHTML);
|
||||
//paramsHeight = params.kindutil.removeUnit(this.height);
|
||||
edit.iframe.height(150);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150));
|
||||
elocalStorage(editor2,'student_work_<%=@work.id %>');
|
||||
}
|
||||
}).loadPlugin('paste');
|
||||
return editor;
|
||||
}
|
||||
KindEditor.ready(function(K){
|
||||
$("div[nhname='student_work_form']").each(function(){
|
||||
var params = {};
|
||||
params.kindutil = K;
|
||||
params.div_form = $(this);
|
||||
params.form = $("form",params.div_form);
|
||||
if(params.form==undefined || params.form.length==0){
|
||||
return;
|
||||
}
|
||||
params.textarea = $("textarea[nhname='student_work_textarea']",params.div_form);
|
||||
params.contentmsg = $("#student_work_description_textarea");
|
||||
params.submit_btn = $("#new_message_submit_btn");
|
||||
if(params.textarea.data('init') == undefined) {
|
||||
params.editor = init_homework_editor(params);
|
||||
editor2 = params.editor;
|
||||
init_homework_form(params);
|
||||
params.submit_btn.click(function () {
|
||||
params.form.submit();
|
||||
$("#ajax-indicator").hide();
|
||||
});
|
||||
params.textarea.data('init', 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -116,28 +116,28 @@
|
|||
<!---menu_r end--->
|
||||
</div>
|
||||
<!--div class="hworkInfor"><a href="javascript:void(0);" class="linkBlue">作业信息</a></div-->
|
||||
<% if @is_teacher%>
|
||||
<div class="fr mt5">
|
||||
<ul class="">
|
||||
<li class="pr export_icon_li">
|
||||
<a href="javascript:void(0);" class="export_icon linkBlue2">导出</a>
|
||||
<ul class="hworkMenu" style="top: 30px; left: -100px;">
|
||||
<%# if @is_teacher%>
|
||||
<!--<div class="fr mt5">-->
|
||||
<!--<ul class="">-->
|
||||
<!--<li class="pr export_icon_li">-->
|
||||
<!--<a href="javascript:void(0);" class="export_icon linkBlue2">导出</a>-->
|
||||
<!--<ul class="hworkMenu" style="top: 30px; left: -100px;">-->
|
||||
<!--<!–<li>–>-->
|
||||
<!--<!–<%#= link_to "导出作业成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :group => @group, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>–>-->
|
||||
<!--<!–</li>–>-->
|
||||
<!--<li>-->
|
||||
<!--<%#= link_to "导出作业成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :group => @group, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>-->
|
||||
<!--<%# if @contestwork.contestant_works.empty?%>-->
|
||||
<!--<%#= link_to "导出作业附件", "javascript:void(0)", class: "hworkExport resourcesGrey", :onclick => "alert('没有学生提交作业,无法下载附件')" %>-->
|
||||
<!--<%# else%>-->
|
||||
<!--<%#= link_to "导出作业附件", zipdown_assort_path(obj_class: @contestwork.class, obj_id: @contestwork, format: :json),-->
|
||||
<!--remote: true, class: "hworkExport resourcesGrey", :id => "download_homework_attachments" %>-->
|
||||
<!--<%# end%>-->
|
||||
<!--</li>-->
|
||||
<li>
|
||||
<% if @contestwork.contestant_works.empty?%>
|
||||
<%= link_to "导出作业附件", "javascript:void(0)", class: "hworkExport resourcesGrey", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
|
||||
<% else%>
|
||||
<%= link_to "导出作业附件", zipdown_assort_path(obj_class: @contestwork.class, obj_id: @contestwork, format: :json),
|
||||
remote: true, class: "hworkExport resourcesGrey", :id => "download_homework_attachments" %>
|
||||
<% end%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end%>
|
||||
<!--</ul>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
<%# end%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
|
@ -170,7 +170,7 @@
|
|||
<div class="hworkListContainer">
|
||||
<div class="ctt2">
|
||||
<div class="dis" id="homework_student_work_list">
|
||||
<%= render :partial => "student_work/student_work_list"%>
|
||||
<%= render :partial => "contestant_work_list"%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -182,7 +182,7 @@
|
|||
<% student_work_projects = @contestwork.contestant_work_projects.where("contestant_work_id in #{student_work_ids} or contestant_work_id is null") %>
|
||||
<% project_ids = student_work_projects.blank? ? "(-1)" : "(" + student_work_projects.map{|pro| pro.project_id}.join(",") + ")" %>
|
||||
<% projects = Project.where("id in #{project_ids}").order("updated_on desc") %>
|
||||
<%= render :partial => "student_work/relate_projects", :locals => {:projects => projects}%>
|
||||
<%= render :partial => "relate_projects", :locals => {:projects => projects}%>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
if($("#about_hwork_<%= @work.id%>").children().length > 0){
|
||||
$("#about_hwork_<%= @work.id%>").html("");
|
||||
}
|
||||
else{
|
||||
$(".about_hwork").html("");
|
||||
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work}) %>");
|
||||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<% if @submit_result%>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'work_edit_information') %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
<% else %>
|
||||
window.location.href = '<%= edit_contestant_work_path(@work)%>';
|
||||
<% end %>
|
||||
|
||||
function clickCanel() {
|
||||
hideModal('#popbox02');
|
||||
window.location.href= "<%= contestant_works_path(:work =>@contestwork.id, :tab => 2) %>"
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<p class="sy_cgrey mb10">
|
||||
<%= link_to @contest.user.try(:show_name), user_path(@contest.user), :class => "sy_cgrey" %>
|
||||
<span class="sy_cgrey"> > </span>
|
||||
<%= link_to @contest.name, contest_path(@contest), :class => "sy_cgrey" %>
|
||||
</p>
|
||||
<% if User.current.admin_of_contest?(@contest) %>
|
||||
<%= render :partial => "contests/mamager_setting" %>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="banner-game"><img src="/images/game/banner-game.png" width="968" height="110"/></div>
|
||||
<div class="sy_class_info fl">
|
||||
<div class="sy_class_titbox">
|
||||
<h3 class="fl sy_class_title"><%= @contest.name %></h3>
|
||||
<% if @contest.is_public %>
|
||||
<span class="hw_icon_open fl ml5 mt3"></span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="sy_cgrey ">
|
||||
<span class=" mr15">管理员:<a class="sy_cblue"><%= contest_managers(@contest).count %></a></span>
|
||||
<span class=" mr15">评委:<a class="sy_cblue"><%= contest_judges(@contest).count %></a></span>
|
||||
<span class=" mr15">参赛者:<a class="sy_cblue"><%= contest_contestants(@contest).count %></a></span>
|
||||
</p>
|
||||
</div>
|
||||
<% if User.current.member_of_contest?(@contest) %>
|
||||
<% if @contest.contest_members.where(:user_id => User.current.id)[0].contest_member_roles.count == 2 %>
|
||||
<% if User.current.admin_of_contest?(@contest) %>
|
||||
<%= link_to '评委身份', switch_role_contest_path(@contest, :user_id => User.current.id, :curr_role => 13, :tar_role => 14), :class => "fr sy_btn_blue mt28 ml10", :title => "由管理员身份切换至评委身份" %>
|
||||
<% elsif User.current.judge_of_contest?(@contest) %>
|
||||
<%= link_to '管理员身份', switch_role_contest_path(@contest, :user_id => User.current.id, :curr_role => 14, :tar_role => 13), :class => "fr sy_btn_blue mt28 ml10", :title => "由评委身份切换至管理员身份" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to "加入竞赛",join_contest_contests_path(),:remote => true, :method => "get", :class => "fr sy_btn_blue mt28 ml10" %>
|
||||
<% end %>
|
||||
<span class="fr mt30 f16"> 邀请码:<span class="sy_corange"><%= @contest.invite_code %></span></span>
|
||||
<div class="cl"></div>
|
|
@ -2,10 +2,10 @@
|
|||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">设为私有</a></li>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">暂停加入</a></li>
|
||||
<li><%= link_to "配置", {:controller => 'contests', :action => 'settings', :id => @contest}, :class => "sy_class_option" %></li>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
|
||||
<li><%= link_to !@contest.is_public ? "设为公开" : "设为私有", {:controller => 'contests', :action => 'private_or_public', :id => @contest},:remote=>true,:confirm=>"您确定要设置为"+(!@contest.is_public ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
|
||||
<!--<li><a href="javascript:void(0);" class="postOptionLink">暂停加入</a></li>-->
|
||||
<li><%= link_to "配置", {:controller => 'contests', :action => 'settings', :id => @contest}, :class => "postOptionLink" %></li>
|
||||
<!--<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -29,18 +29,18 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<a href="javascript:void(0);" class="fr sy_btn_grey ">取消</a><a href="javascript:void(0);" class="fr sy_btn_blue mr5">保存</a>
|
||||
<a href="javascript:void(0);" class="fr sy_btn_grey" onclick='$("#add_contest_member").hide();'>取消</a><a href="javascript:void(0);" class="fr sy_btn_blue mr5">保存</a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class=" clear ml10 mr10" >
|
||||
<table class="sy_new_table clearfix mb15 " cellpadding="0" cellspacing="0">
|
||||
<div class="clear ml10 mr10">
|
||||
<table class="sy_new_table clearfix mb15" cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th style="width:320px;">用户</th>
|
||||
<th>角色</th>
|
||||
<th class="sy_new_namebox">操作</th>
|
||||
<th class="sy_new_namebox">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -57,9 +57,9 @@
|
|||
<td><a href="javascript:void(0);" class=" sy_btn_blue mr5 ">编辑</a><a href="javascript:void(0);" class=" sy_btn_grey mr5 ">删除</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>3</th>
|
||||
<th ><span class="pro_new_idname">shashashashashashashashashahashashashashashashasha</span></th>
|
||||
<th>
|
||||
<td>3</td>
|
||||
<td><span class="pro_new_idname">shashashashashashashashashahashashashashashashasha</span></td>
|
||||
<td>
|
||||
<ul class="clear ml15">
|
||||
<li class="fl mr5">
|
||||
<input type="checkbox" class="mt6 fl" >
|
||||
|
@ -75,8 +75,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
</th>
|
||||
<th><a href="javascript:void(0);" class=" sy_btn_blue mr5 ">保存</a><a href="javascript:void(0);" class=" sy_btn_grey mr5 ">删除</a></th>
|
||||
</td>
|
||||
<td><a href="javascript:void(0);" class=" sy_btn_blue mr5 ">保存</a><a href="javascript:void(0);" class=" sy_btn_grey mr5 ">删除</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -85,6 +85,6 @@
|
|||
|
||||
<script>
|
||||
function add_contest_member(){
|
||||
$("#add_contest_member").show();
|
||||
$("#add_contest_member").toggle();
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
$("#contest_base_info").html('<%=escape_javascript(render :partial=>'contests/contest_base_info') %>');
|
||||
if(document.getElementById("contest_is_public")) {
|
||||
<% if !@contest.is_public %>
|
||||
$("#contest_is_public").attr("checked",false);
|
||||
<% elsif @contest.is_public %>
|
||||
$("#contest_is_public").attr("checked",true);
|
||||
<% end %>
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>');
|
|
@ -8,8 +8,8 @@
|
|||
<li id="game-setting-tab-nav-2" onclick="HoverLi(2);">
|
||||
<a href="javascript:void(0);" >成员</a>
|
||||
</li>
|
||||
<li id="game-setting-tab-nav-3" onclick="HoverLi(3);">
|
||||
<a href="javascript:void(0);" >讨论区设置</a>
|
||||
<li id="game-setting-tab-nav-3" >
|
||||
<!--<a href="javascript:void(0);" >讨论区设置</a>-->
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% work_num = visable_contest_work @contest %>
|
||||
|
||||
<% is_admin = User.current.admin? || User.current.admin_of_contest?(@contest) %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
@ -25,35 +25,8 @@
|
|||
|
||||
<div id="Container">
|
||||
<div class="sy_contanier">
|
||||
<div class="sy_class_infobox">
|
||||
<p class="sy_cgrey mb10">
|
||||
<%= link_to @contest.user.try(:show_name), user_path(@contest.user), :class => "sy_cgrey" %>
|
||||
<span class="sy_cgrey"> > </span>
|
||||
<%= link_to @contest.name, contest_path(@contest), :class => "sy_cgrey" %>
|
||||
</p>
|
||||
<% if User.current.admin_of_contest?(@contest) %>
|
||||
<%= render :partial => "contests/mamager_setting" %>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="banner-game "><img src="/images/game/banner-game.png" width="968" height="110" /></div>
|
||||
<div class="sy_class_info fl">
|
||||
<div class="sy_class_titbox">
|
||||
<h3 class="fl sy_class_title"><%= @contest.name %></h3>
|
||||
<% unless @contest.is_public %>
|
||||
<span class="hw_icon_open fl ml5 mt3"></span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="sy_cgrey ">
|
||||
<span class=" mr15">管理员:<a class="sy_cblue"><%= contest_managers(@contest).count %></a></span>
|
||||
<span class=" mr15">评委:<a class="sy_cblue"><%= contest_judges(@contest).count %></a></span>
|
||||
<span class=" mr15">参赛者:<a class="sy_cblue"><%= contest_contestants(@contest).count %></a></span>
|
||||
</p>
|
||||
</div>
|
||||
<a href="javascript:void(0);" class="fr sy_btn_blue mt28 ml10">加入竞赛</a>
|
||||
<span class="fr mt30 f16"> 邀请码:<span class="sy_corange"><%= @contest.invite_code %></span></span>
|
||||
<div class="cl"></div>
|
||||
<div class="sy_class_infobox" id="contest_base_info">
|
||||
<%= render :partial => 'contests/contest_base_info' %>
|
||||
</div>
|
||||
<div class="sy_content ">
|
||||
<div class="sy_class_l fl">
|
||||
|
@ -68,7 +41,9 @@
|
|||
<!--<li id="sy_03" class="sy_icons_boards"> <a href="">讨论区<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>-->
|
||||
<li id="sy_03" class="sy_icons_hwork">
|
||||
<a href="<%= works_path(:contest => @contest) %>">作品<span><%= work_num%></span></a>
|
||||
<% if is_admin %>
|
||||
<a href="<%= works_path(:contest => @contest.id,:is_new => 1) %>" class="sy_class_add"></a>
|
||||
<% end %>
|
||||
</li>
|
||||
<!--<li id="sy_05" class="sy_icons_news"> <a href="">通知<span>26</span></a><a href="javascript:void(0);" class="sy_class_add"></a></li>-->
|
||||
<!--<li id="sy_06" class="sy_icons_feedback"> <a href="">留言<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>-->
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<% if !@is_teacher && my_work.nil? && User.current.member_of_course?(@course) %>
|
||||
<span class="f12 c_red">您尚未提交作品</span>
|
||||
<% unless @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<%=link_to "提交作品", new_student_work_url_without_domain(@homework.id),:class => 'blueCir ml5 f12' %>
|
||||
<%=link_to "提交作品", new_contestant_work_path(:work => @homework.id),:class => 'blueCir ml5 f12' %>
|
||||
<% end %>
|
||||
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">截止日期已过,已提交且不可修改</span>
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
<div class="homepagePostSubmit">
|
||||
<%= user_for_contest_work activity,User.current.contestant_of_contest?(activity.contest),work %>
|
||||
</div>
|
||||
<% if User.current.contestant_of_contest?(activity.contest) && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "追加附件", contestant_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%# if User.current.contestant_of_contest?(activity.contest) && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
|
||||
<!--<div class="homepagePostSubmit">-->
|
||||
<!--<%#=link_to "追加附件", contestant_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>-->
|
||||
<!--</div>-->
|
||||
<%# end %>
|
||||
<%# if activity.homework_type == 2 && is_teacher%>
|
||||
<!--<div class="homepagePostSubmit">-->
|
||||
<!--<%#= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>-->
|
||||
|
@ -32,7 +32,7 @@
|
|||
<% if activity.work_type == 3 && activity.work_detail_group%>
|
||||
<% if activity.work_detail_group.base_on_project %>
|
||||
<div class="homepagePostSubmit mr15">
|
||||
<%=link_to "项目(#{activity.contestant_work_projects.where(:is_leader => true).count})",contestant_work_index_url_in_org(activity.id, 3),:class => "c_blue" %>
|
||||
<%=link_to "项目(#{activity.contestant_work_projects.where(:is_leader => true).count})",contestant_works_path(:work =>activity.id, :tab => 3),:class => "c_blue" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="homepagePostDeadline mr15">
|
||||
|
|
|
@ -621,6 +621,8 @@ RedmineApp::Application.routes.draw do
|
|||
match 'settings' , :via => [:get, :post]
|
||||
get 'dealwith_apply_request'
|
||||
get 'contest_activities'
|
||||
get 'private_or_public'
|
||||
get "switch_role"
|
||||
end
|
||||
|
||||
resources :boards
|
||||
|
|
Loading…
Reference in New Issue