diff --git a/app/models/bid.rb b/app/models/bid.rb index f04e5436c..ef51e9589 100644 --- a/app/models/bid.rb +++ b/app/models/bid.rb @@ -19,6 +19,7 @@ class Bid < ActiveRecord::Base # validates_format_of :deadline, :with => validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/ validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/, :if => Proc.new { |p| p.reward_type == 1 } + validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{1})$/, :if => Proc.new { |p| p.reward_type == 3 } validate :validate_user validate :validate_reward_type after_create :act_as_activity diff --git a/app/views/bids/_bid_show.html.erb b/app/views/bids/_bid_show.html.erb index d26409638..d9995b69a 100644 --- a/app/views/bids/_bid_show.html.erb +++ b/app/views/bids/_bid_show.html.erb @@ -1,42 +1,94 @@ - + + + +<% bids.each do |bid|%> + - + + @@ -46,38 +98,4 @@
<%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %><%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %> - +
- + - - + + <% if bid.reward_type.nil? or bid.reward_type == 1%> + + <% elsif bid.reward_type == 2%> + + <% else %> + + <% end %> - + + + +
<%= link_to(bid.author, user_path(bid.author), :class => 'bid_user') %>:  <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %><%= link_to(bid.author, user_path(bid.author)) %> + + <%= l(:label_bid_publish) %> <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %> +
- - - <% if bid.reward_type.nil? or bid.reward_type == 1%> - - <% elsif bid.reward_type == 2%> - - <% else %> - - <% end %> - - - - -
<%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%><%= l(:label_reward) %><%= bid.budget%><%= l(:label_grade) %><%= bid.budget%>(<%= link_to bid.biding_projects.count, project_for_bid_path(bid)%>)<%= l(:label_biding_project) %>(<%= link_to bid.commit, respond_path(bid)%>)<%= l(:label_responses) %>(<%= link_to bid.watcher_users.count, respond_path(bid)%>)<%= l(:label_followers) %>
<%= format_time bid.created_on %>奖励方式:奖金 <%= bid.budget%><%= l(:label_RMB_sign) %>奖励方式:<%= bid.budget%>奖励方式:学分 <%= bid.budget%>分
-
- - - - -
<%= bid.description%>
-
<%= bid.description%>
+ + + + + + + + + + + +
<%= l(:label_bid_project) %>(<%= link_to bid.biding_projects.count, project_for_bid_path(bid),:class=> "bids_user" %>)
<%= l(:label_responses) %>(<%= link_to bid.commit, respond_path(bid),:class=> "bids_user" %>)
<%= l(:label_followers) %>(<%= link_to bid.watcher_users.count, respond_path(bid),:class=> "bids_user" %>)
<%= l(:field_deadline) %><%= format_time bid.created_on %>
- - - - - -
<%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %> - - - - - - - - - - -
<%= link_to(bid.author, user_path(bid.author)) %> <%= l(:label_bid_publish) %> <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %>
<%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%>
- <%= bid.description%> -
- - - - -
<%= l(:label_bid_project) %>(<%= link_to bid.biding_projects.count, project_for_bid_path(bid),:class=> "bids_user" %>)
<%= l(:label_responses) %>(<%= link_to bid.commit, respond_path(bid),:class=> "bids_user" %>)
<%= l(:label_followers) %>(<%= link_to bid.watcher_users.count, respond_path(bid),:class=> "bids_user" %>)
<%= l(:field_deadline) %><%= format_time bid.created_on %>
-<% end %> - diff --git a/app/views/bids/_form.html.erb b/app/views/bids/_form.html.erb index cd26bf567..06c4462b3 100644 --- a/app/views/bids/_form.html.erb +++ b/app/views/bids/_form.html.erb @@ -11,7 +11,7 @@ text_t.attr("placeholder", "输入奖励金额,如500, 2.5等"); } if (text.val() == 3) { - text_t.attr("placeholder", "输入奖励的学分,如3分, 2.5分"); + text_t.attr("placeholder", "输入奖励的学分,如3, 2.5"); } if (text.val() == 2) { text_t.attr("placeholder", "输入奖励的内容,可以是奖项,物品等"); diff --git a/app/views/bids/show.html.erb b/app/views/bids/show.html.erb index 18dc7a81a..c51a66bfd 100644 --- a/app/views/bids/show.html.erb +++ b/app/views/bids/show.html.erb @@ -8,12 +8,12 @@ <% if @bid.reward_type.nil? or @bid.reward_type == 1%> - <%= l(:label_price) %><%= l(:label_RMB_sign) %><%= @bid.budget%> - <% elsif @bid.reward_type == 2%> - <%= l(:label_reward) %><%= @bid.budget%> - <% else %> - <%= l(:label_grade) %><%= @bid.budget%> - <% end %> + 奖励方式:奖金 <%= @bid.budget%><%= l(:label_RMB_sign) %> + <% elsif @bid.reward_type == 2%> + 奖励方式:<%= @bid.budget%> + <% else %> + 奖励方式:学分 <%= @bid.budget%>分 + <% end %> diff --git a/app/views/layouts/base_bids.html.erb b/app/views/layouts/base_bids.html.erb index c392c1fd6..7087b55d9 100644 --- a/app/views/layouts/base_bids.html.erb +++ b/app/views/layouts/base_bids.html.erb @@ -49,12 +49,12 @@ <% if @bid.reward_type.nil? or @bid.reward_type == 1%> - <%= l(:label_price) %><%= l(:label_RMB_sign) %><%= @bid.budget%> - <% elsif @bid.reward_type == 2%> - <%= l(:label_reward) %><%= @bid.budget%> - <% else %> - <%= l(:label_grade) %><%= @bid.budget%> - <% end %> + 奖励方式:奖金 <%= @bid.budget%><%= l(:label_RMB_sign) %> + <% elsif @bid.reward_type == 2%> + 奖励方式:<%= @bid.budget%> + <% else %> + 奖励方式:学分 <%= @bid.budget%>分 + <% end %> <%= l(:label_investment_time_limit) %><%= @bid.deadline%>