it can be summited project with same name.

This commit is contained in:
yanxd 2013-12-20 09:52:10 +08:00
parent 2db1067158
commit 3f82203735
3 changed files with 10 additions and 2 deletions

View File

@ -454,7 +454,7 @@ class BidsController < ApplicationController
###添加应标项目
def add
project = Project.where('name = ?', params[:bid]).first
project = Project.find(params[:bid])
bid_message = params[:bid_for_save][:bid_message]
if BidingProject.where("project_id = ? and bid_id = ?", project.id, @bid.id).size == 0
if BidingProject.cerate_bidding(@bid.id, project.id, bid_message)

View File

@ -135,4 +135,12 @@ module BidsHelper
people.include?(User.current)
end
def select_option_helper option
tmp = Hash.new
option.each do |project|
tmp[project.name] = project.identifier
end
tmp
end
end

View File

@ -70,7 +70,7 @@
:complete => '$("#put-bid-form").hide();' do |f| %>
<table id="bidding_table" border="0" width="100%" style="margin-left: 40px;">
<tr>
<td><%= select_tag 'bid', options_for_select(@option), :name => 'bid', :class => 'grayline' %></td>
<td><%= select_tag 'bid', options_for_select(select_option_helper(@option)), :name => 'bid', :class => 'grayline' %></td>
<div id="prompt_create_pro"><!-- nyan -->
<td>
<p>