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

View File

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