Conflicts:
	config/locales/zh.yml
This commit is contained in:
z9hang 2015-03-10 17:21:59 +08:00
commit 57ba46ff00
10 changed files with 55 additions and 13 deletions

View File

@ -446,12 +446,13 @@ class UsersController < ApplicationController
activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc') activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc')
end end
activity = activity.reject { |e| activity = activity.reject { |e|
!User.current.admin? && e.act.nil? ||
(!User.current.admin? && !e.act.nil?
(((e.act_type == "Issue") && !e.act.project.visible?(User.current)) || (((e.act_type == "Issue") && !e.act.project.visible?(User.current)) ||
(e.act_type == "Bid" && !e.act.courses.first.nil? && e.act.courses.first.is_public == 0 && !User.current.member_of_course?(e.act.courses.first)) || (e.act_type == "Bid" && !e.act.courses.first.nil? && e.act.courses.first.is_public == 0 && !User.current.member_of_course?(e.act.courses.first)) ||
(e.act_type == "Journal" && e.act.respond_to?("Project") && !e.act.project.visible?(User.current)) || (e.act_type == "Journal" && e.act.respond_to?("Project") && !e.act.project.visible?(User.current)) ||
(e.act_type == "News" && ((!e.act.project.nil? && !e.act.project.visible?(User.current)) || (!e.act.course.nil? && e.act.course.is_public == 0 && !User.current.member_of_course?(e.act.course)))) || (e.act_type == "News" && ((!e.act.project.nil? && !e.act.project.visible?(User.current)) || (!e.act.course.nil? && e.act.course.is_public == 0 && !User.current.member_of_course?(e.act.course)))) ||
(e.act_type == "Message" && !e.act.board.nil? && ((!e.act.board.project.nil? && !e.act.board.project.visible?(User.current)) || (!e.act.board.course.nil? && e.act.board.course.is_public == 0 && !User.current.member_of_course?(e.act.board.course))))) (e.act_type == "Message" && !e.act.board.nil? && ((!e.act.board.project.nil? && !e.act.board.project.visible?(User.current)) || (!e.act.board.course.nil? && e.act.board.course.is_public == 0 && !User.current.member_of_course?(e.act.board.course))))))
} }
@activity_count = activity.count @activity_count = activity.count
@activity_pages = Paginator.new @activity_count, pre_count, params['page'] @activity_pages = Paginator.new @activity_count, pre_count, params['page']

View File

@ -131,7 +131,7 @@ class Project < ActiveRecord::Base
#ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用 #ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?} after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
# 创建project之后默认创建一个board之后的board去掉了board的概念 # 创建project之后默认创建一个board之后的board去掉了board的概念
after_create :create_board_sync after_create :create_board_sync,:acts_as_forge_activities
before_destroy :delete_all_members before_destroy :delete_all_members
def remove_references_before_destroy def remove_references_before_destroy
return if self.id.nil? return if self.id.nil?
@ -1154,6 +1154,13 @@ class Project < ActiveRecord::Base
end end
end end
# Time 2015-03-10 15:33:16
# Author lizanle
# Description 新建项目要在ForgeActivities中加一条数据。
def acts_as_forge_activities
fa = ForgeActivity.new(:user_id => User.current.id,:project_id => self.id,
:forge_act_id => self.id,:forge_act_type => "ProjectCreateInfo")
fa.save!
end
end end

View File

@ -25,7 +25,7 @@
:homework_id =>homework.id }, :homework_id =>homework.id },
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %> :remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<% end %> <% end %>
<%= link_to l(:label_newfeedback_respond),'', <%= link_to l(:button_reply),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"} {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"}
%> %>
</span> </span>

View File

@ -34,7 +34,7 @@
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %> :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
<% end %> <% end %>
<% if reply_allow %> <% if reply_allow %>
<%= link_to l(:label_newfeedback_respond),'', <%= link_to l(:button_reply),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %> {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %>
<% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: --> <% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
</span> </span>

View File

@ -65,7 +65,7 @@
</span> </span>
<% ids = 'project_respond_form_'+ journal.id.to_s%> <% ids = 'project_respond_form_'+ journal.id.to_s%>
<span> <span>
<%= link_to l(:label_newfeedback_respond),'', <%= link_to l(:button_reply),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"} {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"}
%> %>
<% if journal.user==User.current|| User.current.admin? %> <% if journal.user==User.current|| User.current.admin? %>

View File

@ -2,18 +2,22 @@
@nav_dispaly_forum_label = 1 %> @nav_dispaly_forum_label = 1 %>
<%= labelled_form_for @project do |f| %> <%= labelled_form_for @project do |f| %>
<div class="project_new"><%=l(:label_project_new)%><span class="description"> <%=raw l(:label_project_new_description)%></span> <div class="project_new">
<%=l(:label_project_new)%>
<span class="description">
</span>
<div class="box tabular" > <div class="box tabular" >
<p style="font-weight: bold; color: rgb(237,137,36)"> <p style="font-weight: bold; color: rgb(237,137,36)">
<%=raw l(:label_project_new_description)%> <%=raw l(:label_project_new_description)%>
</p> </p>
<%= render :partial => 'form', :locals => { :f => f } %> <%= render :partial => 'form', :locals => { :f => f } %>
<span style="padding-left: 60px"> <span style="padding-left: 60px">
<%= submit_tag l(:button_create), :class => "enterprise"%> <%= submit_tag l(:button_create), :class => "enterprise"%>
</span> </span>
</div> </div>
<%#= submit_tag l(:button_create_and_continue), :name => 'continue' %> <%#= submit_tag l(:button_create_and_continue), :name => 'continue' %>
<%= javascript_tag "$('#project_name').focus();" %> <%= javascript_tag "$('#project_name').focus();" %>
</div>
<% end %> <% end %>
<% html_title(l(:label_project_new)) -%> <% html_title(l(:label_project_new)) -%>

View File

@ -21,7 +21,37 @@
<div class="scroll"> <div class="scroll">
<% unless @events_pages.empty? %> <% unless @events_pages.empty? %>
<% @events_pages.each do |e| -%> <% @events_pages.each do |e| -%>
<% act = e.forge_act; <% if e.forge_act_type == "ProjectCreateInfo"%>
<div class="font_description">
<table width="660">
<tr>
<td>
<%= image_tag(url_to_avatar(e.user), :class => "avatar") %>
</td>
<td colspan="2">
<table width="580">
<tr>
<td>
<%= link_to_user(e.user)%>
<%= l(:label_project_new) %>
<%= link_to e.project.name %>
<strong> !</strong>
</td>
</tr>
<tr>
<td class="font_lighter" >
<%= l :label_create_time %>:
<%= format_time(e.created_at) %>
</table>
</td>
</tr>
</table>
</div>
<% end %>
<% next if e.forge_act_type.safe_constantize.nil?
act = e.forge_act;
next if act.nil? %> next if act.nil? %>
<% if e.forge_act_type == "Issue" %> <% if e.forge_act_type == "Issue" %>
<div class="activity-item underline-evreycontent" style="font-size: 14px;line-height:1.5em;width: 100%;word-wrap: break-word;word-break: break-all;margin-top: 10px;"> <div class="activity-item underline-evreycontent" style="font-size: 14px;line-height:1.5em;width: 100%;word-wrap: break-word;word-break: break-all;margin-top: 10px;">

View File

@ -11,7 +11,7 @@
<% id = 'project_respond_form_'+journal.id.to_s%> <% id = 'project_respond_form_'+journal.id.to_s%>
<span> <span>
<% if reply_allow %> <% if reply_allow %>
<%= link_to l(:label_newfeedback_respond),'#', <%= link_to l(:button_reply),'#',
{:focus => 'project_respond', {:focus => 'project_respond',
:onclick => "toggleAndSettingWordsVal($('##{id}'), :onclick => "toggleAndSettingWordsVal($('##{id}'),
$('##{id} textarea'), $('##{id} textarea'),

View File

@ -36,7 +36,7 @@
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %> :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
<% end %> <% end %>
<% if reply_allow %> <% if reply_allow %>
<%= link_to l(:label_newfeedback_respond),'', <%= link_to l(:button_reply),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %> {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %>
<% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: --> <% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
</span> </span>

View File

@ -51,7 +51,7 @@ function checkMaxLength() {
<% ids = 'project_respond_form_'+ journal.id.to_s%> <% ids = 'project_respond_form_'+ journal.id.to_s%>
<span> <span>
<% if reply_allow %> <% if reply_allow %>
<%= link_to l(:label_newfeedback_respond),'', <%= link_to l(:button_reply),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"} {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"}
%> %>
<% end %> <% end %>