Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change the publish event link to be a form and use POST instead of ge…
…t so the request can be validated
  • Loading branch information
johannac committed Oct 22, 2021
1 parent 82fc41c commit a2aadf7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/EventController.php
Expand Up @@ -350,7 +350,7 @@ public function postUploadEventImage(Request $request)
* @param Integer|false $event_id
* @return \Illuminate\Http\RedirectResponse
*/
public function makeEventLive($event_id = false) {
public function postMakeEventLive($event_id = false) {
$event = Event::scope()->findOrFail($event_id);
$event->is_live = 1;
$event->save();
Expand Down
6 changes: 4 additions & 2 deletions resources/views/ManageEvent/Partials/TopNav.blade.php
Expand Up @@ -2,12 +2,14 @@
@if(!$event->is_live)
<style>
.sidebar {
top: 43px;
top: 63px;
}
</style>
<div class="alert alert-warning top_of_page_alert">
{{ @trans("ManageEvent.event_not_live") }}
<a href="{{ route('MakeEventLive', ['event_id' => $event->id]) }}">{{ @trans("ManageEvent.publish_it") }}</a>
{!! Form::open(['url' => route('MakeEventLive', ['event_id' => $event->id]), 'id' => 'make-event-live-form', 'style' => 'display:inline-block;']) !!}
{!! Form::submit(trans('ManageEvent.publish_it'), ['class' => 'btn btn-success']) !!}
{!! Form::close() !!}
</div>
@endif
@stop
Expand Down
Expand Up @@ -2,11 +2,10 @@
<section id="goLiveBar">
<div class="container">
@if(!$event->is_live)

{{ @trans("ManageEvent.event_not_live") }}
<a href="{{ route('MakeEventLive' , ['event_id' => $event->id]) }}"
style="background-color: green; border-color: green;"
class="btn btn-success btn-xs">{{ @trans("ManageEvent.publish_it") }}</a>
{{ @trans("ManageEvent.event_not_live") }}
{!! Form::open(['url' => route('MakeEventLive', ['event_id' => $event->id]), 'id' => 'make-event-live-form', 'style' => 'display:inline-block;']) !!}
{!! Form::submit(trans('ManageEvent.publish_it'), ['class' => 'btn btn-success']) !!}
{!! Form::close() !!}
@endif
</div>
</section>
Expand Down
4 changes: 2 additions & 2 deletions routes/web.php
Expand Up @@ -323,8 +323,8 @@
[EventDashboardController::class, 'redirectToDashboard']
);

Route::get('{event_id}/go_live',
[EventController::class, 'makeEventLive']
Route::post('{event_id}/go_live',
[EventController::class, 'postMakeEventLive']
)->name('MakeEventLive');

/*
Expand Down

0 comments on commit a2aadf7

Please sign in to comment.