modify competition show page link button

dev_bj
p31729568 5 years ago
parent 2e21a3b983
commit 90ff785469

@ -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

@ -12,21 +12,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'
},
],
[{},{},{}],
@ -70,8 +70,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 +84,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>
@ -99,4 +101,28 @@
<% index += 1 %>
<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>
<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>

@ -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">

Loading…
Cancel
Save