From 90ff7854693f81fa6b2253ce7763d13ee7199346 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 1 Jul 2019 09:30:02 +0800 Subject: [PATCH] modify competition show page link button --- app/controllers/competitions_controller.rb | 2 + .../_gq_second_code_competition.html.erb | 40 +++++++++++++++---- .../_qg_second_competition.html.erb | 30 ++++++++++++-- app/views/layouts/base_competition.html.erb | 2 +- 4 files changed, 63 insertions(+), 11 deletions(-) diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index c1d918f6..c890ff6b 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -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 diff --git a/app/views/competitions/_gq_second_code_competition.html.erb b/app/views/competitions/_gq_second_code_competition.html.erb index 35c5dd17..8d66af1a 100644 --- a/app/views/competitions/_gq_second_code_competition.html.erb +++ b/app/views/competitions/_gq_second_code_competition.html.erb @@ -12,21 +12,21 @@ description: "Weka是基于Java的机器学习与数据挖掘平台,汇集了最前沿的机器学习算法,包括处理标准数据挖掘问题的几乎所有方法:回归、分类、聚类、关联规则以及属性选择等,是Java机器学习入门的首选平台。

本项目的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++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。

本项目的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实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现,感受经典算法的思想之美、代码之美。

本项目的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);" %> first_section.start_time ? 'target="_blank"' : "" %> ><%= entry.name %> + href="javascript:void(0);" + data-url="<%= btn_url %>"><%= entry.name %>

<% if row_data.present? %> @@ -84,7 +84,9 @@ <%= row_data[:link_name] %>

- 点击进入代标注模块 + 点击进入代标注模块

<% end %> @@ -99,4 +101,28 @@ <% index += 1 %>

<% index += 1 %> -

\ No newline at end of file +

+ + \ No newline at end of file diff --git a/app/views/competitions/_qg_second_competition.html.erb b/app/views/competitions/_qg_second_competition.html.erb index 7c69854b..aa45d32e 100644 --- a/app/views/competitions/_qg_second_competition.html.erb +++ b/app/views/competitions/_qg_second_competition.html.erb @@ -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| %> - " - <%= Time.now > section.start_time ? 'target="_blank"' : "" %> ><%= entry.name %> + <%= link_to entry.name, 'javascript:void(0);', + class: "li-1 #{ is_start ? 'active' : ''}", + data: { url: is_start ? entry.url : 'javascript:void(0);' } %> <% end %> @@ -34,3 +34,27 @@
<% index += 1 %>
+ + diff --git a/app/views/layouts/base_competition.html.erb b/app/views/layouts/base_competition.html.erb index 6124bad8..31185960 100644 --- a/app/views/layouts/base_competition.html.erb +++ b/app/views/layouts/base_competition.html.erb @@ -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' %>