里程碑修改,报名称重复

This commit is contained in:
daiao 2017-03-07 11:12:37 +08:00
parent 19684099b8
commit 1d6fb6849a
3 changed files with 6 additions and 3 deletions

View File

@ -202,6 +202,7 @@ class VersionsController < ApplicationController
@is_setting = params[:is_setting]
@is_create = params[:is_create]
@is_index = params[:is_index]
@version_id = params[:id]
end
def update
@ -276,10 +277,11 @@ class VersionsController < ApplicationController
end
# 判断里程碑是否重名
# 项目内的里程碑不能重名,项目之间的里程碑能重名
def judge_version_title
begin
version = Version.where(:name => params[:version_name], :project_id => @project.id).first
if version.blank?
if version.blank? || version.id == params[:version_id].to_i
result = {:result => true}
else
result = {:result => false}

View File

@ -75,7 +75,8 @@
url:"<%= judge_version_title_project_versions_path(:project_id => @project) %>",
type: "GET",
data: {
version_name: $.trim($("#popub_setting_version_name").val())
version_name: $.trim($("#popub_setting_version_name").val()),
version_id: <%= version_id %>
},
success:function(data){
if(data.result == true) {

View File

@ -1,4 +1,4 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'versions/edit') %>";
var htmlvalue = "<%= escape_javascript(render :partial => 'versions/edit', :locals => {:version_id => @version_id}) %>";
pop_box_new(htmlvalue,820,316);
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
$(function() { $('#version_effective_date2').datepicker(datepickerOptions);