修改了需求评分功能,以及作业的提交

This commit is contained in:
fanqiang 2013-09-29 19:58:57 +08:00
parent b19ed67d79
commit 838894a19c
20 changed files with 143 additions and 109 deletions

View File

@ -6,7 +6,7 @@ class BidsController < ApplicationController
menu_item :homework_respond, :only => :homework_respond
menu_item :homework_statistics, :only => :homework_statistics
#Ended by young
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:new,:show_results]
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:new,:show_results,:set_reward, :add_homework]
before_filter :require_login,:only => [:set_reward]
helper :watchers

View File

@ -21,25 +21,68 @@
<td style="color: red;" align="right" valign="0.1em" width="35%">
<strong><span id="reward_result_<%=b_project.id%>">
<%if @bid.reward_type == 2%>
<% if get_prize(b_project).nil? or get_prize(b_project) == "" %>
未评奖
<% if @bid.deadline < Date.today %>
未评奖
<% end %>
<% else %>
<% case get_prize(b_project) %>
<% when '0' %>
<%= image_tag("/images/bid/first_reward.png")%>
<% when '1' %>
<%= image_tag("/images/bid/second_reward.png")%>
<% when '2' %>
<%= image_tag("/images/bid/qualified.png")%>
<%end%>
<% case @bid.reward_type %>
<% when 1 %>
<% case get_prize(b_project) %>
<% when '6' %>
<%= image_tag("/images/bid/win_bid.png")%>
<% when '7' %>
<%= image_tag("/images/bid/candidate.png")%>
<% when '8' %>
<%= image_tag("/images/bid/obsolete.png")%>
<% end %>
<% when 2 %>
<% case get_prize(b_project) %>
<% when '0' %>
<%= image_tag("/images/bid/first_reward.png")%>
<% when '1' %>
<%= image_tag("/images/bid/second_reward.png")%>
<% when '2' %>
<%= image_tag("/images/bid/third_reward.png")%>
<% when '3' %>
<%= image_tag("/images/bid/forth_reward.png")%>
<% when '4' %>
<%= image_tag("/images/bid/fifth_reward.png")%>
<% when '5' %>
<%= image_tag("/images/bid/qualified.png")%>
<% end %>
<% when 3 %>
<% case get_prize(b_project) %>
<% when '10' %>
<%= image_tag("/images/bid/A.jpg")%>
<% when '11' %>
<%= image_tag("/images/bid/B+.jpg")%>
<% when '12' %>
<%= image_tag("/images/bid/B.jpg")%>
<% when '13' %>
<%= image_tag("/images/bid/C+.jpg")%>
<% when '14' %>
<%= image_tag("/images/bid/C.jpg")%>
<% when '15' %>
<%= image_tag("/images/bid/D+.jpg")%>
<% when '16' %>
<%= image_tag("/images/bid/D.jpg")%>
<% when '17' %>
<%= image_tag("/images/bid/E+.png")%>
<% when '18' %>
<%= image_tag("/images/bid/E.png")%>
<% when '19' %>
<%= image_tag("/images/bid/F.jpg")%>
<% end %>
<% end %>
<% end %>
<% end %>
</span></strong>
</td>
<!-- 评价显隐控制按钮-->
<% if User.current.id == @bid.author_id %>
<% if User.current.id == @bid.author_id && @bid.deadline > Date.today %>
<td valign="top" align="right" width="10%">
<span> <%= toggle_link '评价', b_project.id.to_s %></span>
<!-- 评价应标项目的表单 -->
@ -47,9 +90,18 @@
<%= form_for "set_reward",:remote=>true,:url=>set_reward_path do |f| %>
<%= f.text_field :b_id,:style => "display:none",:value => b_project.id,:size=>"0" %>
<%= f.select :reward,"<option value = '0'>#{l(:label_first_reward)}</option> <option value = '1'>#{l(:label_second_reward)}</option> <option value = '2'>#{l(:label_comfort_reward)}</option>"
.html_safe %>
<% case @bid.reward_type %>
<% when 1 %>
<%= f.select :reward,"<option value = '6'>中标</option> <option value = '7'>备选</option> <option value = '8'>淘汰</option>"
.html_safe %>
<% when 2 %>
<%= f.select :reward,"<option value = '0'>#{l(:label_first_reward)}</option> <option value = '1'>#{l(:label_second_reward)}</option> <option value = '2'>三等奖</option> <option value = '3'>四等奖</option> <option value = '4'>五等奖</option> <option value = '5'>#{l(:label_comfort_reward)}</option>"
.html_safe %>
<% when 3 %>
<%= f.select :reward,"<option value = '10'>A</option> <option value = '11'>B+</option> <option value = '12'>B</option> <option value = '13'>C+</option> <option value = '14'>C</option> <option value = '15'>D+</option>
<option value = '16'>D</option> <option value = '17'>E+</option> <option value = '18'>E</option> <option value = '19'>F</option>"
.html_safe %>
<% end %>
<%= f.submit "提交",:class=>"submit" %>
<% end %>
@ -69,10 +121,6 @@
</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%">

View File

