Changeset 1127
- Timestamp:
- 2008-07-26 16:36:55 (6 months ago)
- Files:
-
- trunk/app/controllers/nodes_controller.rb (modified) (1 diff)
- trunk/app/helpers/application_helper.rb (modified) (1 diff)
- trunk/lib/parser/lib/rules/zena.rb (modified) (7 diffs)
- trunk/test/helpers/zena_parser/ajax.yml (modified) (1 diff)
- trunk/test/helpers/zena_parser/basic.yml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/controllers/nodes_controller.rb
r1125 r1127 77 77 # swap (a way to preview content by drag & drop) 78 78 @node = other 79 elsif params[:change] == 'receiver' 79 elsif params[:change] == 'dropped' 80 attributes[:copy] = @node 81 other.update_attributes_with_transformation(attributes) 82 if !other.errors.empty? 83 @errors = other.errors 84 end 85 else 80 86 attributes[:copy] = other 81 87 @node.update_attributes_with_transformation(attributes) 82 88 if !@node.errors.empty? 83 89 @errors = @node.errors 84 end85 else86 attributes[:copy] = @node87 other.update_attributes_with_transformation(attributes)88 if !other.errors.empty?89 @errors = other.errors90 90 end 91 91 end trunk/app/helpers/application_helper.rb
r1124 r1127 65 65 when 'edit' 66 66 page.replace params[:dom_id], :file => fullpath_from_template_url + "_form.erb" 67 page << "$('#{params[:dom_id]}_form_t').focusFirstElement();"67 # page << "$('#{params[:dom_id]}_form_t').focusFirstElement();" 68 68 when 'create' 69 69 pos = params[:position] || :before trunk/lib/parser/lib/rules/zena.rb
r1126 r1127 522 522 return parser_error("missing 'block' in same parent") unless parent && block = parent.descendant('block') 523 523 end 524 524 return parser_error("cannot use 's' as key (used by start_node)") if @params[:key] == 's' 525 525 out "<%= form_remote_tag(:url => zafu_node_path(#{node_id}), :method => :get, :html => {:id => \"#{dom_id}_f\"}) %><div class='hidden'><input type='hidden' name='t_url' value='#{block.template_url}'/><input type='hidden' name='dom_id' value='#{block.erb_dom_id}'/>#{start_node_input}</div><div class='wrapper'>" 526 526 if @blocks == [] … … 530 530 end 531 531 out "</div></form>" 532 if @params[:live] || @params[:update a]532 if @params[:live] || @params[:update] 533 533 out "<%= observe_form( \"#{dom_id}_f\" , :method => :get, :frequency => 1, :submit =>\"#{dom_id}_f\", :url => zafu_node_path(#{node_id})) %>" 534 534 end … … 808 808 809 809 def r_edit 810 text = get_text_for_erb810 811 811 if @context[:dom_prefix] 812 812 # ajax … … 818 818 819 819 # TODO: show 'reply' instead of 'edit' in comments if visitor != author 820 out link_to_update(self, : url => "\#{edit_#{base_class.to_s.underscore}_path(#{node_id})}", :html_params => get_html_params(@params), :method => :get, :cond => "#{node}.can_write?", :else => :void)820 out link_to_update(self, :default_text => _('edit'), :url => "\#{edit_#{base_class.to_s.underscore}_path(#{node_id})}", :html_params => get_html_params(@params), :method => :get, :cond => "#{node}.can_write?", :else => :void) 821 821 end 822 822 else … … 1242 1242 end 1243 1243 1244 url_params << "change= receiver" if change == 'receiver'1244 url_params << "change=dropped" if change == 'dropped' 1245 1245 url_params << "t_url=#{CGI.escape(template_url)}" 1246 1246 url_params << "dom_id=#{erb_dom_id}" … … 1769 1769 pre_space = '' 1770 1770 else 1771 [:class, :id, :style ].each do |sym|1771 [:class, :id, :style, :name].each do |sym| 1772 1772 if value = @html_tag_params[sym] || @params[sym] 1773 1773 html_params[sym] = value … … 1782 1782 html_params[:name] = anchor_name(@params[:anchor], node) 1783 1783 end 1784 1784 1785 1785 if upd = @params[:update] 1786 1786 return unless target = find_target(upd) trunk/test/helpers/zena_parser/ajax.yml
r1124 r1127 155 155 context: 156 156 node: 'art' 157 lang: 'fr' 157 158 src: "<r:tagged><r:each><r:show attr='name'/>: <r:show attr='l_status'/> <r:edit/></r:each></r:tagged>" 158 res: "/link_id /"159 'edit/link/ en/list1_form.erb': "/<input type='hidden' name='link_id' value=.<%= @node.link_id %>./>/"160 'edit/link/ en/list1.erb': "/\#\{@node.link_id\}/"159 res: "/link_id.*éditer/" 160 'edit/link/fr/list1_form.erb': "/<input type='hidden' name='link_id' value=.<%= @node.link_id %>./>/" 161 'edit/link/fr/list1.erb': "/\#\{@node.link_id\}/" 161 162 162 163 drop_done_remove: trunk/test/helpers/zena_parser/basic.yml
r1125 r1127 551 551 tem: "/list1.each.*var1.*<div.*var1.version.dyn\[\"assigned\"\]/" 552 552 553 edit: 554 context: 555 lang: 'fr' 556 src: "<div do='block'><r:edit/></div>" 557 tem: "/éditer</a>/" 553 558 554 559 on_if_node_main:
