diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index eab4feff8..f1b8f6cc2 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -510,11 +510,14 @@ class ProjectsController < ApplicationController @course.extra='course' + DateTime.parse(Time.now.to_s).strftime('%Y-%m-%d_%H-%M-%S').to_s @course.safe_attributes = params[:project][:course] @course.tea_id = User.current.id - # added by bai + # added by bai @course.term = params[:term] @course.time = params[:time] + @course.setup_time = params[:setup_time] + @course.endup_time = params[:endup_time] + @course.class_period = params[:class_period] end - # end + # end # @course.save # project = ProjectInfo.create(:user_id => User.current.id, :project_id => @project.id) # project_status = ProjectStatus.create(:project_id => @project.id) @@ -806,10 +809,13 @@ class ProjectsController < ApplicationController @course = Course.find_by_extra(@project.identifier) unless @course.nil? @course.password = params[:project][:course][:password] - # added by bai + # added by bai @course.term = params[:term] @course.time = params[:time] - # end + @course.setup_time = params[:setup_time] + @course.endup_time = params[:endup_time] + @course.class_period = params[:class_period] + # end @course.save end @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 711d47e96..6b02530b2 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -111,14 +111,25 @@
- + - + + + + + + + + + + + + - + diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 0f447d831..fbca9bd23 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -67,7 +67,7 @@ - + <% unless @bid.parent_id.nil?%> diff --git a/app/views/projects/_course_form.html.erb b/app/views/projects/_course_form.html.erb index e57371f33..47a61681d 100644 --- a/app/views/projects/_course_form.html.erb +++ b/app/views/projects/_course_form.html.erb @@ -17,11 +17,52 @@ <%= f.fields_for @course do |m| %> - -

<%= l(:label_main_teacher) %> :<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher)) %>
<%= l(:label_setup_time) %> :<%= @course.setup_time %>
<%= l(:label_endup_time) %> :<%= @course.endup_time %>
<%= l(:label_class_period) %> :<%= @course.class_period %> <%= l(:label_class_hour)%>
<%= l(:label_main_term) %> :<%= @course.time %> -- <%= @course.term %><%= l(:label_main_term) %> :<%= @course.time %> <%= @course.term %>
<%= l(:label_limit_time) %>: <%= @bid.deadline %><%= l(:label_limit_time) %>: <%= @bid.deadline %>
+ + + + + + <% unless @course.nil?%> +

<%= l(:label_setup_time) %> *   + <%= text_field_tag :setup_time, @course.setup_time, :placeholder => "在此选择开课日期" %> + <%= calendar_for('setup_time')%> +

+ <% else %> +

<%= l(:label_setup_time) %> *   + <%= text_field_tag :setup_time, nil, :placeholder => "在此选择开课日期" %> + <%= calendar_for('setup_time')%> +

+ <% end %> + + <% unless @course.nil?%> +

<%= l(:label_endup_time) %> *   + <%= text_field_tag :endup_time, @course.endup_time, :placeholder => "在此选择结课日期" %> + <%= calendar_for('endup_time')%> +

+ <% else %> +

<%= l(:label_endup_time) %> *   + <%= text_field_tag :endup_time, nil, :placeholder => "在此选择结课日期" %> + <%= calendar_for('endup_time')%> +

+ <% end %> + + <% unless @course.nil?%> +

<%= l(:label_class_period) %> *   + <%= text_field_tag :class_period, @course.class_period, :placeholder => "在此输入课时" %>  <%= l(:label_class_hour)%> +

+ <% else %> +

<%= l(:label_class_period) %> *   + <%= text_field_tag :class_period, nil, :placeholder => "在此输入课时" %><%= l(:label_class_hour)%> +

+ <% end %> + + + + +

<% unless @course.nil? %> <% if @course.time == 2008 %> -

+

<%= l(:label_term) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -227,7 +268,7 @@ <%= l(:text_command) %> <% end %>

<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>

-

<%= f.check_box :is_public, :style => "margin-left:10px;" %>

+

<%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_public_info) %>

<%= f.text_field :project_type, :value => 1 %>

diff --git a/config/locales/zh.yml b/config/locales/zh.yml index b10005539..1d4dca012 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1546,14 +1546,19 @@ zh: label_requirement_from: 需求来源 label_course_view: 作业界面 label_course_return: "返 回 课 程" + label_setup_time: 开课时间 + label_endup_time: 结课时间 + label_class_period: 整体课时 + label_class_hour: 学时 + #end label_course: 课程 label_course_new: 新建课程 label_course_join_student: 加入课程 + label_public_info: (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。) label_course_view_student: 查看其他课程 - label_public_info: 若不公开,仅项目成员可见该项目 label_course_student: 学生 label_homework: 课程作业 label_course_file: 资料共享 diff --git a/db/migrate/20131021024144_add_description_to_share.rb b/db/migrate/20131021024144_add_description_to_share.rb deleted file mode 100644 index 1ac25a9b4..000000000 --- a/db/migrate/20131021024144_add_description_to_share.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDescriptionToShare < ActiveRecord::Migration - def change - add_column :shares, :description, :string - end -end diff --git a/db/migrate/20131031071414_add_setup_time_to_courses.rb b/db/migrate/20131031071414_add_setup_time_to_courses.rb new file mode 100644 index 000000000..882e1d932 --- /dev/null +++ b/db/migrate/20131031071414_add_setup_time_to_courses.rb @@ -0,0 +1,5 @@ +class AddSetupTimeToCourses < ActiveRecord::Migration + def change + add_column :courses, :setup_time, :string + end +end diff --git a/db/migrate/20131031071452_add_endup_time_to_courses.rb b/db/migrate/20131031071452_add_endup_time_to_courses.rb new file mode 100644 index 000000000..587a8eff6 --- /dev/null +++ b/db/migrate/20131031071452_add_endup_time_to_courses.rb @@ -0,0 +1,5 @@ +class AddEndupTimeToCourses < ActiveRecord::Migration + def change + add_column :courses, :endup_time, :string + end +end diff --git a/db/migrate/20131031093317_add_class_period_to_courses.rb b/db/migrate/20131031093317_add_class_period_to_courses.rb new file mode 100644 index 000000000..7a7abc8a9 --- /dev/null +++ b/db/migrate/20131031093317_add_class_period_to_courses.rb @@ -0,0 +1,5 @@ +class AddClassPeriodToCourses < ActiveRecord::Migration + def change + add_column :courses, :class_period, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 00647a7cc..a5a245bd2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -510,9 +510,11 @@ ActiveRecord::Schema.define(:version => 20131031093317) do t.integer "project_id" t.integer "project_type" t.integer "gitlab_group_id", :limit => 8 + t.float "grade" end add_index "project_statuses", ["changesets_count"], :name => "index_project_statuses_on_changesets_count" + add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" add_index "project_statuses", ["watchers_count"], :name => "index_project_statuses_on_watchers_count" create_table "project_tags", :force => true do |t|