From 7ec103e135b4114fcc7831069556bf5cdfafc3f6 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 23 Aug 2014 09:21:03 +0800 Subject: [PATCH] =?UTF-8?q?#1457=20=E4=BF=AE=E5=A4=8D=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=BC=80=E8=AF=BE=E6=97=A5=E6=9C=9F=E6=97=A0=E6=B3=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=9A=84BUG=20=E4=BC=98=E5=8C=96=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=BC=80=E8=AF=BE=E6=97=B6=E9=97=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 + app/helpers/courses_helper.rb | 27 ++ app/views/courses/_course_form.html.erb | 322 ++++++------------------ 3 files changed, 109 insertions(+), 242 deletions(-) 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 %>

- - - <% 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) %> +

+ + + + +
+ <% 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 %> +
+

+ + + + + + + + + + +

+ +

+ <%= 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 %>