diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index aceda304..f3786aff 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -20,20 +20,20 @@ class BidsController < ApplicationController
limit = @bid_count % @limit
@bids = @bids.offset(@offset).limit(limit).all.reverse
end
- # @limit = api_offset_and_limit({:limit => 5})
- # @bids = Bid.visible
- # @bids = @bids.like(params[:name]) if params[:name].present?
- # @bid_count = @bids.count
- # @bid_pages = Paginator.new @bid_count, @limit, params['page']
- # @offset ||= @bid_pages.reverse_offset
- # #@bids = @bids.offset(@offset).limit(@limit).all.reverse
- # unless @offset == 0
- # @bids = @bid_count.offset(@offset).limit(@limit).all.reverse
- # else
- # limit = @bid_count%@limit
- # @bids = @bid_count.offset(@offset).limit(limit).all.reverse
- # end
- # #end
+ # @limit = api_offset_and_limit({:limit => 5})
+ # @bids = Bid.visible
+ # @bids = @bids.like(params[:name]) if params[:name].present?
+ # @bid_count = @bids.count
+ # @bid_pages = Paginator.new @bid_count, @limit, params['page']
+ # @offset ||= @bid_pages.reverse_offset
+ # #@bids = @bids.offset(@offset).limit(@limit).all.reverse
+ # unless @offset == 0
+ # @bids = @bid_count.offset(@offset).limit(@limit).all.reverse
+ # else
+ # limit = @bid_count%@limit
+ # @bids = @bid_count.offset(@offset).limit(limit).all.reverse
+ # end
+ # #end
end
def show
@@ -71,6 +71,7 @@ class BidsController < ApplicationController
end
end
+ ###添加应标项目
def add
project = Project.where('name = ?', params[:bid]).first
bid_message = params[:bid_for_save][:bid_message]
@@ -83,7 +84,9 @@ class BidsController < ApplicationController
end
end
+ ## 新建留言
def create
+
if params[:bid_message].size>0
message = params[:bid_message][:message]
refer_user_id = params[:bid_message][:reference_user_id].to_i
@@ -100,12 +103,13 @@ class BidsController < ApplicationController
@bid.set_commit(@jour.count)
respond_to do |format|
- # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
format.js
#format.api { render_api_ok }
end
+
end
+ ##删除留言
def destroy
JournalsForMessage.delete_message(params[:object_id])
@jour = @bid.journals_for_messages
@@ -125,6 +129,7 @@ class BidsController < ApplicationController
end
end
+ ##引用
def new
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
if @jour
@@ -143,6 +148,7 @@ class BidsController < ApplicationController
render_404
end
+ ##新建需求
def new_bid
if params[:bid_title]
bid = Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description])
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index c3ab04d5..a93698de 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -178,8 +178,19 @@ class UsersController < ApplicationController
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)
+
+
#Modified by nie
unless User.current.admin?
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
diff --git a/app/views/bids/_new_bid.html.erb b/app/views/bids/_new_bid.html.erb
index 8b98764e..d7b9bc53 100644
--- a/app/views/bids/_new_bid.html.erb
+++ b/app/views/bids/_new_bid.html.erb
@@ -1,4 +1,27 @@
+
+
+