diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 41ec5fbf4..dea9c21ec 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -179,6 +179,7 @@ class ProjectsController < ApplicationController @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] + @project.organization_id = params[:organization_id] if validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') # Add current user as a project member if he is not admin @@ -404,6 +405,7 @@ class ProjectsController < ApplicationController def update @project.safe_attributes = params[:project] + @project.organization_id = params[:organization_id] #@project.dts_test = params[:project][:dts_test] if validate_parent_id && @project.save @course = Course.find_by_extra(@project.identifier) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index fe6714186..ccc750462 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -371,4 +371,15 @@ module ProjectsHelper return projects end + + def project_organizations_id_option + type = [] + Organization.all.each do |org| + option = [] + option << org.name + option << org.id + type << option + end + type + end end diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb index 636aadf43..d0544cadb 100644 --- a/app/views/projects/_form.html.erb +++ b/app/views/projects/_form.html.erb @@ -1,35 +1,62 @@ <%= error_messages_for 'project' %> <% unless @project.new_record? %> -

<%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %>

+

+ <%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %> +

<% end %> -

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

+

+ <%= 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 :enterprise_name, :size => 60, :style => "width:490px;" %>

-

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

+ <%#= f.text_field :enterprise_name, :size => 60, :style => "width:490px;" %> + + <%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %> +

+

+ <%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH, value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %> <% unless @project.identifier_frozen? %> - <%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %> + + <%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> + <%= l(:text_project_identifier_info).html_safe %> + <% end %>

-

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

-

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

+

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

+

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

-

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

+

+ <%= f.text_field :project_type, :value => 0 %> +

<%= wikitoolbar_for 'project_description' %> <% @project.custom_field_values.each do |value| %> -

<%= custom_field_tag_with_label :project, value %>

+

+ <%= custom_field_tag_with_label :project, value %> +

<% end %> <%= call_hook(:view_projects_form, :project => @project, :form => f) %> diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index b68fcb5bc..57afc6c08 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -4,7 +4,9 @@ <%= labelled_form_for @project do |f| %>

<%=l(:label_project_new)%>

-

<%=raw l(:label_project_new_description)%>

+

+ <%=raw l(:label_project_new_description)%> +

<%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_create), :class => "enterprise"%> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index aa153cda6..e9efa7fba 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -247,7 +247,7 @@ zh: label_course_closed_tips: "确定要%{desc}课程?" # end field_name: 名称 - field_enterprise_name: 组织名称 + field_enterprise_name: 组织 label_week_mail: 一周动态 label_day_mail: 一日动态