From: <zn...@us...> - 2009-06-02 08:56:42
|
Revision: 898 http://crackerjack.svn.sourceforge.net/crackerjack/?rev=898&view=rev Author: znz Date: 2009-06-02 08:56:23 +0000 (Tue, 02 Jun 2009) Log Message: ----------- save added/deleted rows/columns to session cookies Modified Paths: -------------- trunk/viewsite/app/controllers/compare_results_controller.rb trunk/viewsite/app/views/compare_results/index.html.erb trunk/viewsite/public/javascripts/application.js Modified: trunk/viewsite/app/controllers/compare_results_controller.rb =================================================================== --- trunk/viewsite/app/controllers/compare_results_controller.rb 2009-06-02 08:55:52 UTC (rev 897) +++ trunk/viewsite/app/controllers/compare_results_controller.rb 2009-06-02 08:56:23 UTC (rev 898) @@ -7,28 +7,44 @@ :order => "hostname ASC, kernel_version ASC, testcases_version ASC", } opts[:col] = opts[:row].dup - @selected_tab = nil @custom_table = false @distro_title = "Difference between Distributions" @vanilla_title = "Difference between Distributions and Vanilla Kernels" - [:row, :col].each do |key| - case params[key] + if params[:row] == params[:col] + case params[:col] when 'all' @selected_tab = :all @title = "All Kernels" when /\d/ + @selected_tab = nil + when '!d' + @selected_tab = :vanilla + @title = @vanilla_title + else + @selected_tab = :distro + @title = @distro_title + end + end + if @selected_tab + [:row, :col].each do |key| + value = cookies["#{@selected_tab}_#{key}"] + if value && /\d/ !~ params[key] + params[key] = value + end + end + end + [:row, :col].each do |key| + case params[key] + when 'all' + when /\d/ @custom_table = true ids = params[key].split(/\D+/).map{|s|s.to_i} opts["#{key}_ids"] = ids opts[key][:conditions] = ["id in (?)", ids] opts[key].delete(:order) when '!d' - @selected_tab = :vanilla - @title = @vanilla_title opts[key][:conditions] = ["distribution_kernel = ?", false] else - @selected_tab = :distro - @title = @distro_title opts[key][:conditions] = ["distribution_kernel = ?", true] end end Modified: trunk/viewsite/app/views/compare_results/index.html.erb =================================================================== --- trunk/viewsite/app/views/compare_results/index.html.erb 2009-06-02 08:55:52 UTC (rev 897) +++ trunk/viewsite/app/views/compare_results/index.html.erb 2009-06-02 08:56:23 UTC (rev 898) @@ -2,15 +2,11 @@ <div class="ui-tabs"> <ul class="ui-tabs-nav"> - <li<%= tab_class(:distro) %>><%= link_to @distro_title, cjk_path %></li> - <li<%= tab_class(:vanilla) %>><%= link_to @vanilla_title, :row => '!d', :col => '!d' %></li> + <li<%= tab_class(:distro) %>><%= link_to @distro_title, cjk_path, :class => :distro %></li> + <li<%= tab_class(:vanilla) %>><%= link_to @vanilla_title, { :row => '!d', :col => '!d' }, :class => :vanilla %></li> <%- if false -%> <li<%= tab_class(:all) %>><%= link_to 'All Kernels', :row => 'all', :col => 'all' %></li> <%- end -%> -<%- if @custom_table -%> - <li class="ui-tabs-selected"><%= link_to 'Customized', :row => params[:row], :col => params[:col] %></li> -<%- end -%> - <li id="permalink_container" style="display:none"><%= link_to 'Permalink', { :row => nil, :col => nil }, { :id => "permalink" } %></li> </ul> <div class="ui-tabs-panel"> Modified: trunk/viewsite/public/javascripts/application.js =================================================================== --- trunk/viewsite/public/javascripts/application.js 2009-06-02 08:55:52 UTC (rev 897) +++ trunk/viewsite/public/javascripts/application.js 2009-06-02 08:56:23 UTC (rev 898) @@ -2,18 +2,16 @@ // This file is automatically included by javascript_include_tag :defaults App = {}; -App.use_ajax = false; +App.use_ajax = true; App.updatePermalink = function() { + var col_ids = App.getIds(".col_name"); + var row_ids = App.getIds(".row_name"); + var selected_tab = jQuery(".ui-tabs-selected a").attr("class"); + jQuery.cookie(selected_tab + "_col", col_ids); + jQuery.cookie(selected_tab + "_row", row_ids); if (!App.permalink_base) { - App.permalink_base = jQuery("#permalink").attr("href"); - } - var href = App.permalink_base + '?col=' + App.getIds(".col_name") + '&row=' + App.getIds(".row_name"); - if (!App.use_ajax) { - location.href = href; return; } - jQuery("#permalink").attr("href", href); - jQuery("#permalink_container").show(); }; App.removeRow = function(row_id) { var row_name = jQuery.trim(jQuery('#row_name_' + row_id).html()); @@ -66,12 +64,6 @@ if (col_add.selectedIndex < 0) return; var option = col_add.options[col_add.selectedIndex]; var col = option.value; - if (!App.use_ajax) { - // add dummy - $("<span style='display:none' class='col_name' id='"+col+"'></span>").insertAfter("#compare_results"); - App.updatePermalink(); - return; - } var row = App.getIds(".row_name"); jQuery.get(window.location.pathname, { col: col, row: row }, function(text) { try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |