diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index e73ce0214..1f72f00e0 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -42,6 +42,17 @@ class SubjectsController < ApplicationController redirect_to subject_path(subject) end + def edit + render :layout => "base_edu" + end + + def update + if params[:subject] + subject = @subject.update_attributes(:name => params[:subject][:name], :description => params[:subject][:description]) + end + redirect_to subject_path(@subject) + end + def update_attr if params[:name] @subject.update_attributes(:name => params[:name]) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 29fbf65f0..38aa397e7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -225,6 +225,10 @@ module ApplicationHelper myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => user.id).first if myshixun.nil? 0 + elsif !myshixun.nil? && myshixun.games.select{|game| game.status == 2}.count == 0 + -1 + elsif myshixun.games.select{|game| game.status == 0}.count > 0 + [myshixun.games.select{|game| game.status == 0}.count + 1] else myshixun.games.select{|game| game.status == 2}.count end diff --git a/app/views/challenges/_content_list.html.erb b/app/views/challenges/_content_list.html.erb index 7a36fa413..0cd13ea7b 100644 --- a/app/views/challenges/_content_list.html.erb +++ b/app/views/challenges/_content_list.html.erb @@ -5,15 +5,20 @@ <%= @challenges.count %> <% end %> <% if User.current.manager_of_shixun?(@shixun) && @shixun.status == 0 %> - +单选任务 + + +编程任务--> + 新建阶段 <% end %>
<% @challenges.each_with_index do |challenge, index| -%>
-

第<%= challenge.position %>关 +

+ + + 第<%= challenge.position %>关 <%#= link_to challenge.subject, shixun_challenge_path(@shixun.id, challenge), :target => "_blank" %> <% if User.current.manager_of_shixun?(@shixun) %> <%= link_to challenge.subject, shixun_challenge_path(@shixun, challenge), :target => "_blank" %> diff --git a/app/views/challenges/_edit_task_pass.html.erb b/app/views/challenges/_edit_task_pass.html.erb index 4781c0bb5..e859c0763 100644 --- a/app/views/challenges/_edit_task_pass.html.erb +++ b/app/views/challenges/_edit_task_pass.html.erb @@ -31,38 +31,41 @@ <% end %> <% end %> -
    -
  • - -
    - - -
    -
  • -
  • - -
    - - -
    -
  • -
-
    -
  • - -
    - - -
    -
  • -
  • - -
    - - -
    -
  • -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

<%# if @challenge.st == 1 %> diff --git a/app/views/challenges/_task_pass_form.html.erb b/app/views/challenges/_task_pass_form.html.erb index 8ff08a227..073af7722 100644 --- a/app/views/challenges/_task_pass_form.html.erb +++ b/app/views/challenges/_task_pass_form.html.erb @@ -32,13 +32,13 @@ -