parent
09eae52fc1
commit
0385013905
|
@ -276,11 +276,19 @@ class AccountController < ApplicationController
|
|||
set_autologin_cookie(user)
|
||||
end
|
||||
call_hook(:controller_account_success_authentication_after, {:user => user })
|
||||
|
||||
code = /\d*/
|
||||
#根据home_url生产正则表达式
|
||||
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
|
||||
if code=~params[:back_url]
|
||||
redirect_to user_activities_path(user)
|
||||
else
|
||||
#by young
|
||||
#redirect_back_or_default my_page_path
|
||||
redirect_back_or_default User.current
|
||||
#redirect_to User.current
|
||||
end
|
||||
end
|
||||
|
||||
def set_autologin_cookie(user)
|
||||
token = Token.create(:user => user, :action => 'autologin')
|
||||
|
|
|
@ -18,6 +18,8 @@ class BidsController < ApplicationController
|
|||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
include ApplicationHelper
|
||||
include BidsHelper
|
||||
|
||||
helper :projects
|
||||
helper :words
|
||||
helper :welcome
|
||||
|
@ -503,12 +505,14 @@ class BidsController < ApplicationController
|
|||
#删除已提交的项目作业(不删项目)
|
||||
def delete
|
||||
binding_project = params[:binding_project]
|
||||
if can_delete_project_homework(BidingProject.find(binding_project),User.current)
|
||||
if BidingProject.delete(binding_project)
|
||||
redirect_to project_for_bid_path
|
||||
else
|
||||
redirect_to 403;
|
||||
end
|
||||
end
|
||||
end
|
||||
## 新建留言
|
||||
def create
|
||||
|
||||
|
|
|
@ -151,4 +151,8 @@ module BidsHelper
|
|||
tmp
|
||||
end
|
||||
|
||||
def can_delete_project_homework bind_project,current_user
|
||||
current_user.id == bind_project.user.id || current_user.admin
|
||||
end
|
||||
|
||||
end
|
|
@ -154,9 +154,9 @@
|
|||
<% end %>
|
||||
</td>
|
||||
<td align="right">
|
||||
<% if b_project.user.id == User.current.id || User.current.id == b_project.bid.author.id
|
||||
<% if can_delete_project_homework b_project,User.current
|
||||
%>
|
||||
<%= link_to image_tag('delete.png'),{ :action => "delete", :binding_project => b_project}, :confirm => "Are you sure?" %>
|
||||
<%= link_to image_tag('delete.png'),{ :action => "delete", :binding_project => b_project}, :confirm => l(:text_are_you_sure) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue