From 3c1de111c65d4054918449c4eb3c9de743cf3fd4 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 19 Dec 2016 15:02:40 +0800 Subject: [PATCH] =?UTF-8?q?issue=E5=9B=9E=E5=A4=8D=E5=B1=80=E9=83=A8?= =?UTF-8?q?=E5=88=B7=E6=96=B0=EF=BC=88=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E3=80=81=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81=E3=80=82issue?= =?UTF-8?q?=E8=AF=A6=E6=83=85=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 12 ++++++++---- app/views/issues/_issue_replies.html.erb | 2 +- app/views/issues/_jounal_refresh.js.erb | 13 +++---------- app/views/issues/add_journal.js.erb | 7 ++----- app/views/issues/show.js.erb | 19 +++++++++++++++++++ 5 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 app/views/issues/show.js.erb diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index dd2aec552..fa0f2828d 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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,12 +586,15 @@ 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| - format.js + # Issue详情单独处理 + if params[:is_issue_show] + format.js{redirect_to issue_path(@issue)} + else + format.js + end end end end diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index 7b22f85f3..6f4434a4c 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -64,7 +64,7 @@
<% if User.current.logged? %>
- <%= 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| %>
diff --git a/app/views/issues/_jounal_refresh.js.erb b/app/views/issues/_jounal_refresh.js.erb index 5ccbf69d2..33dd364e7 100644 --- a/app/views/issues/_jounal_refresh.js.erb +++ b/app/views/issues/_jounal_refresh.js.erb @@ -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 %>"); \ No newline at end of file +$(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'issues/issue_reply_banner') %>'); +sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%= @issue.class.name %>"); \ No newline at end of file diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index 3a34647e8..62a460247 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -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 %> + diff --git a/app/views/issues/show.js.erb b/app/views/issues/show.js.erb new file mode 100644 index 000000000..7d7b116a0 --- /dev/null +++ b/app/views/issues/show.js.erb @@ -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 %>"); \ No newline at end of file