修改用户活动,用户主页的其他部分添加分页
This commit is contained in:
parent
4b998de820
commit
69e3dcee6c
|
@ -74,7 +74,17 @@ class UsersController < ApplicationController
|
|||
|
||||
##added by fq
|
||||
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|
|
||||
format.html {
|
||||
|
@ -108,12 +118,17 @@ class UsersController < ApplicationController
|
|||
end
|
||||
# end
|
||||
|
||||
# modified by fq
|
||||
def user_newfeedback
|
||||
@jour = @user.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@jours = @user.journals_for_messages.reverse
|
||||
@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
|
||||
|
||||
end
|
||||
# end
|
||||
|
||||
def user_comments
|
||||
|
||||
|
@ -157,46 +172,54 @@ class UsersController < ApplicationController
|
|||
|
||||
### modified by fq
|
||||
def show
|
||||
has = {
|
||||
"show_issues" => true,
|
||||
"show_changesets" => true,
|
||||
"show_news" => true,
|
||||
"show_messages" => true,
|
||||
"show_bids" => true,
|
||||
}
|
||||
# has = {
|
||||
# "show_issues" => true,
|
||||
# "show_changesets" => true,
|
||||
# "show_news" => true,
|
||||
# "show_messages" => true,
|
||||
# "show_bids" => true,
|
||||
# }
|
||||
#####fq
|
||||
|
||||
JournalsForMessage.reference_message(@user.id)
|
||||
# JournalsForMessage.reference_message(@user.id)
|
||||
# show projects based on current user visibility
|
||||
@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
|
||||
# @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
|
||||
# @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})
|
||||
@activity_count = @events.size
|
||||
@activity_count = activity.count
|
||||
@activity_pages = Paginator.new @activity_count, @limit, params['page']
|
||||
@offset ||= @activity_pages.offset
|
||||
@events_by_day_ = @events.slice(@offset,@limit)
|
||||
|
||||
@activity = activity.offset(@offset).limit(@limit)
|
||||
|
||||
#Modified by nie
|
||||
unless User.current.admin?
|
||||
|
|
|
@ -17,8 +17,12 @@ class WordsController < ApplicationController
|
|||
# @message_count = a_message.count
|
||||
end
|
||||
end
|
||||
@jour = @user.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@jours = @user.journals_for_messages.reverse
|
||||
@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|
|
||||
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
|
||||
|
@ -29,8 +33,12 @@ class WordsController < ApplicationController
|
|||
|
||||
def destroy
|
||||
JournalsForMessage.delete_message(params[:object_id])
|
||||
@jour = @user.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@jours = @user.journals_for_messages.reverse
|
||||
@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
|
||||
# @message = a_message[-5, 5]
|
||||
# else
|
||||
|
@ -64,8 +72,12 @@ class WordsController < ApplicationController
|
|||
end
|
||||
|
||||
def more
|
||||
@jour = @user.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@jours = @user.journals_for_messages.reverse
|
||||
@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
|
||||
|
||||
respond_to do |format|
|
||||
|
@ -76,8 +88,12 @@ class WordsController < ApplicationController
|
|||
end
|
||||
|
||||
def back
|
||||
@jour = @user.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@jours = @user.journals_for_messages.reverse
|
||||
@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
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
@ -61,4 +61,6 @@ module UsersHelper
|
|||
User.tagged_with(tag_name).by_join_date
|
||||
end
|
||||
|
||||
# added by fq
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
class Activity < ActiveRecord::Base
|
||||
attr_accessible :act_id, :act_type, :user_id
|
||||
belongs_to :act, :polymorphic => true
|
||||
belongs_to :user
|
||||
|
||||
validates_presence_of :act_id, :act_type, :user_id
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class Bid < ActiveRecord::Base
|
|||
has_many :biding_projects, :dependent => :destroy
|
||||
has_many :projects, :through => :biding_projects
|
||||
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
|
||||
DESCRIPTION_LENGTH_LIMIT = 250
|
||||
|
@ -18,7 +18,7 @@ class Bid < ActiveRecord::Base
|
|||
# validates_format_of :deadline, :with =>
|
||||
validate :validate_user
|
||||
|
||||
# after_save :act_as_activity
|
||||
after_save :act_as_activity
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
nil
|
||||
|
@ -81,7 +81,7 @@ class Bid < ActiveRecord::Base
|
|||
errors.add :author_id, :invalid if author.nil? || !author.active?
|
||||
end
|
||||
|
||||
# def act_as_activity
|
||||
# self.acts << Activity.new(:user_id => self.author_id)
|
||||
# end
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.author_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,6 +19,10 @@ class Changeset < ActiveRecord::Base
|
|||
belongs_to :repository
|
||||
belongs_to :user
|
||||
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 :parents,
|
||||
:class_name => "Changeset",
|
||||
|
@ -54,6 +58,10 @@ class Changeset < ActiveRecord::Base
|
|||
after_create :scan_for_issues
|
||||
before_create :before_create_cs
|
||||
|
||||
# fq
|
||||
after_save :act_as_activity
|
||||
# end
|
||||
|
||||
def revision=(r)
|
||||
write_attribute :revision, (r.nil? ? nil : r.to_s)
|
||||
end
|
||||
|
@ -210,6 +218,10 @@ class Changeset < ActiveRecord::Base
|
|||
|
||||
private
|
||||
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.user_id)
|
||||
end
|
||||
|
||||
def fix_issue(issue)
|
||||
status = IssueStatus.find_by_id(Setting.commit_fix_status_id.to_i)
|
||||
if status.nil?
|
||||
|
|
|
@ -25,7 +25,8 @@ class Journal < ActiveRecord::Base
|
|||
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all
|
||||
# added by fq
|
||||
has_one :journal_reply
|
||||
#end
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# end
|
||||
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}" },
|
||||
|
@ -43,6 +44,10 @@ class Journal < ActiveRecord::Base
|
|||
|
||||
before_create :split_private_notes
|
||||
|
||||
# fq
|
||||
after_save :act_as_activity
|
||||
# end
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
user = args.shift || User.current
|
||||
|
||||
|
@ -140,4 +145,10 @@ class Journal < ActiveRecord::Base
|
|||
end
|
||||
true
|
||||
end
|
||||
|
||||
# fq
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.user_id)
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -23,6 +23,10 @@ class Message < ActiveRecord::Base
|
|||
acts_as_attachable
|
||||
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'],
|
||||
:include => {:board => :project},
|
||||
:project_key => "#{Board.table_name}.project_id",
|
||||
|
@ -46,6 +50,10 @@ class Message < ActiveRecord::Base
|
|||
after_update :update_messages_board
|
||||
after_destroy :reset_counters!
|
||||
|
||||
# fq
|
||||
after_save :act_as_activity
|
||||
# end
|
||||
|
||||
scope :visible, lambda {|*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
|
||||
Watcher.create(:watchable => self.root, :user => author)
|
||||
end
|
||||
|
||||
# fq
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.author_id)
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -20,6 +20,9 @@ class News < ActiveRecord::Base
|
|||
belongs_to :project
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
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_length_of :title, :maximum => 60
|
||||
|
@ -33,6 +36,9 @@ class News < ActiveRecord::Base
|
|||
acts_as_watchable
|
||||
|
||||
after_create :add_author_as_watcher
|
||||
# fq
|
||||
after_save :act_as_activity
|
||||
# end
|
||||
|
||||
scope :visible, lambda {|*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
|
||||
Watcher.create(:watchable => self, :user => author)
|
||||
end
|
||||
## fq
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.author_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -82,6 +82,7 @@ class User < Principal
|
|||
has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :journal_replies
|
||||
has_many :activities
|
||||
#####
|
||||
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -1,29 +1,88 @@
|
|||
<% unless @events_by_day.empty? %>
|
||||
<% unless @activity.empty? %>
|
||||
<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;">
|
||||
<tr>
|
||||
<!-- 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>
|
||||
<table width="580" border="0">
|
||||
<% case e.act_type %>
|
||||
<% when 'Bid' %>
|
||||
<tr>
|
||||
<% if e.event_author == 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>
|
||||
|
||||
<% 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_bid_plural)}##{act.id}:#{act.name}"), respond_path(e.act_id) %></td>
|
||||
<% 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 %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580" >
|
||||
<p class="font_description">
|
||||
<%= textilizable e.event_description %>
|
||||
<%= textilizable act.description %>
|
||||
</p></td>
|
||||
</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>
|
||||
<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><div class="line_under"></div></tr> -->
|
||||
</table></td>
|
||||
|
|
|
@ -3,7 +3,12 @@
|
|||
<%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %>
|
||||
</div>
|
||||
<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>
|
||||
|
|
@ -41,3 +41,9 @@
|
|||
</table>
|
||||
|
||||
<% end %>
|
||||
<!-- fq -->
|
||||
<div class="pagination" style="float:left;">
|
||||
<ul>
|
||||
<%= pagination_links_full @bid_pages %>
|
||||
<ul>
|
||||
</div>
|
|
@ -1,18 +1,18 @@
|
|||
<!-- fq -->
|
||||
<% if jour.size >0 %>
|
||||
<% 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">
|
||||
<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">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong> <%=link_to journal.user, user_path(journal.user)%></strong>
|
||||
<% 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 %>
|
||||
<a class="font_lighter"><%= l(:label_leave_others_message) %></a>
|
||||
<span class="font_lighter"><%= l(:label_leave_others_message) %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<td colspan="2" width="580px" ><p class="font_description"><%= textilizable journal.notes%></p></td>
|
||||
</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,
|
||||
: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>
|
||||
|
@ -32,3 +32,5 @@
|
|||
<% end %>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
function showInfo(id) {
|
||||
function showInfo(id, content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == '') {
|
||||
$('#' + id).val(content);
|
||||
|
@ -67,7 +67,7 @@
|
|||
<table border="0" width="525px" align="center">
|
||||
<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'"%>
|
||||
<%= 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>
|
||||
</table>
|
||||
<% else %>
|
||||
|
|
|
@ -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_reference_user_id').val("");
|
|
@ -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("");
|
|
@ -1,6 +1,6 @@
|
|||
class CreateActivities < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :activities, :id => false do |t|
|
||||
create_table :activities do |t|
|
||||
t.integer :act_id, :null => false
|
||||
t.string :act_type, :null => false
|
||||
t.integer :user_id, :null => false
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
class ChangeTimetempInJournalForMessageTable < ActiveRecord::Migration
|
||||
def self.up
|
||||
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
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# 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|
|
||||
t.string "name"
|
||||
|
@ -21,7 +21,7 @@ ActiveRecord::Schema.define(:version => 20130811001727) do
|
|||
t.integer "member_id"
|
||||
end
|
||||
|
||||
create_table "activities", :id => false, :force => true do |t|
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
t.string "act_type", :null => false
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -463,7 +463,6 @@ ActiveRecord::Schema.define(:version => 20130811001727) do
|
|||
end
|
||||
|
||||
create_table "project_infos", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "project_id"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 760 KiB |
Loading…
Reference in New Issue