Isuue新建里程碑弹框

This commit is contained in:
daiao 2016-10-27 11:15:28 +08:00
parent 7a1177c199
commit d9189487e3
7 changed files with 29 additions and 199 deletions

View File

@ -147,7 +147,9 @@ class VersionsController < ApplicationController
# @version.safe_attributes = params[:version] # @version.safe_attributes = params[:version]
# #
respond_to do |format| respond_to do |format|
@is_issue = params[:is_issue]
@is_create = params[:is_create] @is_create = params[:is_create]
#@@issue = Issue.find(params[:issue].to_i)
format.js{ format.js{
unless @is_create unless @is_create
redirect_to settings_project_url(@project, :tab => 'versions') redirect_to settings_project_url(@project, :tab => 'versions')
@ -157,7 +159,13 @@ class VersionsController < ApplicationController
end end
def create def create
# 项目配置中新建
@is_setting = params[:is_setting]
@is_issue = params[:is_issue]
@is_create = params[:is_create]
@version = @project.versions.build @version = @project.versions.build
if params[:version] if params[:version]
attributes = params[:version].dup attributes = params[:version].dup
attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing']) attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing'])

View File

@ -88,10 +88,11 @@
<li class=" clear" id="assigned_to_tips"> <li class=" clear" id="assigned_to_tips">
<%= @issue.assigned_to.nil? ? "未指派" : "已指派" %> <%= @issue.assigned_to.nil? ? "未指派" : "已指派" %>
</li> </li>
<li class=" clear"> <li class=" clear" id="versions_choise_id">
<%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), <%#= 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}, {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true},
{:onchange => "change_milestone_tip();",:class => "w150"} %> {:onchange => "change_milestone_tip();",:class => "w150"} %>
<%= render :partial => 'issues/versions_choise' %>
<%#= link_to(image_tag('add.png', :style => 'vertical-align: middle;'), <%#= link_to(image_tag('add.png', :style => 'vertical-align: middle;'),
new_project_version_path(@issue.project), new_project_version_path(@issue.project),
:remote => true, :remote => true,
@ -102,7 +103,8 @@
</li> </li>
<li class=" clear" id="milestone_option_tips"> <li class=" clear" id="milestone_option_tips">
<%= @issue.fixed_version.nil? ? "无里程碑" : "已指派里程碑" %> <%= @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 %>
</li> </li>
<li class=" clear" style="border:1px solid #c8c8c8;"> <li class=" clear" style="border:1px solid #c8c8c8;">
<% if @issue.safe_attribute? 'start_date' %> <% if @issue.safe_attribute? 'start_date' %>

View File

@ -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"}%>

View File

