Method: Zafu::Process::Ajax#r_edit

Defined in:
lib/zafu/process/ajax.rb

#r_editObject



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/zafu/process/ajax.rb', line 177

def r_edit
  # ajax
  if cancel = @context[:form_cancel]
    # cancel button
    out cancel
  else
    # edit button

    # TODO: show 'reply' instead of 'edit' in comments if visitor != author
    block = ancestor(%w{each block})

    # These parameters are detected by r_block and set in form.
    # removed so they do not polute link
    @params.delete(:publish)
    @params.delete(:cancel)
    @params.delete(:tcancel)

    link = wrap(make_link(:default_text => _('edit'), :update => block, :action => 'edit'))

    out "<% if #{node}.can_write? %>#{link}<% end %>"
  end
end