# HG changeset patch # User Jittat Fakcharoenphol # Date 2010-02-10 06:48:17 # Node ID fd4ff20f8070170193d2509979f83e4a484baced # Parent 1821e2e3aeb0f85bee600e3070d2b5b5c36260b3 fixed problem description refresh bug diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -278,6 +278,7 @@ def problems prepare_list_information + @page_reload_when_view_problem = true render :partial => 'problem_title', :collection => @problems, :as => :problem end @@ -335,7 +336,11 @@ @current_problem_id = session[:current_problem_id] session.delete(:current_problem_id) else - @current_problem_id = nil + if params.has_key? :id + @current_problem_id = params[:id].to_i + else + @current_problem_id = nil + end end @problems = all_problems.reject { |problem| passed.has_key? problem.id } diff --git a/app/views/main/_problem_title.html.erb b/app/views/main/_problem_title.html.erb new file mode 100644 --- /dev/null +++ b/app/views/main/_problem_title.html.erb @@ -0,0 +1,17 @@ +
+ <% if @page_reload_when_view_problem %> + + <% else %> + + <% end %> + + <%= problem.full_name %> + <% if @prob_submissions[problem_title_counter][:count] > 0 %> + [<%= @prob_submissions[problem_title_counter][:count] %> trials(s)] + <% else %> + [No trials] + <% end %> + + +
diff --git a/app/views/main/_problem_title.html.haml b/app/views/main/_problem_title.html.haml deleted file mode 100644 --- a/app/views/main/_problem_title.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -.problem-bar{:id => "problem-bar-#{problem.id}"} - %a{:href => "#", :onclick => "$$('.problem-panel').each(function(elt) {elt.hide();}); $('problem-panel-#{problem.id}').show(); $('problem-panel-filler').hide(); return false;"} - %span{:class => 'problem-title'} - = "#{problem.full_name}" - - if @prob_submissions[problem_title_counter][:count] > 0 - = "[#{@prob_submissions[problem_title_counter][:count]} trials(s)]" - - else - [No trials]