dev_partners
daiao 6 years ago
parent f738ba4cc5
commit b49c1f5752

@ -2,7 +2,7 @@
class ChallengesController < ApplicationController class ChallengesController < ApplicationController
layout "base_shixun" layout "base_shixun"
# 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位 # 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位
before_filter :handle_openi_request, if: -> { user_login_and_from_openi? }, only: [:index] #before_filter :handle_openi_request, if: -> { user_login_and_from_openi? }, only: [:index]
before_filter :check_authentication, :except => [:index] before_filter :check_authentication, :except => [:index]
before_filter :find_shixun, :only => [:index, :new, :create, :destroy, :challenge_build, :update_evaluation, :add_choose_question, :new_choose_question, before_filter :find_shixun, :only => [:index, :new, :create, :destroy, :challenge_build, :update_evaluation, :add_choose_question, :new_choose_question,
:choose_type_show, :edit_choose_question, :update_choose_question, :destroy_challenge_choose] :choose_type_show, :edit_choose_question, :update_choose_question, :destroy_challenge_choose]
@ -467,6 +467,8 @@ class ChallengesController < ApplicationController
render_404 render_404
return return
else else
logger.info("operable: ##{@shixun.operable?}")
logger.info("@shixun.status: ##{@shixun.status}")
if (@shixun.status == 0 && !User.current.manager_of_shixun?(@shixun)) || (!@shixun.operable? && !User.current.admin?) if (@shixun.status == 0 && !User.current.manager_of_shixun?(@shixun)) || (!@shixun.operable? && !User.current.admin?)
render_403 render_403
return return

@ -71,6 +71,7 @@ class Shixun < ActiveRecord::Base
# 可供使用的实训 # 可供使用的实训
def operable? def operable?
logger.info("####")
self.status != -1 && !self.hidden self.status != -1 && !self.hidden
end end

@ -13,7 +13,7 @@
<% end %> <% end %>
</p> </p>
<div class="justify break_full_word new_li mb50" id="challenge_editorMd_description"> <div class="justify break_full_word new_li mb50" id="challenge_editorMd_description">
<textarea style="display:none;"><%= @shixun.description %></textarea> <textarea style="display:none;"><%#= @shixun.description %></textarea>
</div> </div>
<p class="clearfix mb10"> <p class="clearfix mb10">
<span class="font-16 fl">全部任务</span> <span class="font-16 fl">全部任务</span>

Loading…
Cancel
Save