Merge branch 'develop' into dev_hjq

This commit is contained in:
huang 2015-12-07 17:31:03 +08:00
commit 07e414a2cd
11 changed files with 210 additions and 40 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

@ -12,7 +12,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','courses','prettify','jquery/jquery-ui-1.9.2','header','repository' %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->

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

@ -28,10 +28,9 @@
<!--<div class="fr mt5"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_fork"></span>Fork</a> <span href="javascript:void(0);" class="vl_btn_2 fb">0</span> </div>-->
<% unless User.current.id == @project.user_id %>
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn"%>
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span>
</div>
<% end %>
<%#= link_to "<span id='span'>My span&nbsp;</span>#{@user.profile.my_data}".html_safe, "#", class: 'button white' %>
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span> </div>
<div class="cl"></div>
<div class="recordBanner mt10">
<% if @changesets && !@changesets.empty? %>
@ -53,12 +52,14 @@
</span>
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
<%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %></font> 提交
<%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project,
:repository_id => @repository.identifier_param,
:rev => @rev,:page=>1 ,
:commit_count =>"#{@changesets_all_count}"} %></font> 提交
</span>
</div>
<% end %>
</div>
<!--contextual end-->
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
@ -67,14 +68,14 @@
<%# end %>
<%= render :partial => 'dir_list' %>
<% end %>
<%= render_properties(@properties) %>
<%#= render_properties(@properties) %>
<!-- 代码修订 -->
<%= render_properties(@properties) %>
<%#= render_properties(@properties) %>
<a href="https://<%=Setting.host_name %>/forums/1/memos/1232" >如何提交代码</a>
</div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
<% end %>

View File

@ -142,7 +142,7 @@
});
</script>
<% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" onmouseover="$('#message_edit_<%= comment.id%>').show();" onmouseout="$('#message_edit_<%= comment.id%>').hide();" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
</div>
@ -154,10 +154,12 @@
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(comment.created_on) %>
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %>
<% end %>
<div id="message_edit_<%=comment.id %>" style="display: none" class="fr">
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %>
<% end %>
</div>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.notes.html_safe %></div>

View File

@ -149,7 +149,7 @@
});
</script>
<% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" onmouseover="$('#message_edit_<%= comment.id%>').show();" onmouseout="$('#message_edit_<%= comment.id%>').hide();" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
</div>
@ -161,10 +161,12 @@
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(comment.created_on) %>
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course,:course_activity=>-1},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %>
<% end %>
<div class="fr" id="message_edit_<%=comment.id %>" style="display: none">
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course,:course_activity=>-1},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %>
<% end %>
</div>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.notes.html_safe %></div>

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'

View File

@ -907,3 +907,160 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
border: 1px solid #e4e4e4;
}
/*项目动态新样式*/
.homepageRight {
width: 750px;
float: left;
margin-top: 15px;
margin-bottom: 10px;
}
.homepageRightBanner {
width: 718px;
margin: 0px auto;
float: right;
background-color: #FFF;
padding: 10px 15px;
border: 1px solid #DDD;
}
.resources {
width: 718px;
background-color: #FFF;
padding: 15px;
border: 1px solid #DDD;
float: right;
}
.homepagePostBrief {
width: 720px;
margin: 0px auto;
position: relative;
}
.homepagePostPortrait {
float: left;
width: 50px;
}
.homepagePostDes {
float: left;
width: 655px;
margin-left: 15px;
}
.homepagePostTo {
font-size: 14px;
color: #484848;
margin-bottom: 5px;
}
.m_w600 {
max-width: 600px;
}
.hidden {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.homepagePostTitle {
font-size: 14px;
color: #484848;
margin-bottom: 5px;
font-weight: bold;
}
.maxh360 {
max-height: 360px;
}
.lh18 {
line-height: 18px;
}
.homepagePostIntro {
font-size: 14px;
color: #484848;
overflow: hidden;
}
.homepagePostReply {
width: 710px;
margin: 10px auto 0px;
background-color: #F1F1F1;
}
.topBorder {
border-top: 1px solid #E4E4E4;
}
.homepagePostReplyBanner {
width: 708px;
height: 33px;
border: 1px solid #E4E4E4;
line-height: 33px;
vertical-align: middle;
font-size: 12px;
color: #888;
}
.homepagePostReplyBannerCount {
width: 255px;
display: inline-block;
margin-left: 15px;
}
.homepagePostReplyBannerTime {
width: 85px;
display: inline-block;
}
.homepagePostReplyContainer {
border-bottom: 1px solid #E3E3E3;
width: 680px;
margin: 15px auto 0px;
min-height: 60px;
}
.borderBottomNone {
border-bottom: medium none !important;
}
.homepagePostReplyPortrait {
float: left;
width: 33px;
}
.homepagePostReplyInputContainer {
width: 630px;
float: left;
}
.homepagePostType {
width: 90px;
background-color: #FFF;
float: left;
list-style: outside none none;
position: absolute;
border: 1px solid #EAEAEA;
border-radius: 5px;
top: 15px;
padding: 5px 10px;
left: -80px;
font-size: 12px;
color: #4B4B4B;
line-height: 2;
z-index: 9999;
display: none;
}
.homepagePostTypeHomework {
width: 90px;
}
a.homepagePostTypeAll {
background: transparent url("../images/homepage_icon.png") no-repeat scroll -189px -308px;
padding-left: 23px;
}
a.homepagePostTypeAssignment {
background: transparent url("../images/homepage_icon.png") no-repeat scroll -93px -318px;
padding-left: 23px;
}
a.homepagePostTypeNotice {
background: transparent url("../images/homepage_icon.png") no-repeat scroll -87px -280px;
padding-left: 23px;
}
a.homepagePostTypeResource {
background: transparent url("images/homepage_icon.png") no-repeat scroll -86px -517px;
padding-left: 23px;
}
a.homepagePostTypeForum {
background: transparent url("../images/homepage_icon.png") no-repeat scroll -10px -310px;
padding-left: 23px;
}
a.homepagePostTypeMessage {
background: transparent url("images/homepage_icon.png") no-repeat scroll -3px -518px;
padding-left: 23px;
}
a.homepagePostTypeQuiz {
background: transparent url("../images/homepage_icon.png") no-repeat scroll -90px -124px;
padding-left: 23px;
}