修改创建课程时当前学期的默认选择设置

This commit is contained in:
sw 2014-11-05 14:46:01 +08:00
parent 15e71ae85b
commit 6178919735
4 changed files with 43 additions and 11 deletions

View File

@ -410,6 +410,7 @@ class CoursesController < ApplicationController
@course = Course.new
@course.safe_attributes = params[:course]
month = Time.now.month
render :layout => 'base'
end

View File

@ -475,6 +475,17 @@ module CoursesHelper
type << option2
type
end
def cur_course_term
month = Time.now.month
if month >= 9 || month < 3
term = "秋季学期"
else
term = "春季学期"
end
term
end
#获取课程动态
def get_course_activity courses, activities
@course_ids=activities.keys()

View File

@ -43,7 +43,11 @@
<span class="info" style="width: 10px;">
<%= text_field_tag :class_period, @course.class_period, :placeholder => "#{l(:lable_input_class)}", :maxlength => 5 %>
</span>
<span>&nbsp;<strong><%= l(:label_class_hour) %></strong></span>
<span>&nbsp;
<strong>
<%= l(:label_class_hour) %>
</strong>
</span>
</td>
</tr>
</table>
@ -53,12 +57,16 @@
<table>
<tr>
<td>
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %>
<span class="required"> *&nbsp;&nbsp;</span></span>
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px">
<%= l(:label_class_period) %>
<span class="required"> *&nbsp;&nbsp;</span>
</span>
<span class="info" style="width: 10px;">
<%= text_field_tag :class_period, nil, :placeholder => "#{l(:lable_input_class)}", :maxlength => 5 %>
</span>
<strong><%= l(:label_class_hour) %></strong>
<strong>
<%= l(:label_class_hour) %>
</strong>
</td>
</tr>
</table>
@ -72,13 +80,16 @@
<table>
<tr>
<td class="info" align="right" style="width: 86px">
<strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong>
<strong>
<%= l(:label_term) %>
<span class="required"> *&nbsp;&nbsp;</span>
</strong>
</td>
<td class="info" style="width: 10px">
<%= select_tag :time,options_for_select(course_time_option,@course.time), {} %>
</td>
<td class="info" style="width: 10px">
<%= select_tag :term,options_for_select(course_term_option,@course.term),{} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
</td>
</tr>
</table>
@ -88,12 +99,15 @@
</table>
</p>
<p style="margin-left:-10px;">
<label for="course[course]_password" style="font-size: 13px;"><%= l(:label_new_course_password) %>
<label for="course[course]_password" style="font-size: 13px;">
<%= l(:label_new_course_password) %>
<span class="required">*</span>
</label>
<input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%= @course.password %>" size="60" name="course[password]"/>
</p>
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
<em class="info" style="margin-left:95px;">
<%= l(:text_command) %>
</em>
<% end %>
<p style="padding-right: 20px;">
<label for="course_description" style="font-size: 13px;">
@ -111,10 +125,14 @@
<%= l(:label_course_public_info) %>
</em>
</p><!-- modified by bai -->
<p style="display:none;"><%= f.text_field :course_type, :value => 1 %></p>
<p style="display:none;">
<%= f.text_field :course_type, :value => 1 %>
</p>
<%= wikitoolbar_for 'course_description' %>
<% @course.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :course, value %></p>
<p>
<%= custom_field_tag_with_label :course, value %>
</p>
<% end %>
<%= call_hook(:view_courses_form, :course => @course, :form => f) %>
<!--[eoform:course]-->

View File

@ -6,7 +6,9 @@
<%= labelled_form_for @course do |f| %>
<div class="box tabular">
<%= render :partial => 'course_form', :locals => { :f => f } %>
<span style="padding-left: 60px"><%= submit_tag l(:button_create), :class => "enterprise"%></span>
<span style="padding-left: 60px">
<%= submit_tag l(:button_create), :class => "enterprise"%>
</span>
<!-- <%#= submit_tag l(:button_create_and_continue), :name => 'course_continue' %> -->
<%= javascript_tag "$('#course_name').focus();" %>
</div>