Changeset 1127

Show
Ignore:
Timestamp:
2008-07-26 16:36:55 (6 months ago)
Author:
gaspard
Message:

Changed default in [drop]. Changes dropped element instead of receiver. I am sorry for this rollback but it really makes more sense:
<ul do='drop' set='favorite' do='favorites'> is much better then <ul do='drop' set='favorite_for' do='favorites'>

Removed anchor inside link (was not useful: browser moves past link). Keeping anchor at start of element.
reverted last change to anchor.

fixed small bug in [edit] without text.

Files:

Legend:

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

    r1125 r1127  
    7777        # swap (a way to preview content by drag & drop) 
    7878        @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 
    8086        attributes[:copy] = other 
    8187        @node.update_attributes_with_transformation(attributes) 
    8288        if !@node.errors.empty? 
    8389          @errors = @node.errors 
    84         end 
    85       else 
    86         attributes[:copy] = @node 
    87         other.update_attributes_with_transformation(attributes) 
    88         if !other.errors.empty? 
    89           @errors = other.errors 
    9090        end 
    9191      end 
  • trunk/app/helpers/application_helper.rb

    r1124 r1127  
    6565      when 'edit' 
    6666        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();" 
    6868      when 'create' 
    6969        pos = params[:position]  || :before 
  • trunk/lib/parser/lib/rules/zena.rb

    r1126 r1127  
    522522        return parser_error("missing 'block' in same parent") unless parent && block = parent.descendant('block') 
    523523      end 
    524        
     524      return parser_error("cannot use 's' as key (used by start_node)") if @params[:key] == 's' 
    525525      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'>" 
    526526      if @blocks == [] 
     
    530530      end 
    531531      out "</div></form>" 
    532       if @params[:live] || @params[:updatea
     532      if @params[:live] || @params[:update
    533533        out "<%= observe_form( \"#{dom_id}_f\" , :method => :get, :frequency  =>  1, :submit =>\"#{dom_id}_f\", :url => zafu_node_path(#{node_id})) %>" 
    534534      end 
     
    808808     
    809809    def r_edit 
    810       text = get_text_for_erb 
     810       
    811811      if @context[:dom_prefix] 
    812812        # ajax 
     
    818818           
    819819          # 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) 
    821821        end 
    822822      else 
     
    12421242      end 
    12431243     
    1244       url_params << "change=receiver" if change == 'receiver
     1244      url_params << "change=dropped" if change == 'dropped
    12451245      url_params << "t_url=#{CGI.escape(template_url)}" 
    12461246      url_params << "dom_id=#{erb_dom_id}" 
     
    17691769        pre_space = '' 
    17701770      else 
    1771         [:class, :id, :style].each do |sym| 
     1771        [:class, :id, :style, :name].each do |sym| 
    17721772          if value = @html_tag_params[sym] || @params[sym] 
    17731773            html_params[sym] = value 
     
    17821782        html_params[:name] = anchor_name(@params[:anchor], node) 
    17831783      end 
    1784        
     1784 
    17851785      if upd = @params[:update] 
    17861786        return unless target = find_target(upd) 
  • trunk/test/helpers/zena_parser/ajax.yml

    r1124 r1127  
    155155  context: 
    156156    node: 'art' 
     157    lang: 'fr' 
    157158  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\}/" 
    161162 
    162163drop_done_remove: 
  • trunk/test/helpers/zena_parser/basic.yml

    r1125 r1127  
    551551  tem: "/list1.each.*var1.*<div.*var1.version.dyn\[\"assigned\"\]/" 
    552552 
     553edit: 
     554  context: 
     555    lang: 'fr' 
     556  src: "<div do='block'><r:edit/></div>" 
     557  tem: "/éditer</a>/" 
    553558 
    554559on_if_node_main: