From 9d2ea5639f1a394408347b5c116884eff3a0a5bf Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Mon, 16 Sep 2013 08:58:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=AF=BE=E7=A8=8B=E6=A0=87=E8=AF=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 5 ++++- app/views/projects/_course_form.html.erb | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1fbcec3ec..efe32a80b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -344,7 +344,7 @@ class ProjectsController < ApplicationController @course_tag = params[:project][:project_type] if(@course_tag=="1") @course = Course.new - @course.extra=params[:project][:identifier] + @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 @course.save @@ -355,6 +355,9 @@ class ProjectsController < ApplicationController @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] + if @course_tag == '1' + @project.identifier = @course.extra + end if validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') diff --git a/app/views/projects/_course_form.html.erb b/app/views/projects/_course_form.html.erb index 5a346f735..6fb8ad996 100644 --- a/app/views/projects/_course_form.html.erb +++ b/app/views/projects/_course_form.html.erb @@ -6,10 +6,10 @@

<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %>

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

-

<%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %> + <%= f.fields_for @course do |m| %>