Changeset 1155

Show
Ignore:
Timestamp:
2008-09-16 10:47:44 (4 months ago)
Author:
gaspard
Message:

Fixed a bug where forms to create new nodes could not display checkboxes/radio/selects for relations because the class totally defined yet.
This happens when the 'klass' parameter is defined by the user.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/models/relation_proxy.rb

    r1128 r1155  
    2020    def get_proxy(node, role) 
    2121      rel = find_by_role(role) 
    22       if rel && node.vclass.kpath =~ /\A#{rel.this_kpath}/ 
     22      if rel && (node.new_record? || node.vclass.kpath =~ /\A#{rel.this_kpath}/) 
    2323        rel.start = node 
    2424        rel 
  • trunk/lib/parser/test/parser/zafu.yml

    r1124 r1155  
    3030  src: "this is <r:test super='life' is = \"fine\"" 
    3131  res: "this is <r:test super='life' is = \"fine\"" 
     32 
     33#tag_param_has_bracket: 
     34#  src: "a special tag: <r:test p='<red>yo</red>'><r:hello/></r:test>" 
     35#  res: "a special tag: [test {= :p=>'<red>yo</red>'}][hello/][/test]" 
    3236 
    3337hello_not_closed: 
  • trunk/test/helpers/zena_parser/basic.yml

    r1147 r1155  
    904904  res: "/input type='checkbox' name='node\[calendar_ids\]\[\]' value='11' checked='checked'.*zena.*hidden.*node\[calendar_ids\]\[\]' value=''/" 
    905905 
     906checkbox_finder: 
     907  context: 
     908    node: 'opening' 
     909  src: "<r:checkbox role='calendar' values='projects in site'/>" 
     910  res: "/value=.21.*cleanWater.*input type=.checkbox. name=.node\[calendar_ids\]\[\]. value=.29. checked=.checked.*wiki/" 
     911 
    906912input_set_value: 
    907913  src: "<r:input type='hidden' name='icon_id' set_value='[main.id]'/>" 
  • trunk/test/unit/relation_proxy_test.rb

    r1128 r1155  
    9999    assert rel = node.relation_proxy('blog') 
    100100    assert_equal relations_id(:post_has_blogs), rel[:id] 
     101     
     102    # Any new node can have a relation_proxy (used when forms contain the 'klass' attribute selected by the user). 
     103    node = secure!(Node) { Node.new_from_class('Node') } 
     104    assert rel = node.relation_proxy('blog') 
     105    assert_equal relations_id(:post_has_blogs), rel[:id] 
    101106  end 
    102107