issue回复局部刷新(项目动态、用户动态。issue详情)

This commit is contained in:
huang 2016-12-19 15:02:40 +08:00
parent 3bf6c35d0e
commit 3c1de111c6
5 changed files with 33 additions and 20 deletions

View File

@ -261,6 +261,7 @@ class IssuesController < ApplicationController
retrieve_previous_and_next_issue_ids
render :template => 'issues/show', :layout => @project_base_tag#by young
}
format.js
format.api
format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
format.pdf {
@ -585,15 +586,18 @@ class IssuesController < ApplicationController
update_forge_activity(@issue.class,@issue.id)
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
@user_activity_id = params[:user_activity_id]
if params[:issue_id]
@issue_id = params[:issue_id]
end
@priorities = IssuePriority.active
respond_to do |format|
# Issue详情单独处理
if params[:is_issue_show]
format.js{redirect_to issue_path(@issue)}
else
format.js
end
end
end
end
def add_journal_in_org
if User.current.logged?

View File

@ -64,7 +64,7 @@
<div class="homepagePostReplyInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= @issue.id %>' style="display:none;">
<%= form_for('new_form', :url => add_journal_issue_path(@issue.id), :method => "post", :remote => true) do |f| %>
<%= form_for('new_form', :url => add_journal_issue_path(@issue.id, :is_issue_show => true), :method => "post", :remote => true) do |f| %>
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
<div nhname='toolbar_container_<%= @issue.id %>' ></div>
<div class="cl"></div>

View File

@ -1,10 +1,4 @@
/* $("#reply_div_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
$("#issue_detail_show").html('<%#= escape_javascript(render :partial => 'issues/detail') %>');
$("#issue_edit_show").html('<%#= escape_javascript(render :partial => 'issues/edit') %>');
$("#div_issue_attachment_<%#=@issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @issue}) %>");
sd_create_editor_from_data(<%#= @issue.id %>, null, "100%", "<%#= @issue.class.name %>");*/
location.reload();
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @issue}) %>");
issue_desc_editor = KindEditor.create('#issue_description',
{"width":"85%",
"resizeType":0,
@ -18,6 +12,5 @@ issue_desc_editor = KindEditor.create('#issue_description',
"allowFileManager":true,
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"});
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
// $(".homepagePostReplyBannerCount").html('<%#= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');
// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%","<%#= @issue.class.name %>");
$(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%= @issue.class.name %>");

View File

@ -1,6 +1,3 @@
<% if @issue_id %> //issue详情中回复
<%= render "jounal_refresh" %>
<%else%>
<% if params[:is_project] %>
$("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
<% else %>
@ -8,6 +5,6 @@ $("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(r
<% end %>
sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity");
//init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity');
//init_activity_KindEditor_data(<%#= @user_activity_id %>,"","87%", 'UserActivity');
// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%");
<%end %>

View File

@ -0,0 +1,19 @@
$("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @issue}) %>");
issue_desc_editor = KindEditor.create('#issue_description',
{"width":"85%",
"resizeType":0,
"no_label":true,
"at_id":<%= @issue.project_id%>,
"at_type":"Project",
"autoHeightMode":true,
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%=@issue.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})",
"emotionsBasePath":'<%= Setting.host_name%>',
"height":300,
"allowFileManager":true,
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"});
$(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%= @issue.class.name %>");