Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add buttons to event show page #3276

Merged
merged 3 commits into from
Jun 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
end

def redirect_back(fallback_path, **args)
super(fallback_location: fallback_path, **args)
super(fallback_location: fallback_path, allow_other_host: false, **args)
end

protected
Expand Down
9 changes: 7 additions & 2 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class EventsController < ApplicationController
before_action :load_event, except: :index
before_action :load_event, except: [:index, :show]

def index
if params[:agent_id]
Expand All @@ -17,7 +17,12 @@ def index

def show
respond_to do |format|
format.html
format.html do
load_event
rescue ActiveRecord::RecordNotFound
return_to = params[:return] or raise
redirect_to return_to, allow_other_host: false
end
format.json { render json: @event }
end
end
Expand Down
2 changes: 2 additions & 0 deletions app/views/events/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
<br />
<div class="btn-group">
<%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, filtered_agent_return_link || events_path, class: "btn btn-default" %>
<%= link_to icon_tag('glyphicon-refresh') + ' Re-emit', reemit_event_path(@event), method: :post, data: { confirm: 'Are you sure you want to duplicate this event and emit the new one now?' }, class: "btn btn-default" %>
<%= link_to icon_tag('glyphicon-remove', class: 'color-danger') + ' Delete', event_path(@event), method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-default" %>
</div>
</div>
</div>
Expand Down