From d9189487e36415b14f3079ff2e21309263ab2b49 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 27 Oct 2016 11:15:28 +0800 Subject: [PATCH] =?UTF-8?q?Isuue=E6=96=B0=E5=BB=BA=E9=87=8C=E7=A8=8B?= =?UTF-8?q?=E7=A2=91=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/versions_controller.rb | 8 + app/views/issues/_form.html.erb | 12 +- app/views/issues/_versions_choise.html.erb | 7 + app/views/issues/index.html.erb | 188 --------------------- app/views/versions/_new_milestone.html.erb | 2 +- app/views/versions/create.js.erb | 3 +- app/views/versions/new.js.erb | 8 +- 7 files changed, 29 insertions(+), 199 deletions(-) create mode 100644 app/views/issues/_versions_choise.html.erb 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/issues/index.html.erb b/app/views/issues/index.html.erb index a7d7711eb..5b1e689d9 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -330,191 +330,3 @@ - - - - - - - - - - - - - - - - - -
    -
    - - <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> - <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'xls', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %> - <%= hidden_field_tag 'set_filter', '1' %> - <%= hidden_field_tag 'export_issue_hidden', '0' %> - -
    - - 清除 - -
    - - - <%= calendar_for('issue_create_date_end_show')%> -
    -
    - - - <%= calendar_for('issue_create_date_start_show')%> -
    - - -
    - -
    -
      -
    • - 所有 - <%= render :partial => "issues/issue_filter_all" %> -
    • - -
      - - -
    - - -
    -
    - - <%= select(:issue, :tracker, [["缺陷",1],["功能",2],["支持",3],["任务",4],["周报",5]].unshift(["类型",0]), - {:include_blank => false, :selected => @tracker_id ? @tracker_id : 0}, - {:onchange => "remote_function();", :id => "tracker_id", :name => "tracker_id", :class => "fl issues_filter_select_min"}) %> - - <%#= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]), - { :include_blank => false,:selected=>@author_id ? @author_id : 0}, - {:onchange=>"remote_function();",:id=>"author_id",:name=>"author_id",:class=>"fl "} - ) - %> - - <%= select( :issue, :user_id, principals_options_for_isuue_list(@project), - { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0 - }, - {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"fl"} - ) - %> - <%= select(:issue, :fixed_version, options_for_version_isuue_list(@project), - {:include_blank => false, :selected => @fixed_version_id ? @fixed_version_id : 0}, - {:onchange => "remote_function();", :id => "fixed_version_id", :name => "fixed_version_id", :class => "fl"}) %> - - <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), - { :include_blank => false,:selected=>@status_id ? @status_id : 0 - }, - {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"fl issues_filter_select_min"} - ) - %> - <%#= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), - { :include_blank => false,:selected=>@priority_id ? @priority_id : 0 - }, - {:onchange=>"remote_function();",:id=>"priority_id",:name=>"priority_id",:class=>"fl"} - ) - %> - - <%#= select(:issue, :done_ratio, [["10%",1],["20%",2],["30%",3],["40%",4],["50%",5],["60%",6],["70%",7],["80%",8],["90%",9],["100%",10]].unshift(["完成度",0]), - {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0 }, - {:onchange => "remote_function();", :id => "done_ratio", :name => "done_ratio", :class => "f1"}) %> - <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }).unshift(["完成度",-1]), - {:include_blank => false, :selected => @done_ratio ? @done_ratio : -1}, - {:onchange=>"remote_function();",:id=>"done_ratio",:name=>"done_ratio",:class=>"fl"}) %> - - - <%#= select(:issue, :test, [["最新创建",1],["最早创建",2],["最近更新",3],["最早更新", 4]].unshift(["排序",0]), - {:include_blank => false, :selected => @order ? @order : 0 }, - {:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %> - - <%= select(:issue, :test, [["最新创建",1],["最早创建",2],["最近更新",3],["最早更新", 4]].unshift(["排序",0]), - {:include_blank => false, :selected => @test ? @test : 0 }, - {:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %> - - <%= select( :issue,:user_id, @project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["作者",0]), - { :include_blank => false,:selected=>@author_id ? @author_id : 0}, - {:onchange=>"remote_function();",:id=>"author_id",:name=>"author_id",:style=>"display:none;"} - ) - %> - - - - - - - <%#= select(:issue, :tracker_id, [["缺陷",1],["功能",2],["支持",3],["任务",4],["周报",5]].unshift(["类型",0]), - {:include_blank => false, :selected => @tracker_id ? @tracker_id : 0}, - {:onchange => "remote_function();", :id => "tracker_id", :name => "tracker_id", :class => "fl issues_filter_select_min"}) %> - <%#= select( :issue, :user_id, principals_options_for_isuue_list(@project), - { :include_blank => false,:selected=>@assign_to_id ? @assign_to_id : 0}, - {:onchange=>"remote_function();",:id=>"assigned_to_id",:name=>"assigned_to_id",:class=>"fl"}) - %> - - <%#= select(:issue, :fixed_version_id, options_for_version_isuue_list(@project), - {:include_blank => false, :selected => @fixed_version_id ? @fixed_version_id : 0}, - {:onchange => "remote_function();", :id => "fixed_version_id", :name => "fixed_version_id", :class => "f1"}) %> - - <%#= select( :issue, :status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), - { :include_blank => false,:selected=>@status_id ? @status_id : 0 - }, - {:onchange=>"remote_function();",:id=>"status_id",:name=>"status_id",:class=>"fl issues_filter_select_min"} - ) %> - - <%#= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), - {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0}, - {:onchange=>"remote_function();",:id=>"done_ratio",:name=>"done_ratio",:class=>"fl"}) %> - - <%#= select(:issue, :done_ratio, [["10%",1],["20%",2],["30%",3],["40%",4],["50%",5],["60%",6],["70%",7],["80%",8],["90%",9],["10%",10]].unshift(["完成度",0]), - {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0 }, - {:onchange => "remote_function();", :id => "done_ratio", :name => "done_ratio", :class => "f1"}) %> - - <%#= select(:issue, :test, [["最早创建",1],["最早更新",2]].unshift(["排序",0]), - {:include_blank => false, :selected => @order ? @order : 0 }, - {:onchange => "remote_function();", :id => "test", :name => "test", :class => "fr issues_filter_select_min"}) %> -
    -
    -
    - <% end %> - <% end %> - <% if @issues.empty? %> -

    <%= l(:label_no_data) %>

    - <% else %> -
    - <%= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> -
    - <% end %> - <%#= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %> -
    - -
    -
    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