From fba461f94a62d405c1632eea14902508ec2082bc Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 17 Nov 2015 09:51:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E4=B8=AD=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E5=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 5 +++++ app/controllers/organizations_controller.rb | 6 +++--- .../organizations/_org_activities.html.erb | 4 ++-- .../organizations/_project_create.html.erb | 2 +- .../organizations/_project_message.html.erb | 18 ++++++++++++++++++ app/views/organizations/show.html.erb | 9 ++++++--- 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 4f78d61f5..9b090de9a 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -174,6 +174,11 @@ class MessagesController < ApplicationController user_activity.updated_at = Time.now user_activity.save end + org_activity = OrgActivity.where("org_act_type='Message' and org_act_id =#{@topic.id}").first + if org_activity + org_activity.updated_at = Time.now + org_activity.save + end #@topic.update_attribute(:updated_on, Time.now) if !@reply.new_record? if params[:asset_id] diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 6a1030adc..392966d68 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -56,10 +56,10 @@ class OrganizationsController < ApplicationController if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) @organization = Organization.find(params[:id]) project_ids = @organization.projects.map(&:id) << 0 - @org_activities = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))", + @org_activities = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')}))", @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) - @org_activities_count = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))" , - @organization.id, 'Organization ').count + # @org_activities_count = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))" , + # @organization.id, 'Organization ').count # @org_project_activties = ForgeActivity.where("project_id in (#{project_ids.join(',')}) and forge_act_type in('Issue','Message','ProjectCreateInfo')").order("updated_at desc").page(params[:page] || 1).per(10) # @org_project_activties_count = ForgeActivity.where('project_id in (?)',project_ids.join(',')).count #@org_activities = paginateHelper @org_activities, 10 diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index 148bb9efe..9523a0a15 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -31,8 +31,8 @@ <%= render :partial => 'organizations/org_project_issue', :locals => {:activity => Issue.find(act.org_act_id),:user_activity_id =>act.id} %> <% when 'Message' %> <%= render :partial => 'organizations/project_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %> - <%# when 'ProjectCreateInfo'%> - <%#= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %> + <% when 'ProjectCreateInfo'%> + <%= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %> <% end %> <% end %> <% end %> diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb index d966d8e18..607c14a45 100644 --- a/app/views/organizations/_project_create.html.erb +++ b/app/views/organizations/_project_create.html.erb @@ -1,4 +1,4 @@ -<% project = Project.find(activity.project_id) %> +<% project = Project.find(activity.org_act_id) %> <% user = User.find(project.user_id)%>
diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index 85ed08f2f..2708bb546 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -95,6 +95,24 @@
<% end %> +
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> + + + +
+ +
+

+ <% end%> +
+
+
+
+
\ No newline at end of file diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 1ccb2f0e5..36cc24225 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -14,14 +14,17 @@
最新动态
- + +
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>