issues如果标题为空需要弹框报错

This commit is contained in:
lizanle 2015-12-17 09:22:01 +08:00
parent 71f6a637e0
commit 0a3c5f6acc
2 changed files with 8 additions and 3 deletions

View File

@ -219,7 +219,7 @@ class IssuesController < ApplicationController
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
saved = false
begin
saved = @issue.save_issue_with_child_records(params, @time_entry)
@saved = @issue.save_issue_with_child_records(params, @time_entry)
rescue ActiveRecord::StaleObjectError
@conflict = true
if params[:last_journal_id]
@ -228,7 +228,7 @@ class IssuesController < ApplicationController
end
end
if saved
if @saved
#修改界面增加跟踪者
watcherlist = @issue.watcher_users
select_users = []
@ -265,6 +265,8 @@ class IssuesController < ApplicationController
end
else
respond_to do |format|
format.js
format.html { render :action => 'edit' }
format.api { render_validation_errors(@issue) }
end

View File

@ -1,3 +1,4 @@
<% if @saved %>
$("#issue_detail").replaceWith('<%= escape_javascript(render :partial => 'issues/detail') %>')
$("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>')
$("#issue_detail").show();
@ -17,4 +18,6 @@ issue_desc_editor = KindEditor.create('#issue_description',
"allowFileManager":true,
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"});
<%else%>
alert('<%= @issue.errors.full_messages[0].to_s%>')
<%end %>