dev_trainings
p31729568 6 years ago
parent 6fd2a01109
commit 7d6c272f34

@ -109,6 +109,7 @@ class TrainingsController < ApplicationController
@training.training_type = @training_type
if @training_type == 3
@training.research_field = params[:research_field].reject(&:blank?).uniq.join(",")
@training.training_category = params[:training_category]
end
@training.openid = session[:wechat_open_id]
@training.save!
@ -298,9 +299,6 @@ class TrainingsController < ApplicationController
end
end
private
def js_function_call
begin
yield if block_given?

@ -21,4 +21,8 @@ class Training < ActiveRecord::Base
pay? && training_payinfo.payed?
end
def research_field_include?(str)
research_field.present? && research_field.split(',').include?(str)
end
end

@ -164,21 +164,21 @@
<li class="clearfix infoBar">
<span class="left_tag fl">大数据方向</span>
<span class="fr">
<input type="radio" name="type" value="type1" id="type_1" class="magic-radio">
<input type="radio" name="training_category" value="large_data" id="type_1" class="magic-radio">
<label for="type_1" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">人工智能方向</span>
<span class="fr">
<input type="radio" name="type" value="type2" id="type_2" class="magic-radio">
<input type="radio" name="training_category" value="ai" id="type_2" class="magic-radio">
<label for="type_2" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">大数据+人工智能方向</span>
<span class="fr">
<input type="radio" name="type" value="type3" id="type_3" class="magic-radio">
<input type="radio" name="training_category" value="large_data_and_ai" id="type_3" class="magic-radio">
<label for="type_3" style="top:8px">&nbsp;</label>
</span>
</li>
@ -187,49 +187,49 @@
<li class="clearfix infoBar">
<span class="left_tag fl">机器学习/深度学习</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="机器学习/深度学习" <%= @training.research_field.split(",").include?("机器学习/深度学习") ? "checked" : "" %> id="check_1" class="magic-checkbox">
<input type="checkbox" name="research_field[]" value="机器学习/深度学习" <%= @training.research_field_include?("机器学习/深度学习") ? "checked" : "" %> id="check_1" class="magic-checkbox">
<label for="check_1" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机结构与组成</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机结构与组成" <%= @training.research_field.split(",").include?("计算机结构与组成") ? "checked" : "" %> id="check_2" class="magic-checkbox">
<input type="checkbox" name="research_field[]" value="计算机结构与组成" <%= @training.research_field_include?("计算机结构与组成") ? "checked" : "" %> id="check_2" class="magic-checkbox">
<label for="check_2" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机系统</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机系统" <%= @training.research_field.split(",").include?("计算机系统") ? "checked" : "" %> id="check_3" class="magic-checkbox">
<input type="checkbox" name="research_field[]" value="计算机系统" <%= @training.research_field_include?("计算机系统") ? "checked" : "" %> id="check_3" class="magic-checkbox">
<label for="check_3" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机软件技术和应用</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机软件技术和应用" <%= @training.research_field.split(",").include?("计算机软件技术和应用") ? "checked" : "" %> id="check_4" class="magic-checkbox">
<input type="checkbox" name="research_field[]" value="计算机软件技术和应用" <%= @training.research_field_include?("计算机软件技术和应用") ? "checked" : "" %> id="check_4" class="magic-checkbox">
<label for="check_4" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机理论</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机理论" <%= @training.research_field.split(",").include?("计算机理论") ? "checked" : "" %> id="check_5" class="magic-checkbox">
<input type="checkbox" name="research_field[]" value="计算机理论" <%= @training.research_field_include?("计算机理论") ? "checked" : "" %> id="check_5" class="magic-checkbox">
<label for="check_5" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机应用与学科交叉</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机应用与学科交叉" <%= @training.research_field.split(",").include?("计算机应用与学科交叉") ? "checked" : "" %> id="check_6" class="magic-checkbox">
<input type="checkbox" name="research_field[]" value="计算机应用与学科交叉" <%= @training.research_field_include?("计算机应用与学科交叉") ? "checked" : "" %> id="check_6" class="magic-checkbox">
<label for="check_6" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">其他</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="其他" <%= @training.research_field.split(",").include?("其他") ? "checked" : "" %> id="check_7" class="magic-checkbox">
<input type="checkbox" name="research_field[]" value="其他" <%= @training.research_field_include?("其他") ? "checked" : "" %> id="check_7" class="magic-checkbox">
<label for="check_7" style="top:8px">&nbsp;</label>
</span>
</li>

@ -0,0 +1,5 @@
class AddReseachFieldToTrainings < ActiveRecord::Migration
def change
add_column :trainings, :research_field, :string
end
end

@ -0,0 +1,5 @@
class AddTrainingCategoryToTrainings < ActiveRecord::Migration
def change
add_column :trainings, :training_category, :string
end
end
Loading…
Cancel
Save