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

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] before_filter :find_bid, :only => [:show, :show_project, :create, :destroy, :more, :back, :add]
helper :watchers helper :watchers
def index def index
if params[:bid_title] if params[:bid_title]
Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description]) Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description])
@ -32,6 +33,13 @@ class BidsController < ApplicationController
end end
def show_project 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 @user = @bid.author
@bidding_project = @bid.biding_projects @bidding_project = @bid.biding_projects
respond_to do |format| respond_to do |format|
@ -43,9 +51,9 @@ class BidsController < ApplicationController
end end
def add 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] 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 @bidding_project = @bid.biding_projects
respond_to do |format| respond_to do |format|
# format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
@ -56,7 +64,7 @@ class BidsController < ApplicationController
def create def create
if params[:user_message].size>0 if params[:user_message].size>0
message = params[:user_message] message = params[:user_message][:message]
@bid.add_jour(User.current, message) @bid.add_jour(User.current, message)
# if a_message.size > 5 # if a_message.size > 5
# @message = a_message[-5, 5] # @message = a_message[-5, 5]

View File

@ -1,6 +1,8 @@
<!-- added by fq --> <!-- 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%> <% unless state%>
<div class="contextual"> <div class="contextual">
<%= link_to l(:button_more), <%= link_to l(:button_more),
@ -16,22 +18,35 @@
:method => 'get' %> :method => 'get' %>
</div> </div>
<% end %> <% end %>
<% end %> <% end %><td>
</tr></table>
<h3><%=l(:label_user_response)%>(<%= journals.count%>)</h3>
<% unless state%> <% unless state%>
<% if journals.size > 5 %> <% if journals.size > 5 %>
<% journals = journals[0, 5] %> <% journals = journals[0, 5] %>
<% end %> <% end %>
<% end %> <% end %>
<% for journal in journals %>
<div id="change-<%= journal.id %>"> <% if journals.size >0 %>
<div id="note-<%= journal.indice %>"> <% remove_allowed = (User.current.id == journals.first.jour_id) %>
<h4><%= link_to "##{journal.indice}", {}, :class => "journal-link" %> <% for journal in journals%>
<%= avatar(journal.user, :size => "24") %> <table width="660px" border="0" align="center">
<%= l(:label_updated_time_by, :author => journal.user, :age => time_tag(journal.created_at)).html_safe%></h4> <tr>
<%= render_notes(bid, journal, :reply_links => true) unless journal.notes.blank? %> <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>
</div> <td><table width="580px" border="0">
</div> <tr>
<%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %> <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 %> <% end %>

View File

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

View File

@ -1,21 +1,28 @@
<% @bidding_project.each do |b_project|%> <% @bidding_project.each do |b_project|%>
<li> <table width="90%" border="0" align='center'>
<table width="90%"border="1"> <tr>
<tr> <td>
<td> <table width="660px" border="0" align='center'>
<table width="100%" border="1"> <tr>
<tr> <td width="50px" valign="top" colspan="2" align="middle">
<td width="10%"><img src="/images/requirements/req.jpg"></td> <div style="width: 50px; height: 50px;">
<td width="50%"> <%= link_to image_tag(url_to_avatar(b_project.project), :class => 'avatar3'), :class => "avatar" %>
<table width="100%"> </div></td>
<tr> <td width="60%">
<td><%= link_to(b_project.project.name, project_path(b_project.project)) %></td> <table width="100%">
</tr> <tr>
<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>
<td><%= b_project.project.description %></td> </tr>
</tr> <tr></tr>
</table></td> <tr>
<td width="40%"> <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%"> <table width="100%">
<tr> <tr>
<td>应标人:<%= link_to(b_project.user.name, user_path(b_project.user)) %></td> <td>应标人:<%= link_to(b_project.user.name, user_path(b_project.user)) %></td>
@ -23,13 +30,10 @@
<tr> <tr>
<td>应标宣言:<%= b_project.description %></td> <td>应标宣言:<%= b_project.description %></td>
</tr> </tr>
</table></td> </table>
</tr> </div></td>
</table></td> </tr>
</tr> </table></td>
<tr> </tr>
<td>&nbsp;</td> </table>
</tr>
</table>
</li>
<% end %> <% end %>

