Merge branch 'educoder' of http://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder

dev_bj
jingquan huang 5 years ago
commit 5bf8e481d9

@ -61,6 +61,9 @@ class ApplicationController < ActionController::Base
# rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token
rescue_from ::Unauthorized, :with => :deny_access
rescue_from ::ActionView::MissingTemplate, :with => :missing_template
rescue_from ::ActiveRecord::RecordNotFound do
render_404
end
include Redmine::Search::Controller
include Redmine::MenuManager::MenuController

@ -20,6 +20,8 @@ class CompetitionsController < ApplicationController
def show
@images = @competition.attachments
@user = current_user
@enrolled = @user && @user.logged? && @competition.team_members.exists?(user_id: @user.id)
end
def index

@ -2404,17 +2404,17 @@ class CoursesController < ApplicationController
homeworks.where(:homework_type => 4).each do |homework|
sheet1[4,current_col+=1] = "#{homework.name}"
end
for i in 0 ... homeworks.where(:homework_type => 1).size
sheet1[4,current_col+=1] = "普通作业第"+(i+1).to_s+""
homeworks.where(:homework_type => 1).each do |homework|
sheet1[4,current_col+=1] = "#{homework.name}"
end
for i in 0 ... homeworks.where(:homework_type => 3).size
sheet1[4,current_col+=1] = "分组作业第"+(i+1).to_s+""
homeworks.where(:homework_type => 3).each do |homework|
sheet1[4,current_col+=1] = "#{homework.name}"
end
for i in 0 ... exercises.size
sheet1[4,current_col+=1] = "试卷第"+(i+1).to_s+""
exercises.each do |exercise|
sheet1[4,current_col+=1] = "#{exercise.exercise_name}"
end
for i in 0 ... tasks.size
sheet1[4,current_col+=1] = "毕设任务第"+(i+1).to_s+""
tasks.each do |task|
sheet1[4,current_col+=1] = "#{task.name}"
end
sheet1[4,current_col+=1] = "实训作业总得分"
@ -2434,7 +2434,7 @@ class CoursesController < ApplicationController
sheet1[count_row,column+=1] = member.user.login
sheet1[count_row,column+=1] = member.user.mail
sheet1[count_row,column+=1] = member.user.user_extensions.student_id
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.try(:name)
# current_col = 5
shixun_score = 0
homeworks.where(:homework_type => 4).each do |homework|
@ -2550,7 +2550,7 @@ class CoursesController < ApplicationController
sheet2[count_row,1] = act_member.user.show_real_name
sheet2[count_row,2] = act_member.user.login
sheet2[count_row,3] = act_member.user.user_extensions.student_id
sheet2[count_row,4] = act_member.course_group_id == 0 ? "暂无" : act_member.course_group.name
sheet2[count_row,4] = act_member.course_group_id == 0 ? "暂无" : act_member.course_group.try(:name)
sheet2[count_row,5]= act_member.homework_num.to_i + act_member.graduation_num.to_i
sheet2[count_row,6]= act_member.exercise_num
sheet2[count_row,7]= act_member.poll_num
@ -2598,7 +2598,7 @@ class CoursesController < ApplicationController
end
homeworks.where(:homework_type => 1).includes(:score_student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "普通作业第#{i+1}"
sheet = book.create_worksheet :name => "#{home.name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
@ -2645,7 +2645,7 @@ class CoursesController < ApplicationController
end
homeworks.where(:homework_type => 3).includes(:score_student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "分组作业第#{i+1}"
sheet = book.create_worksheet :name => "#{home.name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
@ -2693,7 +2693,7 @@ class CoursesController < ApplicationController
end
exercises.includes(:score_exercise_users).each_with_index do |exercise, i|
sheet = book.create_worksheet :name => "试卷第#{i+1}"
sheet = book.create_worksheet :name => "#{exercise.exercise_name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
@ -2724,7 +2724,7 @@ class CoursesController < ApplicationController
end
tasks.each_with_index do |task, i|
sheet = book.create_worksheet :name => "毕设任务第#{i+1}"
sheet = book.create_worksheet :name => "#{task.name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"

@ -21,7 +21,7 @@ class LibrariesController < ApplicationController
end
def show
@library = Library.find(params[:id])
@library = current_library
return render_403 unless admin_or_self? || @library.published?
@library_applies = @library.library_applies.where(status: :refused).order('created_at desc')
@ -40,7 +40,7 @@ class LibrariesController < ApplicationController
redirect_to publish_success_libraries_path
else
flash[:message] = '保存成功'
render 'new'
redirect_to edit_library_path(id: @library.id)
end
rescue ActiveRecord::RecordInvalid => _
render 'new'
@ -50,11 +50,13 @@ class LibrariesController < ApplicationController
end
def edit
return render_403 unless admin_or_self?
@library = current_library
redirect_to library_path(id: @library.id) unless @library.editable?
end
def update
return render_403 unless admin_or_self?
@library = current_library
Libraries::SaveService.new(@library, current_user, form_params).call
if with_publish?
@ -62,7 +64,7 @@ class LibrariesController < ApplicationController
redirect_to publish_success_libraries_path
else
flash[:message] = '保存成功'
render 'edit'
redirect_to edit_library_path(id: @library.id)
end
rescue ActiveRecord::RecordInvalid => _
render 'edit'
@ -71,6 +73,24 @@ class LibrariesController < ApplicationController
render 'edit'
end
def destroy
if admin_or_business?
current_library.destroy
elsif current_library.user_id == current_user.id
unless current_library.pending?
render json: { status: -1, message: '只有草稿才能删除' }
return
end
current_library.destroy
else
render_403
return
end
render json: { status: 0, message: 'success' }
end
def publish
Libraries::SubmitService.new(current_library).call
render json: { status: 0 }
@ -84,7 +104,7 @@ class LibrariesController < ApplicationController
private
def current_library
@_current_library ||= current_user.libraries.find(params[:id])
@_current_library ||= Library.find(params[:id])
end
def form_params
@ -100,6 +120,6 @@ class LibrariesController < ApplicationController
end
def admin_or_self?
@library.user_id == current_user.id || current_user.admin?
current_library.user_id == current_user.id || admin_or_business?
end
end

@ -3015,9 +3015,9 @@ module ApplicationHelper
elsif params[:controller] == "courses" && params[:action] == "index"
title << ("翻转课堂")
elsif params[:controller] == "competitions" && params[:action] == "index"
title << ("竞赛")
title << ("在线竞赛")
elsif @competition
title << (@competition.name.nil? ? "竞赛" : @competition.name)
title << (@competition.name.nil? ? "在线竞赛" : @competition.name)
elsif @contest
title << (@contest.name.nil? ? "创新源于实践" : @contest.name)
elsif @shixun
@ -3027,13 +3027,13 @@ module ApplicationHelper
elsif params[:controller] == "shixuns" && params[:action] == "index"
title << ("开发社区")
elsif @subject
title << (@subject.name.nil? ? "课程" : @subject.name)
title << (@subject.name.nil? ? "课程" : @subject.name)
elsif params[:controller] == "subjects" && params[:action] == "index"
title << ("课程")
title << ("课程")
elsif @organization
title << (@organization.name.nil? ? "创新源于实践" : @organization.name)
elsif @forum || params[:controller] == "forums"
title << "讨论区"
title << "交流问答"
elsif @my_syllabuses
title << "我的课堂"
elsif params[:controller] == 'ecs'

@ -45,8 +45,4 @@ class Library < ActiveRecord::Base
def increment_visited_count!
Library.connection.execute("update libraries set visited_count = COALESCE(visited_count, 0) + 1 where id = #{id}")
end
def editable?
pending? || refused?
end
end

@ -17,7 +17,7 @@ class Libraries::SaveService
library.generate_uuid
end
attachment_ids = params.delete(:attachment_ids)
attachment_ids = params.delete(:attachment_ids).try(:compact)
ActiveRecord::Base.transaction do
library.assign_attributes(params)
@ -32,6 +32,6 @@ class Libraries::SaveService
private
def validate_params!
raise Error, '附件不能为空' if params[:attachment_ids].blank?
raise Error, '附件不能为空' if params[:attachment_ids].try(:compact).blank?
end
end

@ -8,6 +8,8 @@ class Libraries::SubmitService
end
def call
return if library.processing? || library.published?
raise Error, '该状态下不能提交审核' unless library.may_submit?
ActiveRecord::Base.transaction do

@ -16,6 +16,7 @@
<span class="color-grey mr10 fl"><%= number_to_human_size attachment.filesize %></span>
<%= link_to('<i class="fa fa-trash-o mr5"></i>'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
<%= hidden_field_tag "attachments[p#{i}][attachment_id]", attachment.id %>
</span>
<% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %>

@ -5,6 +5,11 @@
<% index += 1 %>
<%
challenge_description_extra = [
"模拟赛选择了第一届标注大赛正式赛第一阶段的三个项目供大家体验熟悉平台、学习其他人的标注,模拟赛标注不计分。",
"第一阶段比赛得分占正赛总比分的30%。",
"第二阶段比赛得分占正赛总比分的70%。"
]
data = [
[
{
@ -12,21 +17,21 @@
description: "Weka是基于Java的机器学习与数据挖掘平台汇集了最前沿的机器学习算法包括处理标准数据挖掘问题的几乎所有方法回归、分类、聚类、关联规则以及属性选择等是Java机器学习入门的首选平台。<br/><br/>本项目的Clusters目录中包含了K-Means、层次聚类等多种聚类算法以及相应的聚类效果评估方法的java实现",
task: '标注../weka/clusterers/目录下的所有代码文件。',
link_name: 'CSDN经典聚类算法',
link_url: 'javascript:void(0)'
link_url: 'https://blog.csdn.net/qq_30262201/article/details/78799926'
},
{
name: 'C++项目',
description: "该项目是GitHub上最受欢迎的C++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。<br/><br/>本项目的sort_search_problems目录涵盖了冒泡排序、快速排序等各类经典排序算法的C++实现。",
task: '标注../sort_search_problems目录下的所有代码文件及对应引用的../include目录中自定义的头文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'javascript:void(0)'
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
{
name: 'Python项目',
description: "该项目是GitHub上最受欢迎的Python语言实现经典算法的项目之一包含了前沿的神经网络和经典数据结构及算法的Python实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现感受经典算法的思想之美、代码之美。<br/><br/>本项目的Sorts目录中包含了冒泡排序、快速排序等各类经典排序算法的Python实现。",
task: '标注../sorts/目录下的所有代码文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'javascript:void(0)'
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
],
[{},{},{}],
@ -56,7 +61,7 @@
</li>
</ul>
<p class="break_word font-18 challenge_describe">
标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。第一阶段比赛得分占正赛总比分的30%。
标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %>
</p>
<ul class="mt30">
@ -70,8 +75,8 @@
btn_url = is_start ? "#{entry.url}" : "javascript:void(0);"
%>
<a class="setNewBnt <%= is_start ? 'active' : '' %>"
href="<%= btn_url %>"
<%= Time.now > first_section.start_time ? 'target="_blank"' : "" %> ><%= entry.name %></a>
href="javascript:void(0);"
data-url="<%= btn_url %>"><%= entry.name %></a>
</p>
<% if row_data.present? %>
@ -84,7 +89,9 @@
<a href="<%= row_data[:link_url] %>" target="_blank"><%= row_data[:link_name] %></a>
</ul>
<p class="enter_btn clearfix">
<a href="<%= btn_url %>" target="_blank" class="setNewBnt <%= is_start ? 'active' : '' %>">点击进入代标注模块</a>
<a href="javascript:void(0);"
data-url="<%= btn_url %>"
class="setNewBnt <%= is_start ? 'active' : '' %>">点击进入代标注模块</a>
</p>
<% end %>
</li>
@ -100,3 +107,27 @@
<p class="second_code_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
$(".enter_btn .setNewBnt.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>

@ -17,9 +17,9 @@
<% "@urls[i][j][k]表示: 第i个比赛的第j个对象的第k个url入口" %>
<% is_start = Time.now > section.start_time %>
<% section.competition_entries.each_with_index do |entry| %>
<a class="li-1 <%= is_start ? 'active' : '' %>"
href="<%= is_start ? "#{entry.url}" : "javascript:void(0);" %>"
<%= Time.now > section.start_time ? 'target="_blank"' : "" %> ><%= entry.name %></a>
<%= link_to entry.name, 'javascript:void(0);',
class: "li-1 #{ is_start ? 'active' : ''}",
data: { url: is_start ? entry.url : 'javascript:void(0);' } %>
<% end %>
</li>
</ul>
@ -34,3 +34,27 @@
<div class="second_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></div>
<% index += 1 %>
<div class="second_8" 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 a.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>

@ -17,9 +17,9 @@
<div class="enter_panel" style="height: 500px">
<div class="course_competition_panel">
<a href="<%= is_start ? first_section.competition_entries[0].url : 'javascript:void(0)'%>"
class="<%= is_start ? 'active' : '' %>"><%= first_section.competition_entries[0].name %></a>
class="<%= is_start ? 'active' : '' %>" target="_blank"><%= first_section.competition_entries[0].name %></a>
<a href="<%= is_start ? first_section.competition_entries[1].url : 'javascript:void(0)'%>"
class="<%= is_start ? 'active' : '' %>"><%= first_section.competition_entries[1].name %></a>
class="<%= is_start ? 'active' : '' %>" target="_blank"><%= first_section.competition_entries[1].name %></a>
</div>
<a href="<%= is_start ? first_section.competition_entries[2].url : 'javascript:void(0)'%>"
class="ex_submit"><%= first_section.competition_entries[2].name %></a>

@ -2,7 +2,7 @@
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %>
<div class="head-nav pr">
<ul id="header-nav">
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<!-- 精选实训 -->
<li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
@ -18,11 +18,11 @@
</ul>
</li>
<% end %>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "在线竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li>
<% if User.current.ec_school.present? %>
<li class="<%= ecs_controller.include?(params[:controller]) ? " active" : "" %>" id="ec_banner">
<%= link_to "认证", department_ecs_path(:school_id => User.current.ec_school) %>
<%= link_to "工程认证", department_ecs_path(:school_id => User.current.ec_school) %>
</li>
<% end %>
</ul>

@ -3,7 +3,7 @@
<div class="head-nav pr">
<ul id="header-nav">
<li class="active" style="display: none"><%= link_to "首页", home_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
@ -19,8 +19,8 @@
</ul>
</li>
<% end %>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "在线竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li>
<!--<li><%#= link_to "活动竞赛", competitions_path %></li>-->
</ul>
<div class="posi-search unlogin" id="posi-search" style="display: none" >

@ -11,7 +11,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'educoder/edu-main', 'educoder/edu-all', 'educoder/magic-check' %>
<%= javascript_include_tag 'educoder/edu_application' %>
<%= javascript_include_tag 'educoder/edu_application', 'edu/application' %>
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">

@ -67,5 +67,11 @@
</div>
</body>
<script>
$(function(){
var message = '<%= flash[:message] %>';
if (message.length > 0) {
sure_confirm_box("提示",450,200,message);
}
})
</script>
</html>

@ -49,7 +49,9 @@
</div>
<div class="operate mt20 mb20 clearfix">
<%= link_to '确认提交', 'javascript:void(0)', class: 'white-btn edu-blueback-btn changebtn mr20 fl apply-publish-btn' %>
<% unless @library.published? %>
<%= link_to '申请发布', 'javascript:void(0)', class: 'white-btn edu-blueback-btn changebtn mr20 fl apply-publish-btn' %>
<% end %>
<%= link_to '保存', 'javascript:void(0)', class: 'white-btn edu-blueline-btn changebtn mr20 fl submit-btn' %>
</div>
<% end %>
@ -86,7 +88,6 @@
imageUploadURL: "<%= upload_with_markdown_path(container_id: 0, container_type: 'MarkDown') %>" //url
});
$(function(){
var submitForm = function(){
var title = $("input[name='library[title]']").val();
var content = $("textarea[name='library[content]']").val();
@ -114,15 +115,11 @@
$('.library-form-container form').submit();
};
$(function(){
$('.apply-publish-btn').on('click', function(){
$('input[name="apply_publish"]').val(true);
$("input[name='apply_publish']").val(true);
submitForm();
});
$('.submit-btn').on('click', submitForm);
var message = '<%= flash[:message] %>';
if (message.length > 0) {
sure_confirm_box("提示",450,200,message);
}
})
});
</script>

@ -1,3 +1,4 @@
<img src="/images/educoder/teach_ex.png" width="100%"/>
<div class="educontent">
<div class="edu-back-white mb30 mt30">
<p class="padding20-30 clearfix bor-bottom-greyE">
@ -15,7 +16,7 @@
</ul>
<div class="edu-position fr">
<%= hidden_field_tag(:type, params[:type]) %>
<input class="winput-240-30 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>
</div>
</div>
@ -35,7 +36,7 @@
var search = $("#search_name").val();
var type = $("input[name='type']").val();
$.ajax({
url: "/libraries",
url: "<%= libraries_path %>",
dataType: 'script',
data: {search: search, type: type}
});

@ -1,5 +1,5 @@
<%
admin_or_self = User.current.admin? || @library.user_id == User.current.id
admin_or_self = admin_or_business? || @library.user_id == User.current.id
%>
<div class="educontent mb50">
<p class="mt10 mb20 clearfix lineh-20">
@ -42,7 +42,11 @@
<div class="padding30">
<p class="mb10 clearfix">
<span class="color-grey-6 font-16 mr10">详情</span>
<% if admin_or_self && @library.editable? %>
<% if admin_or_business? || @library.user_id == User.current.id && @library.pending? %>
<%= link_to '删除', 'javascript:void(0);', data: { id: @library.id },
class: 'white-btn edu-blueline-btn fr ml20 delete-btn' %>
<% end %>
<% if admin_or_self %>
<%= link_to '编辑', edit_library_path(id: @library.id), class: 'white-btn edu-blueline-btn fr' %>
<% end %>
</p>
@ -99,6 +103,13 @@
sequenceDiagram: true // 默认不解析
});
$(function(){
// 删除
$('.delete-btn').on('click', function(){
var id = $(this).data('id');
op_confirm_tip_1("是否确认删除?", "destroyLibrary(" + id + ");")
});
if ($('#private_reason_ul').length != 0) {
var height=document.getElementById("private_reason_ul").offsetHeight;
var one=parseInt($("#private_reason_ul").find("li").eq(0).height())+10;
var two=parseInt($("#private_reason_ul").find("li").eq(1).height());
@ -107,5 +118,20 @@
$("#actionPanel").html('点击展开<i class="iconfont icon-xiajiantou color-blue font-14 ml5"></i>');
$(".private_reason").css({maxHeight:plus+"px"});
}
}
})
function destroyLibrary (id) {
$.ajax({
type: "DELETE",
url: "<%= libraries_path %>/" + id,
success: function (data) {
if(data && data.status == 0){
notice_box_redirect("<%= libraries_path %>", "删除成功");
} else {
notice_box(data.message);
}
}
});
}
</script>

@ -19,8 +19,7 @@
<thead>
<tr>
<th width="6%">序号</th>
<th width="10%">ID</th>
<th width="20%" class="edu-txt-left">单位名称</th>
<th width="30%" class="edu-txt-left">单位名称</th>
<th width="22%">时段一<br><%= "#{params[:begin_date]} 05:00至#{(Time.zone.parse(params[:end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00" %></th>
<th width="22%">时段二<br><%= "#{params[:other_begin_date]} 05:00至#{(Time.zone.parse(params[:other_end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00" %></th>
<th width="20%" colspan="2">
@ -33,8 +32,10 @@
<% @reports.each_with_index do |report, index| %>
<tr>
<td><%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %></td>
<td><%= report.school_id %></td>
<td class="edu-txt-left"><%= report.school_name %></td>
<td class="edu-txt-left">
<%= link_to report.school_name, statistics_college_path(id: report.school_id),
target: '_blank', data: { tip_down: '点击查看学校统计概况'} %>
</td>
<td><%= report['total'] %></td>
<td><%= report['other_total'] %></td>
<%

@ -20,9 +20,7 @@
<thead>
<tr>
<th width="6%">序号</th>
<th width="10%">ID</th>
<th width="24%" class="edu-txt-left">单位名称</th>
<th width="12%"><%= sort_tag('新增教师', name: 'teacher_increase_count', path: school_data_grow_managements_path) %></th>
<th width="12%"><%= sort_tag('新增学生', name: 'student_increase_count', path: school_data_grow_managements_path) %></th>
<th width="12%"><%= sort_tag('新增课堂', name: 'course_increase_count', path: school_data_grow_managements_path) %></th>
@ -36,8 +34,10 @@
<% @reports.each_with_index do |report, index| %>
<tr>
<td><%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %></td>
<td><%= report.school_id %></td>
<td class="edu-txt-left"><%= report.school_name %></td>
<td class="edu-txt-left">
<%= link_to report.school_name, statistics_college_path(id: report.school_id),
target: '_blank', data: { tip_down: '点击查看学校统计概况'} %>
</td>
<td><%= report.teacher_increase_count.to_i %></td>
<td><%= report.student_increase_count.to_i %></td>
<td><%= report.course_increase_count.to_i %></td>

@ -2,8 +2,7 @@
<thead>
<tr>
<th width="6%">序号</th>
<th width="6%">ID</th>
<th width="12%" class="edu-txt-left">单位名称</th>
<th width="18%" class="edu-txt-left">单位名称</th>
<th width="10%"><%= sort_tag('教师总人数', name: 'teacher_count', path: school_report_managements_path) %></th>
<th width="10%"><%= sort_tag('学生总人数', name: 'student_count', path: school_report_managements_path) %></th>
@ -23,8 +22,7 @@
<% @schools.each_with_index do |school, index| %>
<tr>
<td><%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %></td>
<td><%= school[:id] %></td>
<td class="edu-txt-left"><%= school[:name] %></td>
<td class="edu-txt-left"><%= link_to school[:name], statistics_college_path(id: school[:id]), target: '_blank', data: { tip_down: '点击查看学校统计概况'} %></td>
<td><%= school[:teacher_count].to_i %></td>
<td><%= school[:student_count].to_i %></td>
<td><%= school[:course_count].to_i %></td>

@ -0,0 +1,26 @@
class TransferCompetitionPersonalEnrollData < ActiveRecord::Migration
CODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
def change
gcc_task = Competition.find_by_identifier('gcc-task-2019')
transfer_personal_enroll_data(gcc_task)
gcc_annotation = Competition.find_by_identifier('gcc-annotation-2019')
transfer_personal_enroll_data(gcc_annotation)
end
def transfer_personal_enroll_data(competition)
return if competition.blank?
competition.competition_teams.where('invite_code IS NULL OR invite_code = ""').each do |team|
team.update_attributes!(invite_code: generate_team_code, name: "#{team.name}战队")
end
end
def generate_team_code
code = CODES.sample(6).join
while CompetitionTeam.exists?(invite_code: code)
code = CODES.sample(6).join
end
code
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

@ -104,7 +104,7 @@ class ForumsIndex extends Component {
componentDidMount() {
window.document.title = '问答'
window.document.title = '交流问答'
}

@ -272,7 +272,7 @@ class NewHeader extends Component {
<ul id="header-nav">
{/*<li className={`${activeIndex === true ? 'active' : ''}`}><a href="/">首页</a></li>*/}
<li><a href="/paths">课程</a></li>
<li><a href="/paths">课程</a></li>
<li><a href="/courses">翻转课堂</a></li>
<li className={`${activeShixuns === true ? 'pr active' : 'pr'}`}>
@ -294,10 +294,10 @@ class NewHeader extends Component {
</ul>
</div>
</li>
<li><a href="/libraries">教学案例</a></li>
<li><a href="/competitions">竞赛</a></li>
<li className={`${activeForums === true ? 'active' : ''}`}><a href="/forums">问答</a></li>
<li className={`${activeCourses === true ? 'active' : ''}`} style={{display:ecUrl===null||ecUrl===undefined||ecUrl===""?'none':'block'}}><a href={ecUrl}>{ecUrl===null||ecUrl===undefined||ecUrl===""?'':'认证'}</a></li>
{/* <li><a href="/libraries">教学案例</a></li> */}
<li><a href="/competitions">在线竞赛</a></li>
<li className={`${activeForums === true ? 'active' : ''}`}><a href="/forums">交流问答</a></li>
<li className={`${activeCourses === true ? 'active' : ''}`} style={{display:ecUrl===null||ecUrl===undefined||ecUrl===""?'none':'block'}}><a href={ecUrl}>{ecUrl===null||ecUrl===undefined||ecUrl===""?'':'工程认证'}</a></li>
</ul>
<div className="posi-search" id="posi-search" style={{display: 'none'}}>
<div className="search-all clearfix">

@ -103,7 +103,8 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
/*门户左侧导航栏*/
.user_navlist{position: absolute;left: 0px;width: 160px;top:0px;height: 100%;}
.user_navlist_black{position: relative;width: 100%;height: 100%;border-radius: 8px 0px 0px 8px;background: rgba(0,0,0,0.8);}
.user_navlist_white{position: absolute;left: 160px;background: #FFFFff;width: 622px;min-height: 345px;top: 0px;z-index: 1;display: none;padding:0px 30px;box-sizing: border-box;box-shadow: 0px 0px 10px rgba(76,76,76,0.2);z-index: 99}
.user_navlist_white{position: absolute;left: 160px;background: #FFFFff;width: 622px;min-height: 345px;top: 0px;z-index: 1;display: none;padding:0px 30px;
box-sizing: border-box;box-shadow: 0px 0px 10px rgba(76,76,76,0.2);z-index: 99;max-height: 345px;overflow-y: auto;}
.user_navlist_white a{color: #989898;margin-right: 15px;font-size: 14px;display: block;float: left;height: 30px;line-height: 30px;}
.user_navlist_white a:hover{color: #4cacff}
.headIcon{height: 100%;box-sizing: border-box;margin: 0px!important;}

Loading…
Cancel
Save