添加自动生成课程标识功能
This commit is contained in:
parent
466922d13b
commit
9d2ea5639f
|
@ -344,7 +344,7 @@ class ProjectsController < ApplicationController
|
||||||
@course_tag = params[:project][:project_type]
|
@course_tag = params[:project][:project_type]
|
||||||
if(@course_tag=="1")
|
if(@course_tag=="1")
|
||||||
@course = Course.new
|
@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.safe_attributes = params[:project][:course]
|
||||||
@course.tea_id = User.current.id
|
@course.tea_id = User.current.id
|
||||||
@course.save
|
@course.save
|
||||||
|
@ -355,6 +355,9 @@ class ProjectsController < ApplicationController
|
||||||
@trackers = Tracker.sorted.all
|
@trackers = Tracker.sorted.all
|
||||||
@project = Project.new
|
@project = Project.new
|
||||||
@project.safe_attributes = params[:project]
|
@project.safe_attributes = params[:project]
|
||||||
|
if @course_tag == '1'
|
||||||
|
@project.identifier = @course.extra
|
||||||
|
end
|
||||||
|
|
||||||
if validate_parent_id && @project.save
|
if validate_parent_id && @project.save
|
||||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %></p>
|
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %></p>
|
||||||
|
|
||||||
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p><!--by young-->
|
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p><!--by young-->
|
||||||
<p><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
|
<!-- <p><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
|
||||||
<% unless @project.identifier_frozen? %>
|
<% unless @project.identifier_frozen? %>
|
||||||
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
|
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
|
||||||
<% end %></p>
|
<% end %></p> -->
|
||||||
|
|
||||||
|
|
||||||
<%= f.fields_for @course do |m| %>
|
<%= f.fields_for @course do |m| %>
|
||||||
|
|
Loading…
Reference in New Issue