Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2 into develop

This commit is contained in:
huang 2015-12-07 17:25:51 +08:00
commit 298bf037ad
6 changed files with 28 additions and 20 deletions

View File

@ -239,6 +239,13 @@ class OrganizationsController < ApplicationController
end
end
def logout
logout_user
respond_to do |format|
format.html {redirect_to organization_path(params[:id])}
end
end
def search_projects
@organization = Organization.find(params[:id])
condition = '%%'

View File

@ -46,20 +46,24 @@ class ForgeActivity < ActiveRecord::Base
end
def add_org_activity
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
if org_activity
org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
if org_activity
org_activity.created_at = self.created_at
org_activity.save
else
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
org_activity.created_at = self.created_at
org_activity.save
else
OrgActivity.create(:user_id => self.user_id,
:org_act_id => self.forge_act_id,
:org_act_type => self.forge_act_type,
:container_id => self.project_id,
:container_type => 'Project',
:created_at => self.created_at,
:updated_at => self.updated_at)
end
else
OrgActivity.create(:user_id => self.user_id,
:org_act_id => self.forge_act_id,
:org_act_type => self.forge_act_type,
:container_id => self.project_id,
:container_type => 'Project',
:created_at => self.created_at,
:updated_at => self.updated_at)
end
end

View File

@ -186,7 +186,7 @@ class Message < ActiveRecord::Base
# Description
def act_as_forge_activity
# 如果project为空那么就是课程相关的消息
if !self.board.project.nil?
if !self.board.project.nil? && self.parent_id.nil?
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
:project_id => self.board.project.id)
end

View File

@ -46,12 +46,13 @@
<li class="navOrgMenu fr" id="orgSwitch" style="cursor:pointer;">
<span class="orgMenuArrow" id="orgArrow">
<ul class="org_login_list" style="display:none;">
<li> <%= link_to "个人主页",user_path(User.current), :class => "linkGrey8" %></li>
<li><%= link_to "退出",signout_path, :class =>"linkGrey8", :method => 'post', :rel => "nofollow" %></li>
<li> <%= link_to "个人主页",user_path(User.current), :class => "linkGrey8", :target => "_blank" %></li>
<li><%= link_to "退出",logout_organization_path(@organization), :class =>"linkGrey8", :method => 'post', :rel => "nofollow" %></li>
<!--<li><%#= link_to "退出",signout_path, :class =>"linkGrey8", :method => 'post', :rel => "nofollow" %></li>-->
</ul>
</span>
</li>
<li class="navOrgMenu fr" id="orgUser" style="cursor:pointer;"><%=link_to User.current, user_path(User.current), :class => "linkGrey8 f14", :id => "orgUserName" %></li>
<li class="navOrgMenu fr" id="orgUser" style="cursor:pointer;"><a href="javascript:void(0);" class="linkGrey8 f14" id="orgUserName"><%= User.current %></a></li>
<!--<li class="navOrgMenu fr"><%#=link_to User.current, user_path(User.current), :class => "linkGrey8 f14" %></li>-->
<% else %>
<li class="navOrgMenu fr"><a href="<%= signin_path(:login=>true) %>" class="linkGrey8 f14">登录</a></li>

View File

@ -4,11 +4,6 @@
<li class="orgListRole fb">状态</li>
<div class="cl"></div>
</ul>
<ul class="orgListRow">
<li class="orgListUser">组织首页</li>
<li class="orgListUser">默认</li>
<div class="cl"></div>
</ul>
<ul class="orgListRow">
<li class="orgListUser">动态</li>
<li class="orgListUser">默认</li>

View File

@ -46,6 +46,7 @@ RedmineApp::Application.routes.draw do
get 'search_projects'
post 'join_project_menu'
post 'join_projects'
post 'logout'
end
collection do
get 'check_uniq'