Class: RailsNexus::WorkflowController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RailsNexus::WorkflowController
- Defined in:
- app/controllers/rails_nexus/workflow_controller.rb
Instance Method Summary collapse
-
#add_comment ⇒ Object
POST /rails_nexus/logged_exceptions/:id/comment.
-
#assign ⇒ Object
POST /rails_nexus/logged_exceptions/:id/assign.
-
#mute ⇒ Object
POST /rails_nexus/logged_exceptions/:id/mute.
-
#set_priority ⇒ Object
POST /rails_nexus/logged_exceptions/:id/priority.
-
#snooze ⇒ Object
POST /rails_nexus/logged_exceptions/:id/snooze.
-
#unmute ⇒ Object
POST /rails_nexus/logged_exceptions/:id/unmute.
Instance Method Details
#add_comment ⇒ Object
POST /rails_nexus/logged_exceptions/:id/comment
57 58 59 60 61 62 63 64 |
# File 'app/controllers/rails_nexus/workflow_controller.rb', line 57 def add_comment @exception.add_comment(author: , body: params[:body], comment_type: params[:comment_type] || "comment") respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace("comments-list", partial: "rails_nexus/logged_exceptions/comments_list", locals: { exception: @exception }) } format.html { redirect_back fallback_location: logged_exception_path(@exception), notice: "Comment added" } format.json { render json: { status: "ok", comments_count: @exception.comments_count } } end end |
#assign ⇒ Object
POST /rails_nexus/logged_exceptions/:id/assign
6 7 8 9 10 11 12 13 |
# File 'app/controllers/rails_nexus/workflow_controller.rb', line 6 def assign @exception.assign_to(params[:assigned_to], author: ) respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace("workflow-panel", partial: "rails_nexus/logged_exceptions/workflow_panel", locals: { exception: @exception }) } format.html { redirect_back fallback_location: logged_exception_path(@exception), notice: "Assigned to #{params[:assigned_to]}" } format.json { render json: { status: "ok", assigned_to: @exception.assigned_to } } end end |
#mute ⇒ Object
POST /rails_nexus/logged_exceptions/:id/mute
37 38 39 40 41 42 43 44 |
# File 'app/controllers/rails_nexus/workflow_controller.rb', line 37 def mute @exception.mute!(author: ) respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace("workflow-panel", partial: "rails_nexus/logged_exceptions/workflow_panel", locals: { exception: @exception }) } format.html { redirect_back fallback_location: logged_exception_path(@exception), notice: "Muted" } format.json { render json: { status: "ok", muted: @exception.muted } } end end |
#set_priority ⇒ Object
POST /rails_nexus/logged_exceptions/:id/priority
16 17 18 19 20 21 22 23 |
# File 'app/controllers/rails_nexus/workflow_controller.rb', line 16 def set_priority @exception.set_priority(params[:priority], author: ) respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace("workflow-panel", partial: "rails_nexus/logged_exceptions/workflow_panel", locals: { exception: @exception }) } format.html { redirect_back fallback_location: logged_exception_path(@exception), notice: "Priority set to #{params[:priority]}" } format.json { render json: { status: "ok", priority: @exception.priority } } end end |
#snooze ⇒ Object
POST /rails_nexus/logged_exceptions/:id/snooze
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/rails_nexus/workflow_controller.rb', line 26 def snooze duration = parse_duration(params[:duration]) @exception.snooze(duration, author: ) respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace("workflow-panel", partial: "rails_nexus/logged_exceptions/workflow_panel", locals: { exception: @exception }) } format.html { redirect_back fallback_location: logged_exception_path(@exception), notice: "Snoozed for #{duration.inspect}" } format.json { render json: { status: "ok", snoozed_until: @exception.snoozed_until } } end end |
#unmute ⇒ Object
POST /rails_nexus/logged_exceptions/:id/unmute
47 48 49 50 51 52 53 54 |
# File 'app/controllers/rails_nexus/workflow_controller.rb', line 47 def unmute @exception.unmute!(author: ) respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace("workflow-panel", partial: "rails_nexus/logged_exceptions/workflow_panel", locals: { exception: @exception }) } format.html { redirect_back fallback_location: logged_exception_path(@exception), notice: "Unmuted" } format.json { render json: { status: "ok", muted: @exception.muted } } end end |