添加删除项目型作业功能
This commit is contained in:
parent
6086b25db7
commit
c48b850cf7
|
@ -7,7 +7,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,:set_reward, :add_homework, :fork, :create_fork,
|
||||
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:delete,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
|
||||
:show_course, :show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
|
||||
# added by fq
|
||||
before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest]
|
||||
|
@ -500,6 +500,15 @@ class BidsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#删除已提交的项目作业(不删项目)
|
||||
def delete
|
||||
binding_project = params[:binding_project]
|
||||
if BidingProject.delete(binding_project)
|
||||
redirect_to project_for_bid_path
|
||||
else
|
||||
redirect_to 403;
|
||||
end
|
||||
end
|
||||
## 新建留言
|
||||
def create
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class BidingProject < ActiveRecord::Base
|
|||
self.create(:user_id => User.current.id, :bid_id => bid_id,
|
||||
:project_id => project_id, :description => description)
|
||||
end
|
||||
|
||||
|
||||
# used to update the reward ,the value varies from 0,1,2,3,4,5
|
||||
# added by william
|
||||
def update_reward(which)
|
||||
|
|
|
@ -153,7 +153,12 @@
|
|||
<span class="required">迟交</span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td align="right"><%= link_to image_tag('delete.png') %></td>
|
||||
<td align="right">
|
||||
<% if b_project.user.id == User.current.id || User.current.id == b_project.bid.author.id
|
||||
%>
|
||||
<%= link_to image_tag('delete.png'),{ :action => "delete", :binding_project => b_project}, :confirm => "Are you sure?" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
|
@ -550,6 +550,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'calls/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid'
|
||||
match 'calls/:id/show_project_homework', :controller => 'bids', :action => 'show_project_homework', :as => 'project_for_bid_homework' # by huang
|
||||
match 'calls/:id/add', :controller => 'bids', :action => 'add'
|
||||
match 'calls/:id/delete', :controller => 'bids', :action => 'delete'
|
||||
match 'calls/:id/add_homework', :controller => 'bids', :action => 'add_homework', via: :post
|
||||
match 'calls/:id/new_submit_homework', to: 'bids#new_submit_homework', via: :get, as: 'new_submit_homework'
|
||||
match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond'
|
||||
|
|
Loading…
Reference in New Issue