issue edit方法优化
This commit is contained in:
parent
12b73f54d3
commit
64b8c0c3f3
|
@ -22,9 +22,9 @@ class IssuesController < ApplicationController
|
|||
before_filter :authorize1, :only => [:show]
|
||||
before_filter :find_issue, :only => [:show, :edit, :update,:add_journal, :add_journal_in_org]
|
||||
before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
|
||||
before_filter :find_project, :only => [:new, :create, :update_form, :issue_commits, :commit_for_issue]
|
||||
before_filter :find_project, :only => [:new, :create, :update_form, :issue_commits, :commit_for_issue, :issue_commit_delete]
|
||||
#before_filter :authorize, :except => [:index, :show]
|
||||
before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org,:delete_journal,:reply,:add_reply, :issue_commits, :commit_for_issue]
|
||||
before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org,:delete_journal,:reply,:add_reply, :issue_commits, :commit_for_issue, :issue_commit_delete]
|
||||
|
||||
before_filter :find_optional_project, :only => [:index]
|
||||
before_filter :check_for_default_issue_status, :only => [:new, :create]
|
||||
|
@ -80,10 +80,23 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 选择对应的Commit
|
||||
def commit_for_issue
|
||||
history_commit_ids = params[:issue_commit_ids]
|
||||
@issue_commit_ids = (history_commit_ids.blank? ? params[:checkbox1] : params[:checkbox1] | history_commit_ids).uniq
|
||||
end
|
||||
|
||||
def issue_commit_delete
|
||||
commit_id = params[:commit_id].split(",")
|
||||
issue_commit_ids = params[:issue_commit_ids]
|
||||
# issue_id存在则为issue详情或者编辑的时候,否则为新建Issue
|
||||
# 编辑和详情的时候需要在数据库中删除记录,新建的时候在内存中删除
|
||||
if params[:issue_id]
|
||||
commit_issue = CommitIssues.where(:commit_id => commit_id, :issue_id => params[:issue_id], :project_id => @project.id).first
|
||||
commit_issue.delete if commit_issue
|
||||
end
|
||||
@issue_commit_ids = issue_commit_ids - commit_id
|
||||
end
|
||||
# over
|
||||
|
||||
def index
|
||||
|
@ -845,7 +858,6 @@ class IssuesController < ApplicationController
|
|||
|
||||
# 更新issue状态时,journal表产生记录,返回@current_journal
|
||||
@issue.init_journal(User.current)
|
||||
|
||||
issue_attributes = params[:issue]
|
||||
if issue_attributes && params[:conflict_resolution]
|
||||
case params[:conflict_resolution]
|
||||
|
@ -860,18 +872,18 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
senduser = User.find(params[:issue][:assigned_to_id])
|
||||
|
||||
if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
|
||||
issue_id = @issue.id
|
||||
issue_title = params[:issue][:subject]
|
||||
priority_id = params[:issue][:priority_id]
|
||||
ps = ProjectsService.new
|
||||
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
||||
if params[:action] == "update"
|
||||
senduser = User.find(params[:issue][:assigned_to_id])
|
||||
if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
|
||||
issue_id = @issue.id
|
||||
issue_title = params[:issue][:subject]
|
||||
priority_id = params[:issue][:priority_id]
|
||||
ps = ProjectsService.new
|
||||
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
||||
end
|
||||
end
|
||||
|
||||
@issue.safe_attributes = issue_attributes
|
||||
|
||||
@priorities = IssuePriority.active
|
||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||
true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div id="issue_edit" style="display: none">
|
||||
<div id="issue_edit">
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<h3><%=h "#{@issue.tracker.name} ##{@issue.id}" %></h3>
|
||||
<div id="issue_edit_show" class="mt10 pro_newissue_con">
|
||||
<%= render :partial => 'issues/edit' %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= robot_exclusion_tag %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'edit' %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= robot_exclusion_tag %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -5,16 +5,7 @@
|
|||
<script>
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%= @issue.class.name %>");
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
is_edit = <%= @is_edit.present? && @is_edit == true %>
|
||||
if(is_edit) {
|
||||
issueEditShow();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="mt10 mb10" id =issue_show_total"">
|
||||
<div class="banner-big f16 fontGrey3">
|
||||
问题跟踪
|
||||
|
@ -46,9 +37,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="issue_edit_show" class="mt10 pro_newissue_con">
|
||||
<%= render :partial => 'issues/edit'%>
|
||||
</div>
|
||||
<ul class="fr pro_new_conbox_right" id="project_issue_info_show">
|
||||
<li class="clear">
|
||||
<span class="pro_new_conbox_leftspan fl">当前状态</span>
|
||||
|
|
Loading…
Reference in New Issue