@ -1,13 +1,8 @@
<!-- fq -->
<%= render_flash_messages %>
<% if @bid.deadline > Date.today %>
<table width="1000px" border="0" style="padding-left: 15px">
<%if @bid.reward_type == 3 %>
<td class="font_lighter" style="font-size: 15px;"><%= l(:label_homework_project) %>(<%= @bidding_project.count%>)</td>
<% else %>
<td class="font_lighter" style="font-size: 18px;"><%= l(:label_bidding_project) %>(<%= @bidding_project.count%>)</td>
<% if @bid.reward_type == 3 %>
<table width="1000px" border="0" style="padding-left: 15px">
<% end %>
<% if User.current.logged? %>
<td>
@ -20,65 +15,20 @@
</td>
<% end %>
</table>
<% @bidding_project.each do |b_project|%>
<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%" valign="top">
<table width="100%" valign="top">
<tr>
<td colspan="2" valign="top"><strong><%= link_to(b_project.project.name, project_path(b_project.project)) %></strong><a class="font_lighter"><%= l(:label_jion_bidding_homework)%></a></td>
</tr>
<tr></tr>
<tr>
<td valign="top"><%= b_project.project.description %></td>
</tr>
<tr>
<td valign="top"><a class="font_lighter"><%=format_time(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><%= l(:label_bidding_user_studentcode) %> : <%= (b_project.user.user_extensions.student_id) %></td>
</tr>
<tr>
<td><%= l(:label_bidding_user_homework) %> : <%= link_to(b_project.user.lastname+b_project.user.firstname, user_path(b_project.user)) %></td>
</tr>
<tr>
<td style=" word-wrap: break-word; word-break: break-all"><%= l(:label_bidding_reason_homewrok) %> : <%= b_project.description %></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<% end %>
<% else %>
<table width="1000px" border="0" style="padding-left: 15px">
<td class="font_lighter" style="font-size: 15px;"><%= l(:label_bidding_project) %>(<%= @bidding_project.count%>)</td>
<% if User.current.logged? %>
<td>
<% else %>
<table width="1000px" border="0" style="padding-left: 15px">
<td class="font_lighter" style="font-size: 15px;"><%= l(:label_bidding_project) %>(<%= @bidding_project.count%>)</td>
<% if User.current.logged? %>
<td>
<div class='icon icon-add'>
<%= toggle_link l(:label_bid_me), 'put-bid-form' %>
<%= toggle_link l(:button_bidding_homework), 'put-bid-form' %>
</div>
</td>
<% end %>
</table>
</td>
<% end %>
</table>
<% end %>
<% unless @bid.reward_type == 3%>
<%= render :partial=> "list_projects",:locals => {:bidding_project => @bidding_project,:bid => @bid }%>

View File

@ -1,20 +1,60 @@
$('#reward_result_<%= @biding_project_id %>').html('<%= j(
if get_prize(@b_p).nil? or get_prize(@b_p) == ""
puts '未评奖'
else
case get_prize(@b_p)
when '0'
image_tag("/images/bid/first_reward.png")
when '1'
image_tag("/images/bid/second_reward.png")
when '2'
image_tag("/images/bid/qualified.png")
else
'未评奖'
end
end
if get_prize(@b_p).nil? or get_prize(@b_p) == ""
if @bid.deadline < Date.today
puts '未评奖'
end
else
case @bid.reward_type
when 1
case get_prize(@b_p)
when '6'
image_tag("/images/bid/win_bid.png")
when '7'
image_tag("/images/bid/candidate.png")
when '8'
image_tag("/images/bid/obsolete.png")
end
when 2
case get_prize(@b_p)
when '0'
image_tag("/images/bid/first_reward.png")
when '1'
image_tag("/images/bid/second_reward.png")
when '2'
image_tag("/images/bid/third_reward.png")
when '3'
image_tag("/images/bid/forth_reward.png")
when '4'
image_tag("/images/bid/fifth_reward.png")
when '5'
image_tag("/images/bid/qualified.png")
end
when 3
case get_prize(@b_p)
when '10'
image_tag("/images/bid/A.jpg")
when '11'
image_tag("/images/bid/B+.jpg")
when '12'
image_tag("/images/bid/B.jpg")
when '13'
image_tag("/images/bid/C+.jpg")
when '14'
image_tag("/images/bid/C.jpg")
when '15'
image_tag("/images/bid/D+.jpg")
when '16'
image_tag("/images/bid/D.jpg")
when '17'
image_tag("/images/bid/E+.png")
when '18'
image_tag("/images/bid/E.png")
when '19'
image_tag("/images/bid/F.jpg")
end
end
end
)
%>')

View File

@ -0,0 +1,5 @@
class AddRewardToHomeworkAttaches < ActiveRecord::Migration
def change
add_column :homework_attaches, :reward, :string
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130927011824) do
ActiveRecord::Schema.define(:version => 20130929011921) do
create_table "a_user_watchers", :force => true do |t|
t.string "name"
@ -77,11 +77,7 @@ ActiveRecord::Schema.define(:version => 20130927011824) do
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
end
create_table "bids", :force => true do |t|
@ -273,6 +269,7 @@ ActiveRecord::Schema.define(:version => 20130927011824) do
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
end
create_table "homework_for_courses", :force => true do |t|
@ -700,18 +697,12 @@ ActiveRecord::Schema.define(:version => 20130927011824) do
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
<<<<<<< .mine
t.integer "identity"
t.string "technical_title"
t.integer "student_id"
t.string "teacher_realname"
t.string "student_realname"
t.string "location_city"
t.integer "identity"
t.string "technical_title"
end
create_table "user_preferences", :force => true do |t|

BIN
public/images/bid/A.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
public/images/bid/B+.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
public/images/bid/B.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
public/images/bid/C+.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
public/images/bid/C.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
public/images/bid/D+.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
public/images/bid/D.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
public/images/bid/E+.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
public/images/bid/E.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
public/images/bid/F.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB