From 4676eed9a3ba318726872be20da50336649d6784 Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Thu, 8 Aug 2013 10:04:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E7=94=A8=E6=88=B7=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 36 +++++++++------- app/controllers/users_controller.rb | 13 +++++- app/views/bids/_new_bid.html.erb | 41 +++++++++++++++---- app/views/bids/index.html.erb | 13 +++--- app/views/layouts/base_bids.html.erb | 10 +---- app/views/users/show.html.erb | 13 +++--- .../stylesheets/application.css | 21 +++++----- 7 files changed, 94 insertions(+), 53 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index aceda304d..f3786affc 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 c3ab04d50..a93698de8 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 8b98764e6..d7b9bc53f 100644 --- a/app/views/bids/_new_bid.html.erb +++ b/app/views/bids/_new_bid.html.erb @@ -1,4 +1,27 @@ + + +