From dead08a0d6a220ed96516d880de481109ed0f2d7 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 5 Mar 2015 11:53:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E3=80=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=A2=9E=E5=8A=A0=E6=89=80=E5=B1=9E=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E7=9A=84=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 ++ app/helpers/projects_helper.rb | 11 +++++++ app/views/projects/_form.html.erb | 45 ++++++++++++++++++++------ app/views/projects/new.html.erb | 4 ++- config/locales/zh.yml | 2 +- 5 files changed, 53 insertions(+), 11 deletions(-) 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 :enterprise_name, :size => 60, :style => "width:490px;" %> + + <%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %> +
+ -<%= 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;" %> + +
- + <%= 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| %><%=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: 一日动态