Class: Jabe::CommentsController

Inherits:
Admin::BaseController show all
Includes:
PublicEntryUrl
Defined in:
app/controllers/jabe/comments_controller.rb

Instance Method Summary collapse

Methods included from PublicEntryUrl

included, #public_entry_url

Methods included from BodyClassHelper

#body_class_name, included

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/jabe/comments_controller.rb', line 9

def create
  comment.request = request
  comment.permalink = public_entry_url(entry)

  if comment.save
    redirect_to public_entry_url(entry), :notice => 'Your comment was submitted.'
  else
    flash[:error] = 'Unable to submit your comment.'
    render 'entries/show'
  end
end

#destroyObject



21
22
23
24
25
26
27
28
29
# File 'app/controllers/jabe/comments_controller.rb', line 21

def destroy
  comment.destroy

  if request.xhr?
    render :nothing => true
  else
    redirect_to entry_path(entry), :notice => 'Comment was deleted.'
  end
end