From f939186ca394111e959152da44cfdf2bef77102f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 13 Jun 2019 10:48:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=90=8D=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/trainings_controller.rb | 3 +++ app/views/trainings/enroll.html.erb | 10 +++++----- .../20190613021248_add_technical_title_to_trainings.rb | 5 +++++ 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20190613021248_add_technical_title_to_trainings.rb diff --git a/app/controllers/trainings_controller.rb b/app/controllers/trainings_controller.rb index e3a429b7..f99de3e9 100644 --- a/app/controllers/trainings_controller.rb +++ b/app/controllers/trainings_controller.rb @@ -37,6 +37,7 @@ class TrainingsController < ApplicationController def enroll @training = current_training || Training.new + @training_title = @training_type == 3 ? "信息技术新工科产学研联盟师资培训班" : "工程教育认证" end @@ -271,6 +272,7 @@ class TrainingsController < ApplicationController def find_tag_id @tag_id = params[:id] + Rails.logger.info("##########TAG_ID:#{@tag_id}") @training_type = @tag_id == "aeee0601_2019" ? 3 : @tag_id == "ceeaa06_2019" ? 4 : 0 render_404 if @training_type == 0 end @@ -284,6 +286,7 @@ class TrainingsController < ApplicationController end def current_training + Rails.logger.info("##########openid:#{session[:wechat_open_id]}, training_type: #{@training_type}") Training.where(openid: session[:wechat_open_id], training_type: @training_type).first end diff --git a/app/views/trainings/enroll.html.erb b/app/views/trainings/enroll.html.erb index ff00277d..4c62f1d2 100644 --- a/app/views/trainings/enroll.html.erb +++ b/app/views/trainings/enroll.html.erb @@ -124,7 +124,7 @@ <% end %>
-

信息技术新工科产学研联盟师资培训班

+

<%= @training_title %>

<%= form_for @training do |f| %>

基本信息

  • @@ -141,14 +141,14 @@
  • 单位 + name="school" + value="<%= @training.school %>"/>
  • 职称 + name="technical_title" + value="<%= @training.technical_title %>"/>
  • <% if @training_type == 3 %> diff --git a/db/migrate/20190613021248_add_technical_title_to_trainings.rb b/db/migrate/20190613021248_add_technical_title_to_trainings.rb new file mode 100644 index 00000000..ea6b1002 --- /dev/null +++ b/db/migrate/20190613021248_add_technical_title_to_trainings.rb @@ -0,0 +1,5 @@ +class AddTechnicalTitleToTrainings < ActiveRecord::Migration + def change + add_column :trainings, :technical_title, :string + end +end