diff --git a/app/views/layouts/_public_left_info.html.erb b/app/views/layouts/_public_left_info.html.erb index ef4a50277..5f201109f 100644 --- a/app/views/layouts/_public_left_info.html.erb +++ b/app/views/layouts/_public_left_info.html.erb @@ -91,6 +91,6 @@ // 新建实训 function shixun_valication(){ - notice_box_redirect('<%= security_settings_path %>', '开启实训,请先绑定邮箱'); + sure_box_redirect('<%= security_settings_path %>', '新建实训,请先绑定邮箱'); } \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index f7d89f19a..f8051c8e9 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -252,7 +252,11 @@ "create") %>" class="user_course_filtrate fl mt20 mr30" data-remote="true"><%= str %>创建的<%= @create_num %> "cooperative") %>" class="user_course_filtrate fl mt20 mr30" data-remote="true"><%= str %>合作的<%= @cooperative_num %> "challenge") %>" class="user_course_filtrate fl mt20 mr30" data-remote="true"><%= str %>挑战的<%= @challenge_num %> - + 新建 + <% if User.current.mail.blank? %> +
  • + 新建
  • + <% else %> +
  • <%= link_to "+ 新建", new_shixun_path, :target => "_blank", :class => "color-light-green fr font-14 mr20", :style => "line-height:56px" %>
  • + <% end %>
    <%= render :partial => "my_homepage_shixuns_list" %> diff --git a/db/migrate/20170825113413_modify_support_shixuns_for_major.rb b/db/migrate/20170825113413_modify_support_shixuns_for_major.rb index f29f16808..7dcb922d7 100644 --- a/db/migrate/20170825113413_modify_support_shixuns_for_major.rb +++ b/db/migrate/20170825113413_modify_support_shixuns_for_major.rb @@ -1,6 +1,7 @@ class ModifySupportShixunsForMajor < ActiveRecord::Migration def up sql = "SELECT distinct(major_id) FROM `major_courses`" + MajorCourse.where("0=0").update_all(:support_shixuns, 0) MajorCourse.find_by_sql(sql).each do |mc| Major.where(:id => mc.try(:major_id)).first.update_column(:support_shixuns, 1) end diff --git a/db/migrate/20170827023117_managements_zhuanye.rb b/db/migrate/20170827023117_managements_zhuanye.rb new file mode 100644 index 000000000..38c270f63 --- /dev/null +++ b/db/migrate/20170827023117_managements_zhuanye.rb @@ -0,0 +1,12 @@ +class ManagementsZhuanye < ActiveRecord::Migration + def up + sql = "SELECT distinct(major_id) FROM `major_courses`" + MajorCourse.where("0=0").update_all(:support_shixuns, 0) + MajorCourse.find_by_sql(sql).each do |mc| + Major.where(:id => mc.try(:major_id)).first.update_column(:support_shixuns, 1) + end + end + + def down + end +end