diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 6989b0b4f..c42944947 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -63,6 +63,8 @@ class CoursesController < ApplicationController
#更新课程信息
def update
@course.safe_attributes = params[:course]
+ @course.time = params[:time]
+ @course.term = params[:term]
@course.class_period = params[:class_period]
if @course.save
if params[:course][:is_public] == '0'
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 1fd1646b8..d075f67ae 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -453,4 +453,31 @@ module CoursesHelper
Course.tagged_with(tag_name).order('updated_at desc')
end
+ #课程实践年份下拉框
+ def course_time_option
+ type = []
+ #work_types = WorksCategory.all
+ for i in (2008..2020)
+ option = []
+ option << i
+ option << i
+ type << option
+ end
+ type
+ end
+
+ #课程课时下拉框
+ def course_term_option
+ type = []
+ option1 = []
+ option1 << l(:label_spring)
+ option1 << l(:label_spring)
+ option2 = []
+ option2 << l(:label_autumn)
+ option2 << l(:label_autumn)
+ type << option1
+ type << option2
+ type
+ end
+
end
diff --git a/app/views/courses/_course_form.html.erb b/app/views/courses/_course_form.html.erb
index 23a0caabd..63c196cef 100644
--- a/app/views/courses/_course_form.html.erb
+++ b/app/views/courses/_course_form.html.erb
@@ -1,10 +1,10 @@
-
@@ -33,10 +32,12 @@
<% unless @course.new_record? %>
-
<%= render :partial=>"avatar/avatar_form",:locals=> {source:@course} %>
+ <%= render :partial => "avatar/avatar_form", :locals => {source: @course} %>
<% end %>
-
+
+
- <% unless @course.nil?%>
- <%= l(:label_class_period) %> *
- <%= text_field_tag :class_period, @course.class_period, :placeholder => "在此输入课时",:maxlength=>5 %> <%= l(:label_class_hour)%>
- |
+ <% unless @course.nil? %>
+
+
+
+
+ <%= l(:label_class_period) %>
+ *
+ <%= text_field_tag :class_period, @course.class_period, :placeholder => "在此输入课时", :maxlength => 5 %>
+ <%= l(:label_class_hour) %>
+ |
+
+
<% else %>
- <%= l(:label_class_period) %> *
- <%= text_field_tag :class_period, nil, :placeholder => "在此输入课时",:maxlength=>5 %><%= l(:label_class_hour)%>
- |
+
+
+
+
+ <%= l(:label_class_period) %>
+ *
+ <%= text_field_tag :class_period, nil, :placeholder => "在此输入课时", :maxlength => 5 %><%= l(:label_class_hour) %>
+ |
+
+
<% end %>
-
-
- <% unless @course.nil? %>
- <% if @course.time == 2008 %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
-
-
- <% elsif @course.time == 2009 %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
-
- <% elsif @course.time == 2010 %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
-
- <% elsif @course.time == 2011 %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
+
+
+
+
+ <% if @course != nil %>
+
+
+
+ <%= l(:label_term) %> *
+ |
+
+ <%= select_tag :time,options_for_select(course_time_option,@course.time), {} %>
+ |
+
+ <%= select_tag :term,options_for_select(course_term_option,@course.term),{} %>
+ |
+
+
+ <% end %>
+ |
+
+
+
+
- <% elsif @course.time == 2012 %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
-
- <% elsif @course.time == 2013 %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
-
- <% elsif @course.time == 2014 %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
-
- <% elsif @course.time == 2015 %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
-
- <% elsif @course.time == 2016 %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
-
- <% elsif @course.time == 2017 %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
- <% else %>
- <%= l(:label_term) %> * |
-
- <%= select_tag 'time', "
-
-
-
-
-
-
-
-
- ".html_safe %> |
-
- <% end %>
- <% end %>
- |
-
- <% unless @course.nil? %>
- <% if @course.term == l(:label_spring) %>
-
-
- <%= select_tag 'term', "
-
- ".html_safe %> |
-
- <% elsif @course.term == l(:label_summer)%>
-
-
- <%= select_tag 'term', "
-
- ".html_safe %> |
-
- <% elsif @course.term == l(:label_autumn)%>
-
-
- <%= select_tag 'term', "
-
- ".html_safe %> |
-
- <% elsif @course.term == l(:label_winter)%>
-
-
- <%= select_tag 'term', "
-
- ".html_safe %> |
-
- <% else %>
-
-
- <%= select_tag 'term', "
-
- ".html_safe %> |
-
- <% end %>
-
- <% end %> |
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
- <%= l(:text_command) %>
+
+
+
+
+ <%= l(:text_command) %>
<% end %>
-
-<%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_course_public_info) %>
+
+ <%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_course_public_info) %>
+
<%= f.text_field :course_type, :value => 1 %>