Changeset 719

Show
Ignore:
Timestamp:
02/01/08 20:06:42 (5 months ago)
Author:
mislav
Message:

fix the tree expansion issue in admin interface (cookie-related). minor cleanup server-side

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/rails2/RAILS2_TODO

    r717 r719  
    33* Something is wrong with the code tracking whether or not nodes are expanded 
    44  in the site map. The tests are passing now, but the expansion is not  
    5   preserved beyond 2 levels. 
     5  preserved beyond 2 levels. -- COMPLETED (mislav) 
    66 
    77* Update boot.rb and environment.rb. Make sure the templates that the radiant  
    88  command uses are updated as well. -- COMPLETED (sean) 
    99   
    10 * Make sure script/spec works or uses spec.opts by default without -O. 
     10* Make sure script/spec works or uses spec.opts by default without -O.>>>>>>> .r718 
  • branches/rails2/app/helpers/admin/node_helper.rb

    r694 r719  
    1414    unless @expanded_rows 
    1515      @expanded_rows = case 
    16       when rows = cookies['expanded_rows'
     16      when rows = cookies[:expanded_rows
    1717        rows.split(',').map { |x| Integer(x) rescue nil }.compact 
    1818      else 
    1919        [] 
    2020      end 
    21       (@expanded_rows << homepage.id).uniq if homepage 
     21 
     22      if homepage and !@expanded_rows.include?(homepage.id) 
     23        @expanded_rows << homepage.id 
     24      end 
    2225    end 
    2326    @expanded_rows 
  • branches/rails2/app/helpers/application_helper.rb

    r580 r719  
    7777   
    7878  def nav_link_to(name, options) 
    79     logger.debug 'options are: ' + options.to_s 
    8079    if current_url?(options) 
    8180      %{<strong>#{ link_to name, options }</strong>} 
  • branches/rails2/public/javascripts/sitemap.js

    r576 r719  
    4747  readExpandedCookie: function() { 
    4848    var matches = document.cookie.match(/expanded_rows=(.+?);/); 
    49     this.expandedRows = matches ? matches[1].split(',') : []; 
     49    this.expandedRows = matches ? decodeURIComponent(matches[1]).split(',') : []; 
    5050  }, 
    5151 
    5252  saveExpandedCookie: function() { 
    53     document.cookie = "expanded_rows=" + this.expandedRows.uniq().join(",") + "; path=/admin"; 
     53    document.cookie = "expanded_rows=" + encodeURIComponent(this.expandedRows.uniq().join(",")) + "; path=/admin"; 
    5454  },  
    5555