From 66f52ddfcc3e52a2e8ad9d38cd745ce1bffabb95 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Wed, 19 Jun 2019 10:25:30 +0800
Subject: [PATCH] trainings feature
---
app/models/training.rb | 2 +-
app/views/layouts/base_management.html.erb | 2 +-
app/views/trainings/enroll.html.erb | 26 +++++++++++++
app/views/trainings/result.html.erb | 38 +++++++++++++------
app/views/trainings/trainingsInfo.html.erb | 12 ++++++
...20190619021343_add_columns_to_trainings.rb | 6 +++
6 files changed, 72 insertions(+), 14 deletions(-)
create mode 100644 db/migrate/20190619021343_add_columns_to_trainings.rb
diff --git a/app/models/training.rb b/app/models/training.rb
index 58de07ab..8bb9c6d3 100644
--- a/app/models/training.rb
+++ b/app/models/training.rb
@@ -1,7 +1,7 @@
#encoding: utf-8
class Training < ActiveRecord::Base
attr_accessible :address, :email, :name, :phone, :position, :school, :sex, :openid, :training_type,
- :major, :student_id
+ :major, :student_id, :job_title, :uncertified_major
# training_type 1 2018-培训会 2 警察学院大数据培训会 3 大数据和人工智能 4 工程教育认证
diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb
index eb6ce06d..48fee5c4 100644
--- a/app/views/layouts/base_management.html.erb
+++ b/app/views/layouts/base_management.html.erb
@@ -137,7 +137,7 @@
<%= link_to "技术体系", tech_system_managements_path %>
<%= link_to "升级通知", update_notice_managements_path %>
<%= link_to "门户banner设置", setting_banner_managements_path %>
- <%= link_to "2018培训会", training_2018_managements_path %>
+ <%= link_to "培训会", training_2018_managements_path %>
diff --git a/app/views/trainings/enroll.html.erb b/app/views/trainings/enroll.html.erb
index f5ee6867..d7a2e59a 100644
--- a/app/views/trainings/enroll.html.erb
+++ b/app/views/trainings/enroll.html.erb
@@ -152,6 +152,16 @@
name="position"
value="<%= @training.position %>"/>
+
+ <% if @training_type == 4 %>
+
+ 职务
+
+
+ <% end %>
+
手机号码
+ <% if @training_type == 4 %>
+
+ 待认证专业
+
+
+ <% end %>
+
<% if @training_type == 3 %>
您关注的课程类型(最少选1项)
@@ -242,6 +261,13 @@
return;
}
+ <% if @training_type == 4 %>
+ if ($("#uncertifiedMajor").val() == '') {
+ alert("请输入专业名称");
+ return;
+ }
+ <% end %>
+
<% if @training_type == 3 %>
if ($("input[type='checkbox'][name='research_field[]']:checked").length == 0) {
alert('请选择您关注的课程类型');
diff --git a/app/views/trainings/result.html.erb b/app/views/trainings/result.html.erb
index c71758ab..41091e30 100644
--- a/app/views/trainings/result.html.erb
+++ b/app/views/trainings/result.html.erb
@@ -17,10 +17,22 @@
<%= @training.position %>
+ <% if @training_type == 4 %>
+
+
+ <%= @training.job_title %>
+
+ <% end %>
<%= @training.phone %>
+ <% if @training_type == 4 %>
+
+
+ <%= @training.uncertified_major %>
+
+ <% end %>
- <%= render partial: 'upload_img', locals: { training: @training, disabled: true } %>
- <% end %>
-
+ <% if @training.training_payinfo.info.present? || (@training.training_payinfo.attachment_id.to_i > 0 || @training.training_payinfo.pay_type != TrainingPayinfo::PayType_Wechat) %>
+
+ <% if @training.training_payinfo.info.present? %>
+
+
<%= @training.training_payinfo.info %>
+ <% end %>
+
+ <% if @training.training_payinfo.attachment_id.to_i > 0 || @training.training_payinfo.pay_type != TrainingPayinfo::PayType_Wechat %>
+
+
+ <%= render partial: 'upload_img', locals: { training: @training, disabled: true } %>
+ <% end %>
+
+ <% end %>
diff --git a/app/views/trainings/trainingsInfo.html.erb b/app/views/trainings/trainingsInfo.html.erb
index 964455bc..3ec764ca 100644
--- a/app/views/trainings/trainingsInfo.html.erb
+++ b/app/views/trainings/trainingsInfo.html.erb
@@ -21,10 +21,22 @@
职称
<%= @training.position %>
+ <% if @training_type == 4 %>
+
+ 职务
+ <%= @training.job_title %>
+
+ <% end %>
手机号
<%= @training.phone %>
+ <% if @training_type == 4 %>
+
+ 待认证专业
+ <%= @training.uncertified_major %>
+
+ <% end %>
<% if @training.training_type == 3 %>
diff --git a/db/migrate/20190619021343_add_columns_to_trainings.rb b/db/migrate/20190619021343_add_columns_to_trainings.rb
new file mode 100644
index 00000000..f4eacee1
--- /dev/null
+++ b/db/migrate/20190619021343_add_columns_to_trainings.rb
@@ -0,0 +1,6 @@
+class AddColumnsToTrainings < ActiveRecord::Migration
+ def change
+ add_column :trainings, :job_title, :string
+ add_column :trainings, :uncertified_major, :string
+ end
+end