diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e6171bf81..d770a4633 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -446,12 +446,13 @@ class UsersController < ApplicationController activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc') end 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 == "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 == "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_pages = Paginator.new @activity_count, pre_count, params['page'] diff --git a/app/models/project.rb b/app/models/project.rb index 099870bc7..313652bf4 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -131,7 +131,7 @@ class Project < ActiveRecord::Base #ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用 after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?} # 创建project之后默认创建一个board,之后的board去掉了board的概念 - after_create :create_board_sync + after_create :create_board_sync,:acts_as_forge_activities before_destroy :delete_all_members def remove_references_before_destroy return if self.id.nil? @@ -1154,6 +1154,13 @@ class Project < ActiveRecord::Base 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 diff --git a/app/views/homework_attach/_jour.html.erb b/app/views/homework_attach/_jour.html.erb index 45c5a1318..0544baea3 100644 --- a/app/views/homework_attach/_jour.html.erb +++ b/app/views/homework_attach/_jour.html.erb @@ -25,7 +25,7 @@ :homework_id =>homework.id }, :remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %> <% end %> - <%= link_to l(:label_newfeedback_respond),'', + <%= link_to l(:button_reply),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"} %> diff --git a/app/views/homework_attach/_journal_reply_items.html.erb b/app/views/homework_attach/_journal_reply_items.html.erb index 06fea3946..fc48c31cf 100644 --- a/app/views/homework_attach/_journal_reply_items.html.erb +++ b/app/views/homework_attach/_journal_reply_items.html.erb @@ -34,7 +34,7 @@ :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %> <% end %> <% if reply_allow %> - <%= link_to l(:label_newfeedback_respond),'', + <%= link_to l(:button_reply),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %> <% end %> diff --git a/app/views/homework_attach/_showjour.html.erb b/app/views/homework_attach/_showjour.html.erb index c9f390fd1..90f18311e 100644 --- a/app/views/homework_attach/_showjour.html.erb +++ b/app/views/homework_attach/_showjour.html.erb @@ -65,7 +65,7 @@ <% ids = 'project_respond_form_'+ journal.id.to_s%> - <%= 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;"} %> <% if journal.user==User.current|| User.current.admin? %> diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index 455f4ad1b..98612b733 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -2,18 +2,22 @@ @nav_dispaly_forum_label = 1 %> <%= labelled_form_for @project do |f| %> -
<%=l(:label_project_new)%> <%=raw l(:label_project_new_description)%> +
+ <%=l(:label_project_new)%> + +

<%=raw l(:label_project_new_description)%>

<%= render :partial => 'form', :locals => { :f => f } %> - <%= submit_tag l(:button_create), :class => "enterprise"%> + <%= submit_tag l(:button_create), :class => "enterprise"%>
<%#= submit_tag l(:button_create_and_continue), :name => 'continue' %> <%= javascript_tag "$('#project_name').focus();" %> +
<% end %> <% html_title(l(:label_project_new)) -%> \ No newline at end of file diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index fc64d3af8..0081fde84 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -21,7 +21,37 @@
<% unless @events_pages.empty? %> <% @events_pages.each do |e| -%> - <% act = e.forge_act; + <% if e.forge_act_type == "ProjectCreateInfo"%> +
+ + + + + +
+ <%= image_tag(url_to_avatar(e.user), :class => "avatar") %> + + + + + + +
+ + <%= link_to_user(e.user)%> + + <%= l(:label_project_new) %> + <%= link_to e.project.name %> + ! +
+ <%= l :label_create_time %>: + <%= format_time(e.created_at) %> +
+
+
+ <% end %> + <% next if e.forge_act_type.safe_constantize.nil? + act = e.forge_act; next if act.nil? %> <% if e.forge_act_type == "Issue" %>
diff --git a/app/views/words/_feedback.html.erb b/app/views/words/_feedback.html.erb index 7bbf76d49..a64159a88 100644 --- a/app/views/words/_feedback.html.erb +++ b/app/views/words/_feedback.html.erb @@ -11,7 +11,7 @@ <% id = 'project_respond_form_'+journal.id.to_s%> <% if reply_allow %> - <%= link_to l(:label_newfeedback_respond),'#', + <%= link_to l(:button_reply),'#', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index 7b4658a56..bd76bc52d 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -36,7 +36,7 @@ :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %> <% end %> <% if reply_allow %> - <%= link_to l(:label_newfeedback_respond),'', + <%= link_to l(:button_reply),'', {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %> <% end %> diff --git a/app/views/words/_message.html.erb b/app/views/words/_message.html.erb index 8182beaaa..cbdb9f6f6 100644 --- a/app/views/words/_message.html.erb +++ b/app/views/words/_message.html.erb @@ -51,7 +51,7 @@ function checkMaxLength() { <% ids = 'project_respond_form_'+ journal.id.to_s%> <% 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;"} %> <% end %>