issue回复问题; 二级回复编辑issue弹空白框问题

This commit is contained in:
huang 2016-07-26 12:06:54 +08:00
parent b01e228d51
commit e7f862458f
7 changed files with 41 additions and 33 deletions

View File

@ -10,7 +10,7 @@ class AtController < ApplicationController
@users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users
#加上all
if @users.size > 0
if @user && @users.size > 0
allUser = Struct.new(:id, :name).new
allUser.id = @users.map{|u| u.id}.join(",")
allUser.name = "all"

View File

@ -483,12 +483,21 @@ class IssuesController < ApplicationController
if User.current.logged?
jour = Journal.find(params[:journal_id])
@issue = Issue.find params[:id]
new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id)
@project = @issue.project
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
@priorities = IssuePriority.active
new_jour = Journal.new
new_jour.user_id = User.current.id
new_jour.reply_id = params[:journal_id]
new_jour.parent_id = jour.id
new_jour.notes = params[:content]
new_jour.journalized = @issue
new_jour.save_attachments(params[:attachments])
# new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id)
@user_activity_id = params[:user_activity_id]
if new_jour.save
update_user_activity(@issue.class,@issue.id)
update_forge_activity(@issue.class,@issue.id)
respond_to do |format|
format.js
end
@ -496,13 +505,14 @@ class IssuesController < ApplicationController
end
end
#
# 需要刷新详情页面,代码同步一致
# 获取project和issue状态是为了刷新页面
def delete_journal
@issue = Issue.find(params[:id])
Journal.destroy(params[:journal_id])
@user_activity_id = params[:user_activity_id]
respond_to do |format|
format.js
format.html{ redirect_to issue_url(@issue)}
end
end

View File

@ -40,7 +40,6 @@
l(:button_delete),
{:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>comment.id},
:method => :get,
:remote=>true,
:class => 'fr mr20',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)

View File

@ -0,0 +1,21 @@
$("#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 %>");
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"});
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>');
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%= @issue.class.name %>");

View File

@ -1,25 +1,5 @@
<% if @issue_id %> //issue详情中回复
$("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>");
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>");
$("#issue_detail_show").html('<%= escape_javascript(render :partial => 'issues/detail') %>')
$("#issue_edit_show").html('<%= escape_javascript(render :partial => 'issues/edit') %>')
sd_create_editor_from_data(<%= @issue.id %>, null, "100%", "<%= @issue.class.name %>");
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"});
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)')
sd_create_editor_from_data(<%= @issue.id %>, null, "100%","<%=@issue.class.name%>");
<%= render "jounal_refresh" %>
<%else%>
$("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity");

View File

@ -1,8 +1,8 @@
<% if @user_activity_id %>
<%# 动态中 %>
$("#div_user_issue_reply_<%=@user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>, null, "100%","<%=@issue.class.name%>");
<% else %>
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>');
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
<%# issue详情 %>
<%= render "jounal_refresh" %>
<% end %>

View File

@ -2,7 +2,5 @@
$("#div_user_issue_reply_<%=@user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>, null, "100%","<%=@issue.class.name%>");
<% else %>
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)')
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
<%= render "jounal_refresh" %>
<% end %>