修改用户活动,用户主页的其他部分添加分页

This commit is contained in:
fanqiang 2013-08-12 15:37:42 +08:00
parent 4b998de820
commit 69e3dcee6c
23 changed files with 252 additions and 195 deletions

View File

@ -74,7 +74,17 @@ class UsersController < ApplicationController
##added by fq ##added by fq
def watch_bids def watch_bids
@bid = Bid.watched_by(@user) @bids = Bid.watched_by(@user)
@offset, @limit = api_offset_and_limit({:limit => 10})
@bid_count = @bids.count
@bid_pages = Paginator.new @bid_count, @limit, params['page']
@offset ||= @bid_pages.reverse_offset
unless @offset == 0
@bid = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
@bid = @bids.offset(@offset).limit(limit).all.reverse
end
respond_to do |format| respond_to do |format|
format.html { format.html {
@ -108,12 +118,17 @@ class UsersController < ApplicationController
end end
# end # end
# modified by fq
def user_newfeedback def user_newfeedback
@jour = @user.journals_for_messages @jours = @user.journals_for_messages.reverse
@jour.each_with_index {|j,i| j.indice = i+1} @limit = 10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
@state = false @state = false
end end
# end
def user_comments def user_comments
@ -157,46 +172,54 @@ class UsersController < ApplicationController
### modified by fq ### modified by fq
def show def show
has = { # has = {
"show_issues" => true, # "show_issues" => true,
"show_changesets" => true, # "show_changesets" => true,
"show_news" => true, # "show_news" => true,
"show_messages" => true, # "show_messages" => true,
"show_bids" => true, # "show_bids" => true,
} # }
#####fq #####fq
JournalsForMessage.reference_message(@user.id) # JournalsForMessage.reference_message(@user.id)
# show projects based on current user visibility # show projects based on current user visibility
@memberships = @user.memberships.all(:conditions => Project.visible_condition(User.current)) # @memberships = @user.memberships.all(:conditions => Project.visible_condition(User.current))
if @user == User.current
events = []
activity = Redmine::Activity::Fetcher.new(User.current, :author => User.current)
activity.scope_select {|t| !has["show_#{t}"].nil?}
events += activity.events(nil, nil, :limit => 10)
@watcher = User.watched_by(@user)
for user in @watcher
activity = Redmine::Activity::Fetcher.new(User.current, :author => user)
activity.scope_select {|t| !has["show_#{t}"].nil?}
events += activity.events(nil, nil, :limit => 10)
end
else
activity = Redmine::Activity::Fetcher.new(User.current, :author => @user)
activity.scope_select {|t| !has["show_#{t}"].nil?}
events = activity.events(nil, nil, :limit => 10)
end
@events = []
@events_by_day = events.group_by(&:event_date)
@events_by_day.keys.sort.reverse.each do |day|
@events += @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime}
end
# if @user == User.current
# events = []
# activity = Redmine::Activity::Fetcher.new(User.current, :author => User.current)
# activity.scope_select {|t| !has["show_#{t}"].nil?}
# events += activity.events(nil, nil, :limit => 10)
# @watcher = User.watched_by(@user)
# for user in @watcher
# activity = Redmine::Activity::Fetcher.new(User.current, :author => user)
# activity.scope_select {|t| !has["show_#{t}"].nil?}
# events += activity.events(nil, nil, :limit => 10)
# end
# else
# activity = Redmine::Activity::Fetcher.new(User.current, :author => @user)
# activity.scope_select {|t| !has["show_#{t}"].nil?}
# events = activity.events(nil, nil, :limit => 10)
# end
# @events = []
# @events_by_day = events.group_by(&:event_date)
# @events_by_day.keys.sort.reverse.each do |day|
# @events += @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime}
# end
# @offset, @limit = api_offset_and_limit({:limit => 10})
# @activity_count = @events.size
# @activity_pages = Paginator.new @activity_count, @limit, params['page']
# @offset ||= @activity_pages.offset
# @events_by_day_ = @events.slice(@offset,@limit)
watcher = User.watched_by(@user)
watcher.push(User.current)
activity = Activity.where('user_id in (?)', watcher).order('id desc')
@offset, @limit = api_offset_and_limit({:limit => 10}) @offset, @limit = api_offset_and_limit({:limit => 10})
@activity_count = @events.size @activity_count = activity.count
@activity_pages = Paginator.new @activity_count, @limit, params['page'] @activity_pages = Paginator.new @activity_count, @limit, params['page']
@offset ||= @activity_pages.offset @offset ||= @activity_pages.offset
@events_by_day_ = @events.slice(@offset,@limit) @activity = activity.offset(@offset).limit(@limit)
#Modified by nie #Modified by nie
unless User.current.admin? unless User.current.admin?

View File

@ -17,8 +17,12 @@ class WordsController < ApplicationController
# @message_count = a_message.count # @message_count = a_message.count
end end
end end
@jour = @user.journals_for_messages @jours = @user.journals_for_messages.reverse
@jour.each_with_index {|j,i| j.indice = i+1} @limit = 10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
respond_to do |format| respond_to do |format|
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
@ -29,8 +33,12 @@ class WordsController < ApplicationController
def destroy def destroy
JournalsForMessage.delete_message(params[:object_id]) JournalsForMessage.delete_message(params[:object_id])
@jour = @user.journals_for_messages @jours = @user.journals_for_messages.reverse
@jour.each_with_index {|j,i| j.indice = i+1} @limit = 10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
# if a_message.size > 5 # if a_message.size > 5
# @message = a_message[-5, 5] # @message = a_message[-5, 5]
# else # else
@ -64,8 +72,12 @@ class WordsController < ApplicationController
end end
def more def more
@jour = @user.journals_for_messages @jours = @user.journals_for_messages.reverse
@jour.each_with_index {|j,i| j.indice = i+1} @limit = 10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
@state = true @state = true
respond_to do |format| respond_to do |format|
@ -76,8 +88,12 @@ class WordsController < ApplicationController
end end
def back def back
@jour = @user.journals_for_messages @jours = @user.journals_for_messages.reverse
@jour.each_with_index {|j,i| j.indice = i+1} @limit = 10
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
@state = false @state = false
respond_to do |format| respond_to do |format|

View File

@ -61,4 +61,6 @@ module UsersHelper
User.tagged_with(tag_name).by_join_date User.tagged_with(tag_name).by_join_date
end end
# added by fq
end end

View File

@ -1,4 +1,7 @@
class Activity < ActiveRecord::Base class Activity < ActiveRecord::Base
attr_accessible :act_id, :act_type, :user_id attr_accessible :act_id, :act_type, :user_id
belongs_to :act, :polymorphic => true belongs_to :act, :polymorphic => true
belongs_to :user
validates_presence_of :act_id, :act_type, :user_id
end end

View File

@ -6,7 +6,7 @@ class Bid < ActiveRecord::Base
has_many :biding_projects, :dependent => :destroy has_many :biding_projects, :dependent => :destroy
has_many :projects, :through => :biding_projects has_many :projects, :through => :biding_projects
has_many :journals_for_messages, :as => :jour, :dependent => :destroy has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :acts, :as => :act, :dependent => :destroy has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
NAME_LENGTH_LIMIT = 60 NAME_LENGTH_LIMIT = 60
DESCRIPTION_LENGTH_LIMIT = 250 DESCRIPTION_LENGTH_LIMIT = 250
@ -18,7 +18,7 @@ class Bid < ActiveRecord::Base
# validates_format_of :deadline, :with => # validates_format_of :deadline, :with =>
validate :validate_user validate :validate_user
# after_save :act_as_activity after_save :act_as_activity
scope :visible, lambda {|*args| scope :visible, lambda {|*args|
nil nil
@ -81,7 +81,7 @@ class Bid < ActiveRecord::Base
errors.add :author_id, :invalid if author.nil? || !author.active? errors.add :author_id, :invalid if author.nil? || !author.active?
end end
# def act_as_activity def act_as_activity
# self.acts << Activity.new(:user_id => self.author_id) self.acts << Activity.new(:user_id => self.author_id)
# end end
end end

View File

@ -19,6 +19,10 @@ class Changeset < ActiveRecord::Base
belongs_to :repository belongs_to :repository
belongs_to :user belongs_to :user
has_many :filechanges, :class_name => 'Change', :dependent => :delete_all has_many :filechanges, :class_name => 'Change', :dependent => :delete_all
# fq
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# end
has_and_belongs_to_many :issues has_and_belongs_to_many :issues
has_and_belongs_to_many :parents, has_and_belongs_to_many :parents,
:class_name => "Changeset", :class_name => "Changeset",
@ -54,6 +58,10 @@ class Changeset < ActiveRecord::Base
after_create :scan_for_issues after_create :scan_for_issues
before_create :before_create_cs before_create :before_create_cs
# fq
after_save :act_as_activity
# end
def revision=(r) def revision=(r)
write_attribute :revision, (r.nil? ? nil : r.to_s) write_attribute :revision, (r.nil? ? nil : r.to_s)
end end
@ -210,6 +218,10 @@ class Changeset < ActiveRecord::Base
private private
def act_as_activity
self.acts << Activity.new(:user_id => self.user_id)
end
def fix_issue(issue) def fix_issue(issue)
status = IssueStatus.find_by_id(Setting.commit_fix_status_id.to_i) status = IssueStatus.find_by_id(Setting.commit_fix_status_id.to_i)
if status.nil? if status.nil?

View File

@ -25,7 +25,8 @@ class Journal < ActiveRecord::Base
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all has_many :details, :class_name => "JournalDetail", :dependent => :delete_all
# added by fq # added by fq
has_one :journal_reply has_one :journal_reply
#end has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# end
attr_accessor :indice attr_accessor :indice
acts_as_event :title => Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.id}#{status}: #{o.issue.subject}" }, acts_as_event :title => Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.id}#{status}: #{o.issue.subject}" },
@ -43,6 +44,10 @@ class Journal < ActiveRecord::Base
before_create :split_private_notes before_create :split_private_notes
# fq
after_save :act_as_activity
# end
scope :visible, lambda {|*args| scope :visible, lambda {|*args|
user = args.shift || User.current user = args.shift || User.current
@ -140,4 +145,10 @@ class Journal < ActiveRecord::Base
end end
true true
end end
# fq
def act_as_activity
self.acts << Activity.new(:user_id => self.user_id)
end
# end
end end

View File

@ -23,6 +23,10 @@ class Message < ActiveRecord::Base
acts_as_attachable acts_as_attachable
belongs_to :last_reply, :class_name => 'Message', :foreign_key => 'last_reply_id' belongs_to :last_reply, :class_name => 'Message', :foreign_key => 'last_reply_id'
# added by fq
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# end
acts_as_searchable :columns => ['subject', 'content'], acts_as_searchable :columns => ['subject', 'content'],
:include => {:board => :project}, :include => {:board => :project},
:project_key => "#{Board.table_name}.project_id", :project_key => "#{Board.table_name}.project_id",
@ -46,6 +50,10 @@ class Message < ActiveRecord::Base
after_update :update_messages_board after_update :update_messages_board
after_destroy :reset_counters! after_destroy :reset_counters!
# fq
after_save :act_as_activity
# end
scope :visible, lambda {|*args| scope :visible, lambda {|*args|
includes(:board => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_messages, *args)) includes(:board => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_messages, *args))
} }
@ -105,4 +113,10 @@ class Message < ActiveRecord::Base
def add_author_as_watcher def add_author_as_watcher
Watcher.create(:watchable => self.root, :user => author) Watcher.create(:watchable => self.root, :user => author)
end end
# fq
def act_as_activity
self.acts << Activity.new(:user_id => self.author_id)
end
# end
end end

View File

@ -20,6 +20,9 @@ class News < ActiveRecord::Base
belongs_to :project belongs_to :project
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on" has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on"
# fq
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
#end
validates_presence_of :title, :description validates_presence_of :title, :description
validates_length_of :title, :maximum => 60 validates_length_of :title, :maximum => 60
@ -33,6 +36,9 @@ class News < ActiveRecord::Base
acts_as_watchable acts_as_watchable
after_create :add_author_as_watcher after_create :add_author_as_watcher
# fq
after_save :act_as_activity
# end
scope :visible, lambda {|*args| scope :visible, lambda {|*args|
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
@ -63,4 +69,8 @@ class News < ActiveRecord::Base
def add_author_as_watcher def add_author_as_watcher
Watcher.create(:watchable => self, :user => author) Watcher.create(:watchable => self, :user => author)
end end
## fq
def act_as_activity
self.acts << Activity.new(:user_id => self.author_id)
end
end end

View File

@ -82,6 +82,7 @@ class User < Principal
has_many :bids, :foreign_key => 'author_id', :dependent => :destroy has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :dependent => :destroy has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :journal_replies has_many :journal_replies
has_many :activities
##### #####

View File

@ -1,47 +0,0 @@
# fq
class WatchersOfProjects < ActiveRecord::Base
attr_accessible :project_id, :user_id
belongs_to :project
belongs_to :user
validate :validate_user
validate :validate_project
validates_uniqueness_of :user_id, :scope => :project_id
validates_presence_of :user_id, :project_id
def self.watch(user_id, project_id)
@new_watch = WatchersOfProjects.new
@new_watch.user_id = user_id
@new_watch.project_id = project_id
@new_watch.save
true
end
def self.watcher_count(project)
@project = project
@count = @project.watchers_of_projects.count
@count
end
def self.is_watched(user_id, project_id)
@is_watched = self.where("user_id = ? and project_id = ?", user_id, project_id).to_a.first
if @is_watched.nil?
false
else
true
end
end
def self.watch_cancle(user_id, project_id)
self.delete_all(["user_id = ? and project_id = ?", user_id, project_id])
true
end
def validate_user
errors.add :user_id, :invalid if user.nil? || !user.active?
end
def validate_project
errors.add :project_id, :invalid if project.nil?
end
end

View File

@ -1,66 +0,0 @@
# fq
class WatchersOfUser < ActiveRecord::Base
attr_accessible :user_id, :watcher_id
belongs_to :user
validates_uniqueness_of :watcher_id, :scope => :user_id
validate :validate_user
validate :validate_watcher
validates_presence_of :watcher_id, :user_id
def self.watch_user(watcher_id, user_id)
unless user_id == watcher_id
@watchers_of_user = WatchersOfUser.new
@watchers_of_user.watcher_id = watcher_id
@watchers_of_user.user_id = user_id
@watchers_of_user.save
true
else
false
end
end
def cancel_watching_user
self.class.cancel_watching_user(self.watcher_id, self.user_id)
end
def self.cancel_watching_user(watcher_id, user_id)
self.delete_all(["user_id = ? and watcher_id = ?", user_id, watcher_id])
true
end
def self.find_users(watcher_id)
@user = WatchersOfUser.find_by_sql("select * from users where id in (select user_id from #{WatchersOfUser.table_name} where watcher_id = #{watcher_id})")
@user
# @watch_table_for_user=WatchersOfUser.where(:watcher_id => watcher_id)
# @user = []
# @watch_table_for_user.each do |watch|
# @user.push(watch.user)
# end
# @user
end
def self.find_watchers(user_id)
@watcher = WatchersOfUser.find_by_sql("select * from users where id in (select watcher_id from #{WatchersOfUser.table_name} where user_id = #{user_id})")
@watcher
# user = User.find(user_id)
# @watch_table_for_watcher = user.watchers_of_users
# @watcher = []
# @watch_table_for_watcher.each do |watch|
# user_temp = User.find(watch.watcher_id)
# @watcher.push(user_temp)
# end
# @watcher
end
#验证user是否存在
def validate_user
errors.add :user_id, :invalid if user.nil? || !user.active?
end
#验证watcher是否存在
def validate_watcher
user = User.where("id = ?", watcher_id).to_a.first
errors.add :watcher_id, :invalid if user.nil? || !user.active?
end
end

View File

@ -1,29 +1,88 @@
<% unless @events_by_day.empty? %> <% unless @activity.empty? %>
<div id="activity"> <div id="activity">
<% @events_by_day_.each do |e| %> <% @activity.each do |e| %>
<% act = e.act %>
<table width="660" border="0" align="left" style="border-bottom: 1px solid rgb(225, 225, 225); margin-bottom: 10px;"> <table width="660" border="0" align="left" style="border-bottom: 1px solid rgb(225, 225, 225); margin-bottom: 10px;">
<tr> <tr>
<!-- fq --> <!-- fq -->
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(e.event_author), :class => "avatar"), user_path(e.event_author), :class => "avatar" %></td> <td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(e.user), :class => "avatar"), user_path(e.user_id), :class => "avatar" %></td>
<td> <td>
<table width="580" border="0"> <table width="580" border="0">
<% case e.act_type %>
<% when 'Bid' %>
<tr> <tr>
<% if e.event_author == User.current%> <% if e.user_id == User.current%>
<td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.event_author)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title(e.event_title), e.event_url %></td> <td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_bid_plural)}##{act.id}:#{act.name}"), respond_path(e.act_id) %></td>
<% else %> <% else %>
<td colspan="2" valign="top"><strong> <%= link_to(h(e.event_author), user_path(e.event_author)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title(e.event_title), e.event_url %></td> <td colspan="2" valign="top"><strong> <%= link_to(h(e.user_id), user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_bid_plural)}##{act.id}:#{act.name}"), respond_path(e.act_id) %></td>
<% end %> <% end %>
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580" > <td colspan="2" width="580" >
<p class="font_description"> <p class="font_description">
<%= textilizable e.event_description %> <%= textilizable act.description %>
</p></td> </p></td>
</tr> </tr>
<% when 'Journal' %>
<tr>
<% if e.user_id == User.current%>
<td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
<% else %>
<td colspan="2" valign="top"><strong> <%= link_to(h(e.user_id), user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
<% end %>
</tr>
<tr>
<td colspan="2" width="580" >
<p class="font_description">
<%= textilizable act.notes %>
</p></td>
</tr>
<% when 'Changeset' %>
<tr>
<% if e.user_id == User.current%>
<td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></td>
<% else %>
<td colspan="2" valign="top"><strong> <%= link_to(h(e.user_id), user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></td>
<% end %>
</tr>
<tr>
<td colspan="2" width="580" >
<p class="font_description">
<%= textilizable act.long_comments %>
</p></td>
</tr>
<% when 'Message' %>
<tr>
<% if e.user_id == User.current%>
<td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %></td>
<% else %>
<td colspan="2" valign="top"><strong> <%= link_to(h(e.user_id), user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %></td>
<% end %>
</tr>
<tr>
<td colspan="2" width="580" >
<p class="font_description">
<%= textilizable act.content %>
</p></td>
</tr>
<% when 'News' %>
<tr>
<% if e.user_id == User.current%>
<td colspan="2" valign="top"><strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %></td>
<% else %>
<td colspan="2" valign="top"><strong> <%= link_to(h(e.user_id), user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %></td>
<% end %>
</tr>
<tr>
<td colspan="2" width="580" >
<p class="font_description">
<%= textilizable act.description %>
</p></td>
</tr>
<% end %>
<tr> <tr>
<td align="left"><a class="font_lighter"></a></td> <td align="left"><a class="font_lighter"></a></td>
<td width="200" align="right" class="a"><span class="font_lighter"><%= format_time(e.event_datetime) %></span></td> <td width="200" align="right" class="a"><span class="font_lighter"><%= format_time(e.act.created_on) %></span></td>
</tr> </tr>
<!-- <tr><div class="line_under"></div></tr> --> <!-- <tr><div class="line_under"></div></tr> -->
</table></td> </table></td>

View File

@ -3,7 +3,12 @@
<%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %> <%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %>
</div> </div>
<div id="message"> <div id="message">
<%= render :partial => 'words/message', :locals => {:jour => @jour, :state => @state, :user => @user} %> <%= render :partial => 'words/message', :locals => {:jour => @jour, :state => @state, :user => @user, :feedback_pages => @feedback_pages} %>
</div>
<div class="pagination" style="float:left;">
<ul>
<%= pagination_links_full @feedback_pages %>
<ul>
</div> </div>
</div> </div>

View File

@ -41,3 +41,9 @@
</table> </table>
<% end %> <% end %>
<!-- fq -->
<div class="pagination" style="float:left;">
<ul>
<%= pagination_links_full @bid_pages %>
<ul>
</div>

View File

@ -1,18 +1,18 @@
<!-- fq --> <!-- fq -->
<% if jour.size >0 %> <% if jour.size >0 %>
<% remove_allowed = (User.current.id == jour.first.user_id) %> <% remove_allowed = (User.current.id == jour.first.user_id) %>
<% journals = jour.reverse%>
<% for journal in journals%> <% for journal in jour%>
<table width="660px" border="0" align="center"> <table width="660px" border="0" align="center">
<tr> <tr>
<td colspan="2" valign="top" width="50" ><img src="/images/new/news.png" width="40" height="40"/></td> <td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %></td>
<td><table width="580px" border="0"> <td><table width="580px" border="0">
<tr> <tr>
<td colspan="2" valign="top"><strong> <%=link_to journal.user, user_path(journal.user)%></strong> <td colspan="2" valign="top"><strong> <%=link_to journal.user, user_path(journal.user)%></strong>
<% if @user == User.current%> <% if @user == User.current%>
<a class="font_lighter"><%= l(:label_leave_me_message) %></a> <span class="font_lighter"><%= l(:label_leave_me_message) %></span>
<% else %> <% else %>
<a class="font_lighter"><%= l(:label_leave_others_message) %></a> <span class="font_lighter"><%= l(:label_leave_others_message) %></span>
<% end %> <% end %>
</td> </td>
</tr> </tr>
@ -20,7 +20,7 @@
<td colspan="2" width="580px" ><p class="font_description"><%= textilizable journal.notes%></p></td> <td colspan="2" width="580px" ><p class="font_description"><%= textilizable journal.notes%></p></td>
</tr> </tr>
<tr> <tr>
<td align="left"><a class="font_lighter"> <%= format_time journal.created_on %></a></td> <td align="left"><span class="font_lighter"> <%= format_time journal.created_on %></span></td>
<td width="200" align="right" class="a"><%= link_to(image_tag('comment.png'), {:controller => 'words', :action => 'new', :id => user, :journal_id => journal}, :remote => true, <td width="200" align="right" class="a"><%= link_to(image_tag('comment.png'), {:controller => 'words', :action => 'new', :id => user, :journal_id => journal}, :remote => true,
:method => 'post', :title => l(:button_quote))%><%= link_to(image_tag('delete.png'), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user}, :method => 'post', :title => l(:button_quote))%><%= link_to(image_tag('delete.png'), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => user},
:remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete)) if remove_allowed || journal.jour_id == User.current.id %></td> :remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete)) if remove_allowed || journal.jour_id == User.current.id %></td>
@ -32,3 +32,5 @@
<% end %> <% end %>

