Class: Wf::CommentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/wf/comments_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#wf_current_user

Instance Method Details

#createObject



17
18
19
20
21
# File 'app/controllers/wf/comments_controller.rb', line 17

def create
  @workitem = Wf::Workitem.find(params[:workitem_id])
  Wf::CaseCommand::AddComment.call(@workitem, params[:comment][:body], wf_current_user)
  redirect_to workitem_path(@workitem), notice: "Comment Added."
end

#destroyObject



23
24
25
26
27
28
# File 'app/controllers/wf/comments_controller.rb', line 23

def destroy
  @workitem = Wf::Workitem.find(params[:workitem_id])
  @comment = @workitem.comments.find(params[:id])
  @comment.destroy
  render js: "window.location.reload()"
end

#newObject



9
10
11
12
13
14
15
# File 'app/controllers/wf/comments_controller.rb', line 9

def new
  @workitem = Wf::Workitem.find(params[:workitem_id])
  @comment = @workitem.comments.new
  breadcrumb @workitem.workflow.name, workflow_path(@workitem.workflow)
  breadcrumb @workitem.case.name, workflow_case_path(@workitem.workflow, @workitem.case)
  breadcrumb @workitem.name, workitem_path(@workitem)
end