增加组织动态中的项目问题的回复框

This commit is contained in:
ouyangxuhua 2015-11-16 17:21:26 +08:00
parent 687c0c8306
commit bd6a1a9d49
9 changed files with 58 additions and 19 deletions

View File

@ -20,11 +20,11 @@ class IssuesController < ApplicationController
default_search_scope :issues
before_filter :authorize1, :only => [:show]
before_filter :find_issue, :only => [:show, :edit, :update,:add_journal]
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]
#before_filter :authorize, :except => [:index, :show]
before_filter :authorize, :except => [:index,:add_journal]
before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org]
before_filter :find_optional_project, :only => [:index]
before_filter :check_for_default_issue_status, :only => [:new, :create]
@ -397,6 +397,23 @@ class IssuesController < ApplicationController
end
end
def add_journal_in_org
if User.current.logged?
jour = Journal.new
jour.user_id = User.current.id
jour.notes = params[:notes]
jour.journalized = @issue
jour.save
org_activity = OrgActivity.where("org_act_type='Issue' and org_act_id =#{@issue.id}").first
org_activity.updated_at = jour.created_on
org_activity.save
@user_activity_id = params[:user_activity_id]
respond_to do |format|
format.js
end
end
end
private
def find_project

View File

@ -41,6 +41,7 @@ class OrgDocumentCommentsController < ApplicationController
def add_reply
@document = OrgDocumentComment.find(params[:id]).root
@act = OrgActivity.find(params[:id])
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
@comment.content = params[:org_content]
@document.children << @comment

View File

@ -0,0 +1,3 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");

View File

@ -1,3 +1,3 @@
$("#organization_document_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document}) %>");
init_activity_KindEditor_data(<%= @document.id %>,"","87%");
$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document, :act => @act}) %>");
init_activity_KindEditor_data(<%= @act.id %>,"","87%");

View File

@ -1,5 +1,10 @@
<% unless org_activities.nil? %>
<% org_activities.each do |act| %>
<script>
$(function() {
init_activity_KindEditor_data(<%= act.id%>, null, "87%");
});
</script>
<% if act.container_type == 'Organization' %>
<% if act.org_act_type == 'CreateOrganization' %>
<div class="resources mt10">
@ -17,12 +22,7 @@
</div>
<% end %>
<% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %>
<script>
$(function() {
init_activity_KindEditor_data(<%= act.org_act.id%>, null, "87%");
});
</script>
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %>
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act} %>
<% end %>
<% end %>
<% if act.container_type == 'Project' %>

View File

@ -130,7 +130,23 @@
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
</div>

View File

@ -91,16 +91,16 @@
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %>
</div>
<div class="homepagePostReplyInputContainer">
<div nhname='new_message_<%= document.id %>' style="display:none;">
<%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id), :method => "post", :remote => true) do |f| %>
<input type="hidden" name="user_activity_id" value="<%= document.id %>"/>
<textarea placeholder="有问题或建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= document.id %>' name="org_content"></textarea>
<div nhname='new_message_<%= act.id %>' style="display:none;">
<%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id), :method => "post", :remote => true) do |f| %>
<input type="hidden" name="org_activity_id" value="<%= act.id %>"/>
<textarea placeholder="有问题或建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= act.id %>' name="org_content"></textarea>
<div nhname='toolbar_container_<%= document.id %>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= document.id %>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;line-height:18px;">发送</a>
<div nhname='toolbar_container_<%= act.id %>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= act.id %>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;line-height:18px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= document.id %>'></p>
<p nhname='contentmsg_<%= act.id %>'></p>
<% end %>
</div>
</div>

View File

@ -30,7 +30,8 @@
init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%");
});
</script>
<%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %>
<% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %>
<%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %>
<% end %>
<%= render :partial => 'organizations/org_activities',

View File

@ -634,6 +634,7 @@ RedmineApp::Application.routes.draw do
end
member do
post 'add_journal'
post 'add_journal_in_org'
end
resources :time_entries, :controller => 'timelog' do
collection do