完善需求功能,美化需求列表

This commit is contained in:
fanqiang 2013-08-01 20:47:00 +08:00
parent bf1f9b8e19
commit 760a286746
13 changed files with 189 additions and 133 deletions

View File

@ -3,6 +3,7 @@ class BidsController < ApplicationController
before_filter :find_bid, :only => [:show, :show_project, :create, :destroy, :more, :back, :add]
helper :watchers
def index
if params[:bid_title]
Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description])
@ -32,6 +33,13 @@ class BidsController < ApplicationController
end
def show_project
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
@option = []
@membership.each do |membership|
@option << membership.project
end
# a = [1]
# @project = Project.where("id in []", a)
@user = @bid.author
@bidding_project = @bid.biding_projects
respond_to do |format|
@ -43,9 +51,9 @@ class BidsController < ApplicationController
end
def add
project_id = params[:bid_for_save][:project_id]
project = Project.where('name = ?', params[:bid]).first
bid_message = params[:bid_for_save][:bid_message]
BidingProject.cerate_bidding(@bid.id, project_id, bid_message)
BidingProject.cerate_bidding(@bid.id, project.id, bid_message)
@bidding_project = @bid.biding_projects
respond_to do |format|
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
@ -56,7 +64,7 @@ class BidsController < ApplicationController
def create
if params[:user_message].size>0
message = params[:user_message]
message = params[:user_message][:message]
@bid.add_jour(User.current, message)
# if a_message.size > 5
# @message = a_message[-5, 5]

View File

@ -1,6 +1,8 @@
<!-- added by fq -->
<% if journals.size > 5 %>
<table width="660px" border="0" align="center">
<tr>
<td class="font_lighter" style="font-size: 18px;"><%=l(:label_user_response)%>(<%= journals.count%>)</td>
<td><% if journals.size > 5 %>
<% unless state%>
<div class="contextual">
<%= link_to l(:button_more),
@ -16,22 +18,35 @@
:method => 'get' %>
</div>
<% end %>
<% end %>
<h3><%=l(:label_user_response)%>(<%= journals.count%>)</h3>
<% end %><td>
</tr></table>
<% unless state%>
<% if journals.size > 5 %>
<% journals = journals[0, 5] %>
<% end %>
<% end %>
<% for journal in journals %>
<div id="change-<%= journal.id %>">
<div id="note-<%= journal.indice %>">
<h4><%= link_to "##{journal.indice}", {}, :class => "journal-link" %>
<%= avatar(journal.user, :size => "24") %>
<%= l(:label_updated_time_by, :author => journal.user, :age => time_tag(journal.created_at)).html_safe%></h4>
<%= render_notes(bid, journal, :reply_links => true) unless journal.notes.blank? %>
</div>
</div>
<%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %>
<% if journals.size >0 %>
<% remove_allowed = (User.current.id == journals.first.jour_id) %>
<% for journal in journals%>
<table width="660px" border="0" align="center">
<tr>
<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> <a class="font_lighter">对需求进行了反馈</a><%= link_to "##{journal.indice}", {}, :class => "journal-link" %> </td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description"><%= textilizable journal.notes%></p></td>
</tr>
<tr>
<td align="left"><a class="font_lighter"> <%= journal.created_at %></a></td>
<td width="200" align="right" class="a"><%= link_to(image_tag('comment.png'), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal}, :remote => true,
:method => 'post', :title => l(:button_quote))%><%= link_to(image_tag('delete.png'), {:controller => 'bids', :action => 'destroy', :object_id => journal, :bid_id => bid},
:remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete)) if remove_allowed || journal.user_id == User.current.id %></td>
</tr>
</table></td>
</tr>
</table>
<% end %>
<% end %>

View File

@ -1,13 +1,14 @@
<%= form_tag({:controller => 'bids',
<%= form_for('user_message', :remote => true, :method => :post,
:url => {:controller => 'bids',
:action => 'create',
:bid_id => bid,
:sta => sta},
:remote => true,
:method => :post) do %>
<p><%= label_tag 'user_message', l(:label_leave_message) %><%= text_area_tag 'user_message', nil %></p>
<p class="buttons">
<%= submit_tag l(:button_leave_meassge), :name => nil %>
<%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('user_message');", :type => 'button' %>
</p>
:sta => sta}) do |f|%>
<table border="0" width="500px" align="center">
<tr>
<td><%= f.text_area 'message', :rows => 4, :cols => 65, :value => "我要反馈", :required => true, :style => "resize: none;" %></td>
</tr>
<tr><td align="right"><%= submit_tag l(:button_leave_meassge), :name => nil %>
<%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('user_message_message');", :type => 'button' %></td></tr>
</table>
<% end %>

