diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index 2cd49d0a8..0c5057a40 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -147,7 +147,9 @@ class VersionsController < ApplicationController # @version.safe_attributes = params[:version] # respond_to do |format| + @is_issue = params[:is_issue] @is_create = params[:is_create] + #@@issue = Issue.find(params[:issue].to_i) format.js{ unless @is_create redirect_to settings_project_url(@project, :tab => 'versions') @@ -157,7 +159,13 @@ class VersionsController < ApplicationController end def create + # 项目配置中新建 + @is_setting = params[:is_setting] + @is_issue = params[:is_issue] + @is_create = params[:is_create] + @version = @project.versions.build + if params[:version] attributes = params[:version].dup attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing']) diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 6ce19f222..ed6d5e9fd 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -88,10 +88,11 @@
  • <%= @issue.assigned_to.nil? ? "未指派" : "已指派" %>
  • -
  • - <%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), - {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true}, - {:onchange => "change_milestone_tip();",:class => "w150"} %> +
  • + <%#= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), + {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true}, + {:onchange => "change_milestone_tip();",:class => "w150"} %> + <%= render :partial => 'issues/versions_choise' %> <%#= link_to(image_tag('add.png', :style => 'vertical-align: middle;'), new_project_version_path(@issue.project), :remote => true, @@ -102,7 +103,8 @@
  • <%= @issue.fixed_version.nil? ? "无里程碑" : "已指派里程碑" %> - <%= link_to "", new_project_version_path(@issue.project), :class => "pic_add mt5 ml5 fr", :target => "_blank" %> + <%= link_to "", new_project_version_path(@project, :is_issue => true, :issue => @issue), :class => "pic_add mt5 ml5 fr", :remote => true %> +
  • <% if @issue.safe_attribute? 'start_date' %> diff --git a/app/views/issues/_versions_choise.html.erb b/app/views/issues/_versions_choise.html.erb new file mode 100644 index 000000000..b91e2310f --- /dev/null +++ b/app/views/issues/_versions_choise.html.erb @@ -0,0 +1,7 @@ +<%#= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), + {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true}, + {:onchange => "change_milestone_tip();",:class => "w150"} %> + +<%= select :fixed_version_id, :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), + {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true}, + {:onchange => "change_milestone_tip();",:class => "w150"}%> \ No newline at end of file diff --git a/app/views/versions/_new_milestone.html.erb b/app/views/versions/_new_milestone.html.erb index 8021e4f64..902f4b912 100644 --- a/app/views/versions/_new_milestone.html.erb +++ b/app/views/versions/_new_milestone.html.erb @@ -8,7 +8,7 @@
    <%#= form_tag( url_for(:controller => 'versions', :action => 'update', :is_setting => true, :is_index => @is_index), :remote => true, :id => 'project_applied_form') do %> - <%= form_for :version, :url => project_versions_path(@project, :is_setting => true),:html => {:id=>"popub_new_project_version_form", :remote => true} do |f| %> + <%= form_for :version, :url => project_versions_path(@project, :is_setting => true, :is_issue => @is_issue, :is_create => @is_create),:html => {:id=>"popub_new_project_version_form", :remote => true} do |f| %> <%#= labelled_form_for @version, :html => {:id => "popub_new_project_version_form", :remote => true, :is_setting => true, :is_index => params[:is_index] } do |f| %>
    • diff --git a/app/views/versions/create.js.erb b/app/views/versions/create.js.erb index 20dd95cea..799b2cd43 100644 --- a/app/views/versions/create.js.erb +++ b/app/views/versions/create.js.erb @@ -1 +1,2 @@ -$("#pro_st_tbc_04").html('<%= escape_javascript( render :partial => 'projects/settings/new_versions') %>'); +$("#versions_choise_id").html('<%= escape_javascript( render :partial => 'issues/versions_choise', :locals => {:issue => @issue}) %>'); +// $("#pro_st_tbc_04").html('<%#= escape_javascript( render :partial => 'projects/settings/new_versions') %>'); diff --git a/app/views/versions/new.js.erb b/app/views/versions/new.js.erb index 20992a66f..86ada5f4f 100644 --- a/app/views/versions/new.js.erb +++ b/app/views/versions/new.js.erb @@ -1,7 +1,7 @@ -<% if @is_create %> -var htmlvalue = "<%= escape_javascript(render :partial => 'versions/new_milestone') %>"; -pop_box_new(htmlvalue,820,316); -<% else %> +<% if !@is_create.nil? && !@is_issue.nil? %> $('#ajax-modal').html('<%= escape_javascript(render :partial => 'versions/new_modal') %>'); showModal('ajax-modal', '600px'); +<% else %> +var htmlvalue = "<%= escape_javascript(render :partial => 'versions/new_milestone') %>"; +pop_box_new(htmlvalue,820,316); <% end %> \ No newline at end of file