里程碑编辑路径跳转

This commit is contained in:
huang 2016-10-27 17:30:22 +08:00
parent ee275455de
commit d42417d9d5
4 changed files with 29 additions and 19 deletions

View File

@ -197,10 +197,16 @@ class VersionsController < ApplicationController
end
def edit
@@is_index = params[:is_index]
@is_setting = params[:is_setting]
@is_create = params[:is_create]
@is_index = params[:is_index]
end
def update
@is_setting = params[:is_setting]
@is_create = params[:is_create]
@is_index = params[:is_index]
if request.put? && params[:version]
# 处理里程碑里面的更新
if params[:flag].to_i == 1
@ -232,14 +238,13 @@ class VersionsController < ApplicationController
end
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'versions')
}
format.js{
if @@is_index
if @is_create
redirect_to version_path(@version)
elsif @is_index
redirect_to project_versions_path(@project)
end
}
format.js
format.api { render_api_ok }
end
else

View File

@ -8,8 +8,8 @@
<div class="muban_popup_con " >
<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 %>
<%= labelled_form_for @version, :html => {:id => "popub_new_project_version_form", :remote => true, :is_setting => true, :is_index => params[:is_index] } do |f| %>
<%#= form_for :version, :url => project_versions_path(@project, :is_setting => @is_setting, :is_issue => @is_issue, :is_create => @is_create, :issue_project_id => @issue_project_id),:html => {:id=>"popub_new_project_version_form", :remote => @is_setting ? true : false, :method => "put"} do |f| %>
<%= labelled_form_for @version, :html => {:id => "popub_new_project_version_form", :remote => @is_setting ? true :false}, :is_setting => @is_setting, :is_index => @is_index, :is_create => @is_create do |f| %>
<ul class="pro_newsetting_con mb15 ">
<li class="mb10 clear">
<label class=" fl"><span class="c_red f12">*</span>&nbsp;名称&nbsp;&nbsp;:&nbsp;</label>
@ -20,10 +20,10 @@
<label class=" fl">&nbsp;描述&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :description, :maxlength => 60, :class=>"w650 fl", :style=>"height:28px;", :no_label => true %>
</li>
<li class="mb10 clear">
<label class=" fl"><span class="c_red f12">*</span>&nbsp;结束日期&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :effective_date, :size => 10, :readonly => true,:class=>"issues_calendar_input fl", :id => "version_effective_date2", :placeholder=>"结束日期", :style=>"height:28px;", :no_label => true %>
<%= calendar_for('version_effective_date2') %>
<!--<li class="mb10 clear">-->
<!--<label class=" fl"><span class="c_red f12">*</span>&nbsp;结束日期&nbsp;&nbsp;:&nbsp;</label>-->
<!--<%#= f.text_field :effective_date, :size => 10, :readonly => true,:class=>"issues_calendar_input fl", :id => "version_effective_date2", :placeholder=>"结束日期", :style=>"height:28px;", :no_label => true %>-->
<!--<%#= calendar_for('version_effective_date2') %>-->
<!--<input type="text" placeholder="结束日期" class="issues_calendar_input fl ">-->
<!--<a href="" class="issues_data_img fl"></a>-->
</li>
@ -31,7 +31,11 @@
<label class=" fl">&nbsp;状态&nbsp;&nbsp;:&nbsp;</label>
<%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]},{:no_label => true },{:style=>"height:28px;"} %>
</li>
<input value="true" name="is_setting" type="hidden">
<% if params[:action] == "index" %>
<input value="true" name="is_index" type="hidden">
<% else %>
<input value="true" name="is_create" type="hidden">
<% end %>
</ul>
<a href="javascript:void(0);" class="fr sy_btn_grey mr45" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="fr sy_btn_blue mr5" onclick="popub_project_version_commit();">保存</a>

View File

@ -14,7 +14,12 @@
<% end %>
<%#= link_to "", {:controller => "versions", :action => "destroy", :project_id => @version.project_id}, :data => {:confirm => l(:text_are_you_sure_version)}, :class => "roadmap_icons_del fr mt5 mr5" if User.current.allowed_to?(:manage_versions, version.project) %>
<%= link_to "", version_path(version, :is_show => true), :method => "delete", :data => {:confirm => l(:text_are_you_sure_version)},:onclick => "confirm_can_delte", :class => "roadmap_icons_del fr mt5 mr5" if User.current.allowed_to?(:manage_versions, version.project) %>
<%= link_to( "", edit_version_path(@version), :class => 'roadmap_icons_edit fr mt5', :remote => true) if User.current.allowed_to?(:manage_versions, @version.project) %>
<% if params[:action] == "index" %>
<%= link_to( "", edit_version_path(@version, :is_index => true), :class => 'roadmap_icons_edit fr mt5', :remote => true) if User.current.allowed_to?(:manage_versions, @version.project) %>
<% else %>
<%= link_to( "", edit_version_path(@version, :is_create => true), :class => 'roadmap_icons_edit fr mt5', :remote => true) if User.current.allowed_to?(:manage_versions, @version.project) %>
<% end %>
<%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %>

View File

@ -1,6 +1,2 @@
<%# @is_setting:如果是settings里面新建则直接局部刷新setting如果是列表则直接局部刷新列表 %>
<% if @is_setting %>
$("#pro_st_tbc_04").html('<%= escape_javascript( render :partial => 'projects/settings/new_versions') %>');
<% else %>
$('#version_status_con_id').html('<%= escape_javascript( render :partial => 'versions/type_ico', :locals => {:version => @version}) %>');
<% end %>