View File

@ -1,21 +1,28 @@
<% @bidding_project.each do |b_project|%>
<li>
<table width="90%"border="1">
<tr>
<td>
<table width="100%" border="1">
<tr>
<td width="10%"><img src="/images/requirements/req.jpg"></td>
<td width="50%">
<table width="100%">
<tr>
<td><%= link_to(b_project.project.name, project_path(b_project.project)) %></td>
</tr>
<tr>
<td><%= b_project.project.description %></td>
</tr>
</table></td>
<td width="40%">
<table width="90%" border="0" align='center'>
<tr>
<td>
<table width="660px" border="0" align='center'>
<tr>
<td width="50px" valign="top" colspan="2" align="middle">
<div style="width: 50px; height: 50px;">
<%= link_to image_tag(url_to_avatar(b_project.project), :class => 'avatar3'), :class => "avatar" %>
</div></td>
<td width="60%">
<table width="100%">
<tr>
<td colspan="2" valign="top"><strong><%= link_to(b_project.project.name, project_path(b_project.project)) %></strong><a class="font_lighter">参与了应标</a></td>
</tr>
<tr></tr>
<tr>
<td><%= b_project.project.description %></td>
</tr>
<tr>
<td><a class="font_lighter"><%= b_project.created_at%></a></td>
</tr>
</table></td>
<td width="30%">
<div class="bid-user-message" style="border-left: 1px solid rgb(225, 225, 225); margin-left: 20px; padding-left: 20px;">
<table width="100%">
<tr>
<td>应标人:<%= link_to(b_project.user.name, user_path(b_project.user)) %></td>
@ -23,13 +30,10 @@
<tr>
<td>应标宣言:<%= b_project.description %></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</li>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<% end %>

View File

@ -1,4 +1,4 @@
$('#bidding_project_list').html('<%= escape_javascript(render(:partial => 'project_list', :locals => {:bidding_project => @bidding_project})) %>');
$("#project_id").val("请选择项目");
$("#project_id").val("请输入应标理由");
$("#bid_message").val("请输入应标理由");
$("#put-bid-form").hide();

View File

@ -1,2 +1,2 @@
$('#history').html('<%= escape_javascript(render(:partial => 'history', :locals => {:bid => @bid, :journals => @jour, :state => true})) %>');
$('#user_message').val("");
$('#history').html('<%= escape_javascript(render(:partial => 'bids/history', :locals => {:bid => @bid, :journals => @jour, :state => true})) %>');
$('#user_message_message').val("");

View File