@ -330,191 +330,3 @@
</div> </div>
<!--缺陷列表结束--> <!--缺陷列表结束-->
<div class="homepageRight mt0 ml10" >
<div class="issues_con fl">
<div class="clear mb5">
<a href="<%= new_project_issue_path(@project)%>" class="sy_btn_green fl mr10">新 增</a>
<div class="issues_statistics fl">
<ul>
<li>所有<a class="issues_greycirbg_btn "><%= @issues_filter.count %></a></li>
<li>开启<a class="issues_greycirbg_btn "><%#= @issues_filter_assign_count %><%= @issue_open_count %></a></li>
<li>关闭<a class="issues_greycirbg_btn "><%#= @issues_filter_author_count %><%= @issue_close_count %></a></li>
</ul>
</div><!--issues_statistics end-->
<!--<input type="button" class="hw_btn_blue fr" value="导出EXCEL" onclick="remote_function_export('<%#= @project.id %>')">-->
<a href="<%=project_issues_path(:project_id => @project, :format => 'xls', :export => true, :set_filter => "1")%>" id="sendexcel" class="hw_btn_blue fr" alt="导出EXCEL" onclick="remote_function_export('<%= @project.id %>')">导出EXCEL</a>
</div>
<% 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' %>
<!--<input id="exprot_issues_hidden" value="0" type="hidden">-->
<div class="clear mb10">
<div class="hw_search_box fl ">
<input class="hw_search-input" placeholder="请输入问题名称" type="text" id="v_subject" name="subject" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<a href="javascript:void(0);" class="hw_btn_search" onclick="remote_function();" ></a>
</div>
<a href="javascript:void(0);" class="sy_btn_grey fl ml5" onclick="all_reset_form();">清除</a>
<div class="calendar_div fr">
<input id="issue_date_end_issue_export" name="issue_create_date_end" nhname="date_val" type="hidden"/>
<input type="text" nhname="date_show" id="issue_create_date_end_show" class="InputBox fl W120 calendar_input" readonly="readonly" size="13" placeholder="结束日期">
<%= calendar_for('issue_create_date_end_show')%>
</div>
<div class="calendar_div fr">
<input id="issue_date_start_issue_export" name="issue_create_date_start" nhname="date_val" type="hidden"/>
<input type="text" nhname="date_show" id="issue_create_date_start_show" class="InputBox fl W120 calendar_input" readonly="readonly" size="13" placeholder="开始日期">
<%= calendar_for('issue_create_date_start_show')%>
</div>
<!--<input type="text" placeholder="开始日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl" style="border-right:none;"></a>-->
<!--<input type="text" placeholder="结束日期" class="issues_calendar_input fl " ><a href="" class="issues_data_img fl"></a>-->
</div>
<div class="issues_con_list" style="position: relative;">
<ul id="issues_list_nav" >
<li id="issues_list_nav_1" onclick="HoverLi(1);all_reset_form();">
<a href="javascript:void(0);" onclick="all_reset_form();" id="issues_type_1" >所有</a>
<span id="issue_filter_all"><%= render :partial => "issues/issue_filter_all" %></span>
</li>
<!--li id="issues_list_nav_2" onclick="HoverLi(2);">
<a href="javascript:void(0);" onclick="switch_assign_to(<%#= User.current.id %>)" id="issues_type_2" >指派给我
<span id="issue_assigned_count"><%#= render :partial => "issues/issue_filter" %></span>
</a>
</li>
<li id="issues_list_nav_3" onclick="HoverLi(3);">
<a href="javascript:void(0);" onclick="createByMe(<%#= User.current.id %>)" id="issues_type_3" >我的发布
<span id="issue_author_count"><%#= render :partial => "issues/issue_filter_author" %></span>
</a>
</li-->
<div class="cl"></div>
</ul>
<div class="issues_filter ">
<div class="issues_form_filter mt5 mr5">
<%= 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"}) %>
</div>
<div class="cl"></div>
</div><!--issues_filter end-->
<% end %>
<% end %>
<% if @issues.empty? %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% else %>
<div id="issue_list">
<%= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %>
</div>
<% end %>
<%#= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %>
</div><!--issues_con_list end-->
</div>
</div>

View File

@ -8,7 +8,7 @@
<div class="muban_popup_con " > <div class="muban_popup_con " >
<div class="clear mt30 ml20 " > <div class="clear mt30 ml20 " >
<%#= form_tag( url_for(:controller => 'versions', :action => 'update', :is_setting => true, :is_index => @is_index), :remote => true, :id => 'project_applied_form') do %> <%#= 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| %> <%#= labelled_form_for @version, :html => {:id => "popub_new_project_version_form", :remote => true, :is_setting => true, :is_index => params[:is_index] } do |f| %>
<ul class="pro_newsetting_con mb15 "> <ul class="pro_newsetting_con mb15 ">
<li class="mb10 clear"> <li class="mb10 clear">

View File

@ -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') %>');

View File

@ -1,7 +1,7 @@
<% if @is_create %> <% if !@is_create.nil? && !@is_issue.nil? %>
var htmlvalue = "<%= escape_javascript(render :partial => 'versions/new_milestone') %>";
pop_box_new(htmlvalue,820,316);
<% else %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'versions/new_modal') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'versions/new_modal') %>');
showModal('ajax-modal', '600px'); showModal('ajax-modal', '600px');
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'versions/new_milestone') %>";
pop_box_new(htmlvalue,820,316);
<% end %> <% end %>