为用户活动添加分页功能
This commit is contained in:
parent
dc12301e4f
commit
4676eed9a3
|
@ -20,20 +20,20 @@ class BidsController < ApplicationController
|
||||||
limit = @bid_count % @limit
|
limit = @bid_count % @limit
|
||||||
@bids = @bids.offset(@offset).limit(limit).all.reverse
|
@bids = @bids.offset(@offset).limit(limit).all.reverse
|
||||||
end
|
end
|
||||||
# @limit = api_offset_and_limit({:limit => 5})
|
# @limit = api_offset_and_limit({:limit => 5})
|
||||||
# @bids = Bid.visible
|
# @bids = Bid.visible
|
||||||
# @bids = @bids.like(params[:name]) if params[:name].present?
|
# @bids = @bids.like(params[:name]) if params[:name].present?
|
||||||
# @bid_count = @bids.count
|
# @bid_count = @bids.count
|
||||||
# @bid_pages = Paginator.new @bid_count, @limit, params['page']
|
# @bid_pages = Paginator.new @bid_count, @limit, params['page']
|
||||||
# @offset ||= @bid_pages.reverse_offset
|
# @offset ||= @bid_pages.reverse_offset
|
||||||
# #@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
# #@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||||
# unless @offset == 0
|
# unless @offset == 0
|
||||||
# @bids = @bid_count.offset(@offset).limit(@limit).all.reverse
|
# @bids = @bid_count.offset(@offset).limit(@limit).all.reverse
|
||||||
# else
|
# else
|
||||||
# limit = @bid_count%@limit
|
# limit = @bid_count%@limit
|
||||||
# @bids = @bid_count.offset(@offset).limit(limit).all.reverse
|
# @bids = @bid_count.offset(@offset).limit(limit).all.reverse
|
||||||
# end
|
# end
|
||||||
# #end
|
# #end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
@ -71,6 +71,7 @@ class BidsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###添加应标项目
|
||||||
def add
|
def add
|
||||||
project = Project.where('name = ?', params[:bid]).first
|
project = Project.where('name = ?', params[:bid]).first
|
||||||
bid_message = params[:bid_for_save][:bid_message]
|
bid_message = params[:bid_for_save][:bid_message]
|
||||||
|
@ -83,7 +84,9 @@ class BidsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
## 新建留言
|
||||||
def create
|
def create
|
||||||
|
|
||||||
if params[:bid_message].size>0
|
if params[:bid_message].size>0
|
||||||
message = params[:bid_message][:message]
|
message = params[:bid_message][:message]
|
||||||
refer_user_id = params[:bid_message][:reference_user_id].to_i
|
refer_user_id = params[:bid_message][:reference_user_id].to_i
|
||||||
|
@ -100,12 +103,13 @@ class BidsController < ApplicationController
|
||||||
@bid.set_commit(@jour.count)
|
@bid.set_commit(@jour.count)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
|
|
||||||
format.js
|
format.js
|
||||||
#format.api { render_api_ok }
|
#format.api { render_api_ok }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##删除留言
|
||||||
def destroy
|
def destroy
|
||||||
JournalsForMessage.delete_message(params[:object_id])
|
JournalsForMessage.delete_message(params[:object_id])
|
||||||
@jour = @bid.journals_for_messages
|
@jour = @bid.journals_for_messages
|
||||||
|
@ -125,6 +129,7 @@ class BidsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##引用
|
||||||
def new
|
def new
|
||||||
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
|
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
|
||||||
if @jour
|
if @jour
|
||||||
|
@ -143,6 +148,7 @@ class BidsController < ApplicationController
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##新建需求
|
||||||
def new_bid
|
def new_bid
|
||||||
if params[:bid_title]
|
if params[:bid_title]
|
||||||
bid = Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description])
|
bid = Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description])
|
||||||
|
|
|
@ -178,8 +178,19 @@ class UsersController < ApplicationController
|
||||||
activity.scope_select {|t| !has["show_#{t}"].nil?}
|
activity.scope_select {|t| !has["show_#{t}"].nil?}
|
||||||
events = activity.events(nil, nil, :limit => 10)
|
events = activity.events(nil, nil, :limit => 10)
|
||||||
end
|
end
|
||||||
|
@events = []
|
||||||
@events_by_day = events.group_by(&:event_date)
|
@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
|
#Modified by nie
|
||||||
unless User.current.admin?
|
unless User.current.admin?
|
||||||
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
|
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
|
||||||
|
|
|
@ -1,4 +1,27 @@
|
||||||
<!-- fq -->
|
<!-- fq -->
|
||||||
|
|
||||||
|
<style>
|
||||||
|
input[type="submit"].bid_btn {
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 80px;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 18px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
background: url("../images/button/bg105.jpg") no-repeat scroll left top transparent;
|
||||||
|
padding: 0px 0px 4px 0px;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid rgb(148, 148, 148);
|
||||||
|
box-shadow: none;
|
||||||
|
text-shadow: none;
|
||||||
|
margin-top: -10px;
|
||||||
|
margin-right: -5px;
|
||||||
|
}
|
||||||
|
textarea:focus {
|
||||||
|
border: #d5dee9 1px solid;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
function clearInfo(id, content) {
|
function clearInfo(id, content) {
|
||||||
var text = $('#' + id);
|
var text = $('#' + id);
|
||||||
|
@ -21,7 +44,7 @@
|
||||||
:id => 'new-bid-form'}) do %>
|
:id => 'new-bid-form'}) do %>
|
||||||
<%= error_messages_for 'bid' %>
|
<%= error_messages_for 'bid' %>
|
||||||
<table border="0" width="600px" style="border-left: 1px solid #acaeb1; border-right: 1px solid #acaeb1;
|
<table border="0" width="600px" style="border-left: 1px solid #acaeb1; border-right: 1px solid #acaeb1;
|
||||||
border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 60px; margin-left: 30px;">
|
border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 30px; margin-left: 30px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= text_field_tag 'bid_title', "为你的需求起个名字~~", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_title', '为你的需求起个名字~~')", :onblur => "showInfo('bid_title', '为你的需求起个名字~~')"%></td>
|
<td><%= text_field_tag 'bid_title', "为你的需求起个名字~~", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_title', '为你的需求起个名字~~')", :onblur => "showInfo('bid_title', '为你的需求起个名字~~')"%></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -29,25 +52,29 @@ border-top: 1px solid #acaeb1; border-bottom: 1px solid #acaeb1; margin-top: 60p
|
||||||
<td><div class="tableline"></div></td>
|
<td><div class="tableline"></div></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= text_area_tag 'bid_description', "说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价", :class => 'noline', :required => true, :style => "resize: none;", :rows => 8,
|
<td><%= text_area_tag 'bid_description', "说出你的需求>找到威客来帮你>支付担保金让威客开始工作>验收付款并评价", :class => 'noline', :required => true, :style => "resize: none;", :rows => 6,
|
||||||
:onfocus => "clearInfo('bid_description', '说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价')", :onblur => "showInfo('bid_description', '说出你的需求>找到威客来帮你>支付担保金让威客开始工作 >验收付款并评价')" %></td>
|
:onfocus => "clearInfo('bid_description', '说出你的需求>找到威客来帮你>支付担保金让威客开始工作>验收付款并评价')", :onblur => "showInfo('bid_description', '说出你的需求>找到威客来帮你>支付担保金让威客开始工作>验收付款并评价')" %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><div class="tableline"></div></td>
|
<td><div class="tableline"></div></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= text_field_tag 'bid_budget', "支付担保金额", :class => 'noline', :required => true %></td>
|
<td><%= text_field_tag 'bid_budget', "支付担保金额", :class => 'noline', :required => true,
|
||||||
|
:onfocus => "clearInfo('bid_budget', '支付担保金额')", :onblur => "showInfo('bid_budget', '支付担保金额')" %>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><div class="tableline"></div></td>
|
<td><div class="tableline"></div></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= text_field_tag 'bid_deadline', "投资时限 yyyy-mm-dd", :class => 'noline', :required => true, :onfocus => "clearInfo('bid_deadline')"%><%= calendar_for('bid_deadline')%></td>
|
<td><%= text_field_tag 'bid_deadline', "投资时限 yyyy-mm-dd", :class => 'noline', :required => true,
|
||||||
|
:onfocus => "clearInfo('bid_deadline', '投资时限 yyyy-mm-dd')", :onblur => "showInfo('bid_deadline', '投资时限 yyyy-mm-dd')"%>
|
||||||
|
<%= calendar_for('bid_deadline')%></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table id="bidding_table" border="0" width="600" style="margin-top: 20px; margin-left: 30px;">
|
<table id="bidding_table" border="0" width="600" style="margin-top: 10px; margin-left: 30px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right"><%= submit_tag l(:button_new_bid) %></td>
|
<td align="right"> <%= submit_tag l(:button_new_bid), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -30px'"%> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<%end%>
|
<%end%>
|
|
@ -1,9 +1,5 @@
|
||||||
<!-- fq -->
|
<!-- fq -->
|
||||||
<% if User.current.logged? %>
|
|
||||||
<div id="put-bid-form" style="display: none">
|
|
||||||
<%= render :partial => 'new_bid' %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<%= form_tag(bids_path, :method => :get) do %>
|
<%= form_tag(bids_path, :method => :get) do %>
|
||||||
<div class="project-search-block">
|
<div class="project-search-block">
|
||||||
<span><%=l(:label_bid_plural)%></span>
|
<span><%=l(:label_bid_plural)%></span>
|
||||||
|
@ -13,6 +9,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
|
<% if User.current.logged? %>
|
||||||
|
<div id="put-bid-form" style="display: none">
|
||||||
|
<%= render :partial => 'new_bid' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div id="bid-show">
|
<div id="bid-show">
|
||||||
<%= render :partial => 'bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
|
<%= render :partial => 'bid_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -107,15 +107,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--扩充-->
|
<!--扩充-->
|
||||||
<div class="user_other_model">
|
|
||||||
<div class="font_title_left">
|
|
||||||
<strong>访客统计</strong>
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
<tr>
|
|
||||||
总访问量:1232
|
|
||||||
</tr>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<% unless @events_by_day.empty? %>
|
<% unless @events_by_day.empty? %>
|
||||||
<div id="activity">
|
<div id="activity">
|
||||||
<% @events_by_day.keys.sort.reverse.each do |day| %>
|
<% @events_by_day_.each do |e| %>
|
||||||
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
|
|
||||||
<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 -->
|
||||||
|
@ -24,15 +23,17 @@
|
||||||
</tr>
|
</tr>
|
||||||
<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_activity_day(day) %></span></td>
|
<td width="200" align="right" class="a"><span class="font_lighter"><%= format_time(e.event_datetime) %></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- <tr><div class="line_under"></div></tr> -->
|
<!-- <tr><div class="line_under"></div></tr> -->
|
||||||
</table></td>
|
</table></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<div class="pagination" style="float:left;">
|
||||||
<%= l(:label_user_activities) %>
|
<ul>
|
||||||
|
<%= pagination_links_full @activity_pages %>
|
||||||
|
<ul>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
|
@ -1676,13 +1676,12 @@ a.bid_user {
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
}
|
}
|
||||||
input[type='text'].noline {
|
input[type='text'].noline {
|
||||||
border-style: none;
|
border: #d5dee9 1px solid;
|
||||||
border-color: white;
|
font-size: 12px;
|
||||||
border-width: medium;
|
|
||||||
font-size: 16px;
|
|
||||||
color: #ACAEB1;
|
color: #ACAEB1;
|
||||||
padding: 10px 0px;
|
padding: 10px 5px;
|
||||||
width: 100%;
|
width: 98%;
|
||||||
|
cursor: text;
|
||||||
}
|
}
|
||||||
.noline {
|
.noline {
|
||||||
/*border-style: none;
|
/*border-style: none;
|
||||||
|
@ -1690,13 +1689,15 @@ input[type='text'].noline {
|
||||||
border: #d5dee9 1px solid;
|
border: #d5dee9 1px solid;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #ACAEB1;
|
color: #ACAEB1;
|
||||||
padding: 10px 0px;
|
padding: 10px 5px;
|
||||||
width: 100%;
|
width: 98%;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
}
|
}
|
||||||
.grayline{
|
.grayline{
|
||||||
border-color: #ACAEB1;
|
border: #d5dee9 1px solid;
|
||||||
border-width: 1px;
|
font-size: 12px;
|
||||||
|
color: #ACAEB1;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
div.tableline{
|
div.tableline{
|
||||||
height: 1px;
|
height: 1px;
|
||||||
|
|
Loading…
Reference in New Issue