@ -1,37 +1,44 @@
<div class="contextual">
<%= link_to("新建需求", {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add') %>
<%= link_to("新建需求", {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add', :style => "margin-right: 100px;") %>
</div>
<h3>需求列表</h3>
<table width="200px" border="0" style="padding-left: 90px; margin-bottom: 15px;">
<td class="font_lighter" style="font-size: 18px;">需求列表</td>
</table>
<ul class="hotlist">
<% @bids.each do |bid|%>
<li>
<img width="29" src="/images/requirements/req.jpg">
<strong>悬赏:¥<%= bid.budget%></strong>
<%= link_to bid.name, :controller => 'bids', :action => 'show', :bid_id => bid.id %>
<span class="gray9"><%= bid.author.name%> 发布&nbsp;39投标</span>
</li>
<% end %>
<% @bids.each do |bid|%>
<li>
<img width="29" src="/images/requirements/req.jpg">
<strong>悬赏¥1000</strong>
<%= link_to "宣传展示型网站开发_企业网站中英文", :controller => 'bids', :action => 'show', :bid_id => "2" %>
<span class="gray9">tellmey 发布&nbsp;24投标</span>
</li>
<table width="80%" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(bid.author), :class => 'avatar'), :class => "avatar" %></td>
<td>
<table width="100%" border="0">
<tr>
<td colspan="2" valign="top"><strong><%= link_to(bid.author, user_path(bid.author), :class => 'bid_user') %>:<%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %></strong></td>
</tr>
<tr>
<td width="500">
<table border="0">
<tr>
<td style="color: rgb(255, 0, 0);"><strong>悬赏:¥<%= bid.budget%></strong></td>
<td class="font_lighter">(<%= bid.biding_projects.count%>)应标</td>
<td class="font_lighter">(<%= bid.commit %>)反馈</td>
<td class="font_lighter">(<%= bid.watcher_users.count%>)关注</td>
</tr>
</table></td>
<td width="200" align="right" class="a"><a class="font_lighter"> <%= format_time bid.created_at %></a></td>
</tr>
<tr>
<td>
<div class="bid-description" style="border-left: 1px solid rgb(225, 225, 225); border-bottom: 1px solid rgb(225, 225, 225); padding-left: 20px; padding-bottom: 10px; margin-bottom: 20px;">
<table>
<tr>
<td> <%= bid.description%> </td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<li>
<img width="29" src="/images/requirements/req.jpg">
<strong>悬赏¥1000</strong>
<%= link_to "移动应用终端无线支付停车场开发", :controller => 'bids', :action => 'show', :bid_id => "3" %>
<span class="gray9">奥美特电子 发布&nbsp;2投标</span>
</li>
<li>
<img width="29" src="/images/requirements/req.jpg">
<strong>悬赏¥1500</strong>
<%= link_to "需要一个印刷类的erp系统", :controller => 'bids', :action => 'show', :bid_id => "4" %>
<span class="gray9">海彩印刷有限公司 发布&nbsp;17投标</span>
</li>
</ul>
<% end %>

View File

@ -1,2 +1,2 @@
$('#user_message').val("<%= raw escape_javascript(@content) %>");
$('#user_message_message').val("<%= raw escape_javascript(@content) %>");
showAndScrollTo("user_message", "user_message");

View File

@ -1,11 +1,25 @@
</br></br><h3><%= link_to(@bid.author.name, user_path(@bid.author))%><%= @bid.name %></h3>
<table border="1" width="100%">
<tr>
<td><h4><strong>需求描述</strong></h4></td>
</tr>
<tr><td><%= @bid.description %></td></tr>
<table width="660px" border="0" align="center">
<tr>
<td width="50" valign="top"><%= link_to image_tag(url_to_avatar(@bid.author), :class => "avatar"), user_path(@bid.author), :class => "avatar" %></td>
<td><table width="100%" border="0">
<tr>
<td><h3><%= link_to(@bid.author.name, user_path(@bid.author))%><%= @bid.name %></h3></td>
</tr>
<tr>
<td class="font_lighter">悬赏:<%= @bid.budget %></td>
</tr>
</table></td>
</tr>
</table>
<div class="bid-description" style="border-bottom: 1px solid rgb(225, 225, 225); margin-bottom: 20px; padding-bottom: 20px;">
<table border="0" width="600px" align="center">
<tr>
<td></td>
</tr>
<tr><td style="font-size: 15px; color: rgb(0,0,0);"><%= @bid.description %></td></tr>
</table>
</div>
<!-- added by fq -->
<div id="history">
<%= render :partial => 'history', :locals => { :bid => @bid, :journals => @jour, :state => false} %>

View File

@ -1,32 +1,29 @@
</br>
</br>
<div class='icon icon-add'>
<%= toggle_link "我要应标", 'put-bid-form', {:focus => 'project_id'} %>
<div class="contextual">
<div class='icon icon-add' style="margin-right: 30px;">
<%= toggle_link "我要应标", 'put-bid-form', {:focus => 'project_id'} %>
</div>
</div>
<div id="put-bid-form" style="display: none">
<%= form_for "bid_for_save", :remote=>true, :url => {:controller => 'bids', :action => 'add'},
<%= form_for "bid_for_save", :remote=>true, :url => {:controller => 'bids', :action => 'add'},
:update => "bidding_project_list",
:complete => '$("#put-bid-form").hide();' do |f| %>
<table id="bidding_table" border="1">
<table id="bidding_table" border="0" align='center' width="500">
<tr>
<td><%= f.text_field :project_id, :id => "project_id", :required => true, :size => 55, :value => "请选择项目"%></td>
<td><%= select_tag 'bid', options_for_select(@option), :name => 'bid' %></td>
</tr>
<tr>
<td><%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 3, :cols => 50, :value => "请输入应标理由"%></td>
<td><%= f.text_area :bid_message, :id => "bid_message", :required => true, :rows => 4, :cols => 40, :value => "请输入应标理由", :style => "resize: none;"%></td>
</tr>
<tr>
<td><%= f.submit "add"%><%= link_to_function l(:button_cancel), '$("#put-bid-form").hide();'%></td>
</tr>
</table>
<% end %>
</div>
<h3>应标项目列表</h3>
<ul>
<div id='bidding_project_list'>
<%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project} %>
</div>
</ul>
<table width="200px" border="0" style="padding-left: 15px">
<td class="font_lighter" style="font-size: 18px;">应标项目(<%= @bidding_project.count%>)</td>
</table>
<div id='bidding_project_list'>
<%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project} %>
</div>

View File

@ -56,19 +56,18 @@
</tr>
</table>
<div>
关注 (<%= link_to @bid.watcher_users.count, home_path %>) &nbsp;应标项目 (<%= link_to @bid.biding_projects.count, home_path %>)反馈(<%= @bid.commit%>)
关注 (<%= link_to @bid.watcher_users.count, home_path %>) &nbsp;应标项目 (<%= link_to @bid.biding_projects.count, project_for_bid_path(@bid) %>)&nbsp;反馈(<%= link_to @bid.commit, respond_path(@bid)%>)
</div>
</div>
<div class="inf_user_context">
<table style="font-family:微软雅黑">
<div class="user_fans">
<div class="font_title_left">
<strong>标签</strong>
</div><div class="user_underline"></div>
<table style="font-family:微软雅黑">
<tr>
<th>标签云:</th>
</tr>
<tr>
<td><!-- added by william -for tag -->
<div id="tags">
<td><!-- added by william -for tag -->
<%= render :partial => 'layouts/tag', :locals => {:obj => @bid,:object_flag => "4"}%>
</div></td>
</td>
</tr>
</table>
@ -86,10 +85,7 @@
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar" %>
<% end%>
</td>
<tr>
<tr>
<td align="right"><%= link_to "显示所有关注",home_path %>(<%= link_to @bid.watcher_users.count, home_path %>)</td>
<tr>
<tr>
</table>
</div>
</div>
@ -102,11 +98,11 @@
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px"><img src="/images/close.png" width="215px" height="130px"/></td>
<tr>
<tr>
<td align="right"><%= link_to "显示所有应标项目",home_path %>(<%= link_to @bid.biding_projects.count, home_path %>)</td>
<tr>
<td style="padding-top: 5px">
<% for project in @bid.projects%>
<%= link_to image_tag(url_to_avatar(project), :class => "avatar"), project_path(project), :class => "avatar" %>
<% end%></td>
<tr>
</table>
</div>
</div>

View File

@ -408,13 +408,13 @@ RedmineApp::Application.routes.draw do
delete 'bids/destroy', :to => 'bids#destroy'
get 'bids/more', :to => 'bids#more'
get 'bids/back', :to=> 'bids#back'
match 'bids/:bid_id/show_project', :controller => 'bids', :action => 'show_project'
match 'bids/:bid_id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid'
match 'bids/:bid_id/add', :controller => 'bids', :action => 'add'
match 'bids/new_bid', :controller => 'bids', :action => 'new_bid'
# added by young
match 'bids', :controller => 'bids', :action => 'index'
match 'bids/:bid_id/show', :controller => 'bids', :action => 'show'
match 'bids/:bid_id/show', :controller => 'bids', :action => 'show', :as => 'respond'
match 'bids/new', :controller => 'bids', :action => 'new', :via => [:get , :post]

View File

@ -1502,4 +1502,18 @@ div.member_content {
margin-top: 20px;
width: 600px;
margin-left: 40px;
}
/*by fanqiang*/
img.avatar3 {
width: 50px;
height: 50px;
}
a.bid_path {
font-size: 14px;
}
a.bid_user {
font-family:微软雅黑;
color:#acaeb1;
font-size:12px;
}