View File

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

View File

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

View File

@ -1,37 +1,44 @@
<div class="contextual"> <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> </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|%>
<% @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 %>
<li> <table width="80%" border="0" align="center">
<img width="29" src="/images/requirements/req.jpg"> <tr>
<strong>悬赏¥1000</strong> <td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(bid.author), :class => 'avatar'), :class => "avatar" %></td>
<%= link_to "宣传展示型网站开发_企业网站中英文", :controller => 'bids', :action => 'show', :bid_id => "2" %> <td>
<span class="gray9">tellmey 发布&nbsp;24投标</span> <table width="100%" border="0">
</li> <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> <% end %>
<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>

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"); 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%"> <table width="660px" border="0" align="center">
<tr> <tr>
<td><h4><strong>需求描述</strong></h4></td> <td width="50" valign="top"><%= link_to image_tag(url_to_avatar(@bid.author), :class => "avatar"), user_path(@bid.author), :class => "avatar" %></td>
</tr> <td><table width="100%" border="0">
<tr><td><%= @bid.description %></td></tr> <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> </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 --> <!-- added by fq -->
<div id="history"> <div id="history">
<%= render :partial => 'history', :locals => { :bid => @bid, :journals => @jour, :state => false} %> <%= render :partial => 'history', :locals => { :bid => @bid, :journals => @jour, :state => false} %>

View File

@ -1,32 +1,29 @@
</br> <div class="contextual">
</br> <div class='icon icon-add' style="margin-right: 30px;">
<div class='icon icon-add'> <%= toggle_link "我要应标", 'put-bid-form', {:focus => 'project_id'} %>
<%= toggle_link "我要应标", 'put-bid-form', {:focus => 'project_id'} %> </div>
</div> </div>
<div id="put-bid-form" style="display: none"> <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", :update => "bidding_project_list",
:complete => '$("#put-bid-form").hide();' do |f| %> :complete => '$("#put-bid-form").hide();' do |f| %>
<table id="bidding_table" border="0" align='center' width="500">
<table id="bidding_table" border="1">
<tr> <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>
<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>
<tr> <tr>
<td><%= f.submit "add"%><%= link_to_function l(:button_cancel), '$("#put-bid-form").hide();'%></td> <td><%= f.submit "add"%><%= link_to_function l(:button_cancel), '$("#put-bid-form").hide();'%></td>
</tr> </tr>
</table> </table>
<% end %> <% end %>
</div> </div>
<h3>应标项目列表</h3> <table width="200px" border="0" style="padding-left: 15px">
<ul> <td class="font_lighter" style="font-size: 18px;">应标项目(<%= @bidding_project.count%>)</td>
<div id='bidding_project_list'> </table>
<%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project} %> <div id='bidding_project_list'>
</div> <%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project} %>
</ul> </div>

View File

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

View File

@ -408,13 +408,13 @@ RedmineApp::Application.routes.draw do
delete 'bids/destroy', :to => 'bids#destroy' delete 'bids/destroy', :to => 'bids#destroy'
get 'bids/more', :to => 'bids#more' get 'bids/more', :to => 'bids#more'
get 'bids/back', :to=> 'bids#back' 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/:bid_id/add', :controller => 'bids', :action => 'add'
match 'bids/new_bid', :controller => 'bids', :action => 'new_bid' match 'bids/new_bid', :controller => 'bids', :action => 'new_bid'
# added by young # added by young
match 'bids', :controller => 'bids', :action => 'index' 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] match 'bids/new', :controller => 'bids', :action => 'new', :via => [:get , :post]

View File

@ -1502,4 +1502,18 @@ div.member_content {
margin-top: 20px; margin-top: 20px;
width: 600px; width: 600px;
margin-left: 40px; 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;
} }