添加、修改项目增加所属组织的选择

dev_repository_hjq
sw 11 years ago
parent d1edd86e11
commit dead08a0d6

@ -179,6 +179,7 @@ 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]
@project.organization_id = params[:organization_id]
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')
# Add current user as a project member if he is not admin # Add current user as a project member if he is not admin
@ -404,6 +405,7 @@ class ProjectsController < ApplicationController
def update def update
@project.safe_attributes = params[:project] @project.safe_attributes = params[:project]
@project.organization_id = params[:organization_id]
#@project.dts_test = params[:project][:dts_test] #@project.dts_test = params[:project][:dts_test]
if validate_parent_id && @project.save if validate_parent_id && @project.save
@course = Course.find_by_extra(@project.identifier) @course = Course.find_by_extra(@project.identifier)

@ -371,4 +371,15 @@ module ProjectsHelper
return projects return projects
end 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 end

@ -1,35 +1,62 @@
<%= error_messages_for 'project' %> <%= error_messages_for 'project' %>
<!--[form:project]--> <!--[form:project]-->
<% unless @project.new_record? %> <% unless @project.new_record? %>
<p><%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %></p> <p>
<%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %>
</p>
<% end %> <% end %>
<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="padding-right: 20px;"> <p style="padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %> <%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
</p><!--by young--> </p><!--by young-->
<p><%= f.text_field :enterprise_name, :size => 60, :style => "width:490px;" %></p> <p>
<p style="display: none" ><%= 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;" %>
<label for="project_description">
<%= l(:field_enterprise_name)%>
<span class="required">&nbsp;&nbsp;</span>
</label>
<%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %>
</p>
<p style="display: none" >
<%= 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('+','')}" %> value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
<% 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>
<!-- <p style="margin-left:-10px;"><%#= f.text_field :homepage, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> --> <!-- by huang --> <!-- <p style="margin-left:-10px;"><%#= f.text_field :homepage, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> --> <!-- by huang -->
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %></em></p> <p style="margin-left:-10px;">
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :hidden_repo, :style => "margin-left:10px;" %></em></p> <em style ="color: #888888;display: block;font-size: 90%;font-style: normal;">
<%= f.check_box :is_public, :style => "margin-left:10px;" %>
</em>
</p>
<p style="margin-left:-10px;">
<em style ="color: #888888;display: block;font-size: 90%;font-style: normal;">
<%= f.check_box :hidden_repo, :style => "margin-left:10px;" %>
</em>
</p>
<!-- <!--
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"> <p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;">
<%#= f.check_box :dts_test, :style => "margin-left:10px;" %> <%#= f.check_box :dts_test, :style => "margin-left:10px;" %>
</em></p> </em></p>
--> -->
<p style="display:none;"><%= f.text_field :project_type, :value => 0 %></p> <p style="display:none;">
<%= f.text_field :project_type, :value => 0 %>
</p>
<%= wikitoolbar_for 'project_description' %> <%= wikitoolbar_for 'project_description' %>
<% @project.custom_field_values.each do |value| %> <% @project.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :project, value %></p> <p>
<%= custom_field_tag_with_label :project, value %>
</p>
<% end %> <% end %>
<%= call_hook(:view_projects_form, :project => @project, :form => f) %> <%= call_hook(:view_projects_form, :project => @project, :form => f) %>

@ -4,7 +4,9 @@
<%= labelled_form_for @project do |f| %> <%= labelled_form_for @project do |f| %>
<h3><%=l(:label_project_new)%></h3> <h3><%=l(:label_project_new)%></h3>
<div class="box tabular" > <div class="box tabular" >
<p style="font-weight: bold; color: rgb(237,137,36)"> <%=raw l(:label_project_new_description)%> </p> <p style="font-weight: bold; color: rgb(237,137,36)">
<%=raw l(:label_project_new_description)%>
</p>
<%= render :partial => 'form', :locals => { :f => f } %> <%= render :partial => 'form', :locals => { :f => f } %>
<span style="padding-left: 60px"> <span style="padding-left: 60px">
<%= submit_tag l(:button_create), :class => "enterprise"%> <%= submit_tag l(:button_create), :class => "enterprise"%>

@ -247,7 +247,7 @@ zh:
label_course_closed_tips: "确定要%{desc}课程?" label_course_closed_tips: "确定要%{desc}课程?"
# end # end
field_name: 名称 field_name: 名称
field_enterprise_name: 组织名称 field_enterprise_name: 组织
label_week_mail: 一周动态 label_week_mail: 一周动态
label_day_mail: 一日动态 label_day_mail: 一日动态

Loading…
Cancel
Save