Sha256: 3792f19e83eae45ee6fcc6f2b2289eb178a390c62be782f74dbd5f997f95273a

Contents?: true

Size: 966 Bytes

Versions: 4

Compression:

Stored size: 966 Bytes

Contents

module Blog
  class Comments < Controller
    map '/comment'
    helper :gravatar

    def index(id)
    end

    def show
      @pub_formatted = @comment.published.strftime(Blog.options.time_format)
      @id = @comment.id
      @author = h(@comment.author)
      @homepage = @comment.homepage
      @content = h(@comment.content)
      @href = @comment.href
      @gravatar = gravatar(@comment.email.to_s, :size => 80, :default => :wavatar)
    end

    def create
      @comment = Comment.new
      @entry = Entry[request[:entry_id]]

      if @comment.update(@entry, request)
        redirect @comment.href
      else
        partial_content(:form, :comment => @comment, :entry => @entry)
      end
    end

    def form
      @comment ||= Comment.new
      form_errors_from_model(@comment)
    end

    def edit(id)
      'TODO: not implemted'
    end

    def delete(id)
      login_required
      Comment[id].destroy
      redirect_referrer
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
Pistos-ramaze-2009.04.08 examples/app/blog/controller/comment.rb
manveru-ramaze-2009.04.01 examples/app/blog/controller/comment.rb
manveru-ramaze-2009.04.08 examples/app/blog/controller/comment.rb
manveru-ramaze-2009.04.18 examples/app/blog/controller/comment.rb