Sha256: e4d273d67e12390bcf8931e0d0ae29e029038a1c98a6c41c29ab008427d73fd7

Contents?: true

Size: 508 Bytes

Versions: 5

Compression:

Stored size: 508 Bytes

Contents

module Irwi::Extensions::Controllers::WikiPageAttachments

  def add_attachment
    attachment = page_attachment_class.new(params[:wiki_page_attachment])
    attachment.save
    redirect_to url_for( :action => :edit)
  end

  def remove_attachment
    attachment = page_attachment_class.find(params[:attachment_id])
    attachment.destroy
    redirect_to url_for(:path => attachment.page.path, :action => :edit)
  end

  protected

  def page_attachment_class
    Irwi.config.page_attachment_class
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
irwi-0.2.4 lib/irwi/extensions/controllers/wiki_page_attachments.rb
irwi-0.2.3 lib/irwi/extensions/controllers/wiki_page_attachments.rb
irwi-0.2.2 lib/irwi/extensions/controllers/wiki_page_attachments.rb
irwi-0.2.1 lib/irwi/extensions/controllers/wiki_page_attachments.rb
irwi-0.2.0 lib/irwi/extensions/controllers/wiki_page_attachments.rb