Changeset 612

Show
Ignore:
Timestamp:
2007-06-07 17:23:27 (2 years ago)
Author:
gaspard
Message:

[change] renamed 'dash' to 'sharp' (I do not know why I thought a '#' was called dash...)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/controllers/application.rb

    r599 r612  
    4242    def visitor 
    4343      @visitor ||= returning(User.make_visitor(:host => request.host, :id => session[:user])) do |user| 
    44         session[:user] = user[:id] 
     44        if session[:user] != user[:id] 
     45          # changed user (login/logout) 
     46          session[:user] = user[:id] 
     47          session[:lang] = user.lang 
     48        end 
    4549      end 
    4650    end 
  • trunk/app/helpers/application_helper.rb

    r607 r612  
    701701    text = opts[:text] 
    702702    node = opts[:node] 
    703     hash = { :node_id => node[:zip], :id => node.v_number } 
     703    # hash = { :node_id => node[:zip], :id => node.v_number } = this is bad: we should not preload a specific version when doing 
     704                                                              # node actions 
     705    hash = { :node_id => node[:zip], :id => 0 } 
    704706     
    705707    res  = [] 
     
    902904    end 
    903905       
    904     url = if dash = options.delete(:dash
    905       if dash =~ /\[(.+)\]/ 
    906         dash_value = node.zafu_read($1) 
    907       else 
    908         dash_value = "node#{node[:zip]}" 
    909       end 
    910       if dash_in = options.delete(:dash_in) 
    911         dash_node = node.relation(dash_in) || node 
    912         "#{zen_path(dash_node, options)}##{dash_value}" 
    913       else 
    914         "##{dash_value}"           
     906    url = if sharp = options.delete(:sharp
     907      if sharp =~ /\[(.+)\]/ 
     908        sharp_value = node.zafu_read($1) 
     909      else 
     910        sharp_value = "node#{node[:zip]}" 
     911      end 
     912      if sharp_in = options.delete(:sharp_in) 
     913        sharp_node = node.relation(sharp_in) || node 
     914        "#{zen_path(sharp_node, options)}##{sharp_value}" 
     915      else 
     916        "##{sharp_value}"           
    915917      end 
    916918    else 
  • trunk/lib/parser/lib/rules/zazen.rb

    r611 r612  
    9696        title, id = $1, $2 
    9797        if id =~ /(.*)#(.*)/ 
    98           id, dash = $1, $2 
    99           dash = title if dash.blank? 
    100         end 
    101         store @helper.make_link(:title=>title,:id=>id,:dash=>dash
     98          id, sharp = $1, $2 
     99          sharp = title if sharp.blank? 
     100        end 
     101        store @helper.make_link(:title=>title,:id=>id,:sharp=>sharp
    102102      else 
    103103        flush @text[0..0] 
  • trunk/lib/parser/lib/rules/zena.rb

    r611 r612  
    885885        mode = '' 
    886886      end 
    887       if dash = @params[:dash
    888         dash = ", :dash=>#{dash.inspect}" 
    889       else 
    890         dash = '' 
    891       end 
    892       if dash_in = @params[:in] 
    893         dash_in = ", :dash_in=>#{dash_in.inspect}" 
    894       else 
    895         dash_in = '' 
     887      if sharp = @params[:sharp
     888        sharp = ", :sharp=>#{sharp.inspect}" 
     889      else 
     890        sharp = '' 
     891      end 
     892      if sharp_in = @params[:in] 
     893        sharp_in = ", :sharp_in=>#{sharp_in.inspect}" 
     894      else 
     895        sharp_in = '' 
    896896      end 
    897897       
    898898      html_tags  = {} 
    899899      if @html_tag && @html_tag != 'a' 
    900         # html attributes do not belong to anchor 
     900        # html attributes do not belong to sharp 
    901901        pre_space = '' 
    902902      else 
     
    908908         
    909909      if text_mode == :raw 
    910         pre_space + "<a#{params_to_html(html_tags)} href='<%= node_link(:url_only=>true, :node=>#{lnode}#{href}#{url}#{dash}#{dash_in}#{fmt}#{mode}) %>'>#{text}</a>" 
     910        pre_space + "<a#{params_to_html(html_tags)} href='<%= node_link(:url_only=>true, :node=>#{lnode}#{href}#{url}#{sharp}#{sharp_in}#{fmt}#{mode}) %>'>#{text}</a>" 
    911911      else 
    912912        text = text.blank? ? '' : ", :text=>#{text}" 
    913         pre_space + "<%= node_link(:node=>#{lnode}#{text}#{href}#{url}#{dash}#{dash_in}#{fmt}#{mode}#{params_to_erb(html_tags)}) %>" 
     913        pre_space + "<%= node_link(:node=>#{lnode}#{text}#{href}#{url}#{sharp}#{sharp_in}#{fmt}#{mode}#{params_to_erb(html_tags)}) %>" 
    914914      end 
    915915    end 
  • trunk/lib/parser/test/parser_test.rb

    r605 r612  
    5656  testfile :zafu, :zafu_asset, :zafu_insight, :zazen 
    5757  def test_single 
    58     do_test('zazen', 'link_dash') 
     58    do_test('zazen', 'link_sharp') 
    5959  end 
    6060   
  • trunk/lib/parser/test/zazen.yml

    r605 r612  
    124124  res: '<p>[make_link id:|23| title:||]</p>' 
    125125 
    126 link_dash
     126link_sharp
    127127  src: '"hello":23#world of fame' 
    128   res: "<p>[make_link dash:|world| id:|23| title:|hello|] of fame</p>" 
     128  res: "<p>[make_link sharp:|world| id:|23| title:|hello|] of fame</p>" 
    129129 
    130 link_dash_same_as_title: 
     130link_sharp_same_as_title: 
    131131  src: '"hello":23# I love you' 
    132   res: "<p>[make_link dash:|hello| id:|23| title:|hello|] I love you</p>" 
     132  res: "<p>[make_link sharp:|hello| id:|23| title:|hello|] I love you</p>" 
    133133 
    134134wiki_link: 
  • trunk/public/stylesheets/reset.css

    r480 r612  
    3131} 
    3232input, textarea { font:inherit; } 
     33pre, code { font:inherit; } 
  • trunk/test/helpers/basic.yml

    r611 r612  
    136136  res: "<a href='/oo'>Zena the wild CMS</a>" 
    137137 
    138 link_dash
    139   src: "<r:link dash='true'/>" 
     138link_sharp
     139  src: "<r:link sharp='true'/>" 
    140140  res: "<a href='#node22'>status title</a>" 
    141141 
    142 link_dash_name: 
    143   src: "<r:link dash='[name]'/>" 
     142link_sharp_name: 
     143  src: "<r:link sharp='[name]'/>" 
    144144  res: "<a href='#status'>status title</a>" 
    145145 
    146 link_dash_in: 
    147   src: "<r:link dash='true' in='project' mode='tree'/>" 
     146link_sharp_in: 
     147  src: "<r:link sharp='true' in='project' mode='tree'/>" 
    148148  res: "<a href='/oo/projects/cleanWater_tree.html#node22'>status title</a>" 
    149149 
    150 link_dash_name_in: 
    151   src: "<r:link dash='[name]' in='parent'/>" 
     150link_sharp_name_in: 
     151  src: "<r:link sharp='[name]' in='parent'/>" 
    152152  res: "<a href='/oo/projects/cleanWater.html#status'>status title</a>" 
    153153 
     
    223223  src: "<h1 class='title' do='title' status='true' actions='all'>dummy</h1>" 
    224224  tem: "<h1 class='title'><div class='s<%= @node.version.status %>'><%= show_title(:node=>@node) + node_actions(:node=>@node, :actions=>\"all\")%></div></h1>" 
    225   res: "/<h1 class='title'><div class='s50'><span id='v_title22'>status title</span><span class='actions'><a.*/nodes/22/versions/1/edit.*/images/page_edit.png'.*/></a>.*</span></div></h1>/" 
     225  res: "/<h1 class='title'><div class='s50'><span id='v_title22'>status title</span><span class='actions'><a.*/nodes/22/versions/0/edit.*/images/page_edit.png'.*/></a>.*</span></div></h1>/" 
    226226 
    227227show_c_width: 
  • trunk/test/helpers/zena_parser_test.rb

    r608 r612  
    99   
    1010  def test_single 
    11     do_test('basic', 'case_when_test_attribute') 
     11    do_test('basic', 'show_title_options') 
    1212  end 
    1313   
  • trunk/test/unit/multiversion_test.rb

    r589 r612  
    3636    node = secure(Node) { nodes(:lake) } # reload 
    3737    assert_equal versions_id(:lake_en), node.version(:pub)[:id] 
     38  end 
     39   
     40  def test_find_version_latest_replaced 
     41    login(:tiger) 
     42    node = secure(Node) { nodes(:status) } 
     43    pub_version_id = node.v_id 
     44    assert_equal 2, node.versions.size 
     45    assert_equal Zena::Status[:pub], node.v_status 
     46    assert node.update_attributes(:v_title => 'great', :v_text => 'mind') 
     47    node = secure(Node) { nodes(:status) } 
     48    assert_equal Zena::Status[:red], node.v_status 
     49    red_version_id = node.v_id 
     50    assert_not_equal pub_version_id, red_version_id 
     51    assert node.remove 
     52    node = secure(Node) { nodes(:status) } 
     53    assert_equal pub_version_id, node.v_id 
     54    assert node.update_attributes(:v_title => 'slow') 
     55    assert_not_equal pub_version_id, node.v_id 
     56    assert_not_equal red_version_id, node.v_id 
     57    assert_not_equal 'mind', node.v_text 
     58    assert_equal 4, node.versions.size 
    3859  end 
    3960