diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0a1775c5c..5c91a1d33 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -74,8 +74,18 @@ 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 { render :layout => 'base_users' @@ -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) - + @offset ||= @activity_pages.offset + @activity = activity.offset(@offset).limit(@limit) #Modified by nie unless User.current.admin? diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index e978b1d36..1f05b0e81 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -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| diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 1f32990c1..47b7d727a 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -60,5 +60,7 @@ module UsersHelper def get_users_by_tag(tag_name) User.tagged_with(tag_name).by_join_date end + + # added by fq end diff --git a/app/models/activity.rb b/app/models/activity.rb index 08cf22264..635171653 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -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 diff --git a/app/models/bid.rb b/app/models/bid.rb index 1001ceb8c..0602e0ae3 100644 --- a/app/models/bid.rb +++ b/app/models/bid.rb @@ -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 diff --git a/app/models/changeset.rb b/app/models/changeset.rb index d3fa8ab2b..a7fb54b1a 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -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", @@ -53,7 +57,11 @@ 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 @@ -209,6 +217,10 @@ class Changeset < ActiveRecord::Base end 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) diff --git a/app/models/journal.rb b/app/models/journal.rb index b9d6bd78b..2a1daf1ac 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -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}" }, @@ -42,6 +43,10 @@ class Journal < ActiveRecord::Base " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"} 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 diff --git a/app/models/message.rb b/app/models/message.rb index 767223748..28b03837f 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -22,6 +22,10 @@ class Message < ActiveRecord::Base acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC" 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}, @@ -45,6 +49,10 @@ class Message < ActiveRecord::Base after_create :add_author_as_watcher, :reset_counters! 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 diff --git a/app/models/news.rb b/app/models/news.rb index c8a4112cc..b08f8598c 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -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,7 +36,10 @@ 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 diff --git a/app/models/user.rb b/app/models/user.rb index 5ebfde711..78b757d43 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 ##### diff --git a/app/models/watchers_of_projects.rb b/app/models/watchers_of_projects.rb deleted file mode 100644 index 4a767aaee..000000000 --- a/app/models/watchers_of_projects.rb +++ /dev/null @@ -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 diff --git a/app/models/watchers_of_user.rb b/app/models/watchers_of_user.rb deleted file mode 100644 index 527b092c8..000000000 --- a/app/models/watchers_of_user.rb +++ /dev/null @@ -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 diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 9d2780716..3d2f5c142 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,29 +1,88 @@ -<% unless @events_by_day.empty? %> +<% unless @activity.empty? %>
- <% @events_by_day_.each do |e| %> + <% @activity.each do |e| %> + <% act = e.act %> - + diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index 34faaca92..13d4312cb 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -3,7 +3,12 @@ <%= render :partial => 'words/new', :locals => {:user => @user, :sta => @state} %>
- <%= 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} %> +
+ \ No newline at end of file diff --git a/app/views/users/watch_bids.html.erb b/app/views/users/watch_bids.html.erb index d8a048752..5883dee2c 100644 --- a/app/views/users/watch_bids.html.erb +++ b/app/views/users/watch_bids.html.erb @@ -40,4 +40,10 @@
<%= link_to image_tag(url_to_avatar(e.event_author), :class => "avatar"), user_path(e.event_author), :class => "avatar" %><%= link_to image_tag(url_to_avatar(e.user), :class => "avatar"), user_path(e.user_id), :class => "avatar" %> + <% case e.act_type %> + <% when 'Bid' %> - <% if e.event_author == User.current%> - - + <% if e.user_id == User.current%> + <% else %> - + <% end %> + <% when 'Journal' %> + + <% if e.user_id == User.current%> + + <% else %> + + <% end %> + + + + + <% when 'Changeset' %> + + <% if e.user_id == User.current%> + + <% else %> + + <% end %> + + + + + <% when 'Message' %> + + <% if e.user_id == User.current%> + + <% else %> + + <% end %> + + + + + <% when 'News' %> + + <% if e.user_id == User.current%> + + <% else %> + + <% end %> + + + + + <% end %> - +
<%= link_to("#{l(:label_i)}", user_path(e.event_author)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title(e.event_title), e.event_url %> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_bid_plural)}##{act.id}:#{act.name}"), respond_path(e.act_id) %> <%= link_to(h(e.event_author), user_path(e.event_author)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title(e.event_title), e.event_url %> <%= link_to(h(e.user_id), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_bid_plural)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>

- <%= textilizable e.event_description %> + <%= textilizable act.description %>

<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= 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}"} %> <%= link_to(h(e.user_id), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= 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}"} %>
+

+ <%= textilizable act.notes %> +

<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %> <%= link_to(h(e.user_id), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %>
+

+ <%= textilizable act.long_comments %> +

<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= 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}"}) %> <%= link_to(h(e.user_id), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= 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}"}) %>
+

+ <%= textilizable act.content %> +

<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> <%= link_to(h(e.user_id), user_path(e.user_id)) %><%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
+

+ <%= textilizable act.description %> +

<%= format_time(e.event_datetime) %><%= format_time(e.act.created_on) %>
-<% end %> \ No newline at end of file +<% end %> + + \ No newline at end of file diff --git a/app/views/words/_message.html.erb b/app/views/words/_message.html.erb index f613434b0..10662edc9 100644 --- a/app/views/words/_message.html.erb +++ b/app/views/words/_message.html.erb @@ -1,18 +1,18 @@ <% if jour.size >0 %> <% remove_allowed = (User.current.id == jour.first.user_id) %> -<% journals = jour.reverse%> -<% for journal in journals%> + +<% for journal in jour%> - +
<%= link_to image_tag(url_to_avatar(journal.user), :class => "avatar"), user_path(journal.user), :class => "avatar" %> @@ -20,7 +20,7 @@ - + @@ -32,3 +32,5 @@ <% end %> + + diff --git a/app/views/words/_new.html.erb b/app/views/words/_new.html.erb index 98700a884..8186fa6a8 100644 --- a/app/views/words/_new.html.erb +++ b/app/views/words/_new.html.erb @@ -44,7 +44,7 @@ } } - function showInfo(id) { + function showInfo(id, content) { var text = $('#' + id); if (text.val() == '') { $('#' + id).val(content); @@ -67,7 +67,7 @@
<%=link_to journal.user, user_path(journal.user)%> <% if @user == User.current%> - <%= l(:label_leave_me_message) %> + <%= l(:label_leave_me_message) %> <% else %> - <%= l(:label_leave_others_message) %> + <%= l(:label_leave_others_message) %> <% end %>

<%= textilizable journal.notes%>

<%= format_time journal.created_on %> <%= format_time journal.created_on %> <%= 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 %>
+ <%= 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'" %>
<%= 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'" %>
<% else %> diff --git a/app/views/words/create.js.erb b/app/views/words/create.js.erb index 823587b30..7bb849b5a 100644 --- a/app/views/words/create.js.erb +++ b/app/views/words/create.js.erb @@ -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(""); \ No newline at end of file diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index f2030b783..53dc614b2 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -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(""); \ No newline at end of file diff --git a/db/migrate/20130809122945_create_activities.rb b/db/migrate/20130809122945_create_activities.rb index 4a14da225..49d121291 100644 --- a/db/migrate/20130809122945_create_activities.rb +++ b/db/migrate/20130809122945_create_activities.rb @@ -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 diff --git a/db/migrate/20130811001727_change_timetemp_in_journal_for_message_table.rb b/db/migrate/20130811001727_change_timetemp_in_journal_for_message_table.rb index 97125200f..376508b75 100644 --- a/db/migrate/20130811001727_change_timetemp_in_journal_for_message_table.rb +++ b/db/migrate/20130811001727_change_timetemp_in_journal_for_message_table.rb @@ -1,4 +1,11 @@ class ChangeTimetempInJournalForMessageTable < ActiveRecord::Migration - rename_column :journals_for_messages, :created_at, :created_on - rename_column :journals_for_messages, :updated_at, :updated_on + 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 diff --git a/db/schema.rb b/db/schema.rb index 3b0bcb247..9d1b24e05 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 diff --git a/public/images/avatars/User/4869 b/public/images/avatars/User/4869 new file mode 100644 index 000000000..030ab8a68 Binary files /dev/null and b/public/images/avatars/User/4869 differ