View File

@ -44,7 +44,7 @@
} }
} }
function showInfo(id) { function showInfo(id, content) {
var text = $('#' + id); var text = $('#' + id);
if (text.val() == '') { if (text.val() == '') {
$('#' + id).val(content); $('#' + id).val(content);
@ -67,7 +67,7 @@
<table border="0" width="525px" align="center"> <table border="0" width="525px" align="center">
<tr> <tr>
<td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%> <td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('bid_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td> <%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('new_form_user_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
</tr> </tr>
</table> </table>
<% else %> <% else %>

View File

@ -1,3 +1,3 @@
$('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user})) %>'); $('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>');
$('#new_form_user_message').val(""); $('#new_form_user_message').val("");
$('#new_form_reference_user_id').val(""); $('#new_form_reference_user_id').val("");

View File

@ -1,2 +1,2 @@
$('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user})) %>'); $('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>');
$('#new_form_reference_user_id').val(""); $('#new_form_reference_user_id').val("");

View File

@ -1,6 +1,6 @@
class CreateActivities < ActiveRecord::Migration class CreateActivities < ActiveRecord::Migration
def change def change
create_table :activities, :id => false do |t| create_table :activities do |t|
t.integer :act_id, :null => false t.integer :act_id, :null => false
t.string :act_type, :null => false t.string :act_type, :null => false
t.integer :user_id, :null => false t.integer :user_id, :null => false

View File

@ -1,4 +1,11 @@
class ChangeTimetempInJournalForMessageTable < ActiveRecord::Migration class ChangeTimetempInJournalForMessageTable < ActiveRecord::Migration
rename_column :journals_for_messages, :created_at, :created_on def self.up
rename_column :journals_for_messages, :updated_at, :updated_on rename_column :journals_for_messages, :created_at, :created_on
rename_column :journals_for_messages, :updated_at, :updated_on
end
def self.down
rename_column :journals_for_messages, :created_on, :created_at
rename_column :journals_for_messages, :updated_on, :updated_at
end
end end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130811001727) do ActiveRecord::Schema.define(:version => 20130811122119) do
create_table "a_user_watchers", :force => true do |t| create_table "a_user_watchers", :force => true do |t|
t.string "name" t.string "name"
@ -21,7 +21,7 @@ ActiveRecord::Schema.define(:version => 20130811001727) do
t.integer "member_id" t.integer "member_id"
end end
create_table "activities", :id => false, :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
t.string "act_type", :null => false t.string "act_type", :null => false
t.integer "user_id", :null => false t.integer "user_id", :null => false
@ -463,7 +463,6 @@ ActiveRecord::Schema.define(:version => 20130811001727) do
end end
create_table "project_infos", :force => true do |t| create_table "project_infos", :force => true do |t|
t.string "name"
t.integer "project_id" t.integer "project_id"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 KiB