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 Single Organisation Mode #741

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

# Attendize Variables
SINGLE_ORGANISER_MODE=false
DEFAULT_DATEPICKER_SEPERATOR="-"
DEFAULT_DATEPICKER_FORMAT="yyyy-MM-dd HH:mm"
DEFAULT_DATETIME_FORMAT="Y-m-d H:i"
Expand Down
5 changes: 3 additions & 2 deletions app/Http/Middleware/FirstRunMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Models\Organiser;
use Closure;
use Route;

class FirstRunMiddleware
{
Expand All @@ -21,11 +22,11 @@ public function handle($request, Closure $next)
* If there are no organisers then redirect the user to create one
* else - if there's only one organiser bring the user straight there.
*/
if (Organiser::scope()->count() === 0 && !($request->route()->getName() === 'showCreateOrganiser') && !($request->route()->getName() === 'postCreateOrganiser')) {
if (Organiser::scope()->count() === 0 && Route::has('showCreateOrganiser') && !($request->route()->getName() === 'showCreateOrganiser') && !($request->route()->getName() === 'postCreateOrganiser')) {
return redirect(route('showCreateOrganiser', [
'first_run' => '1',
]));
} elseif (Organiser::scope()->count() === 1 && ($request->route()->getName() === 'showSelectOrganiser')) {
} elseif (Organiser::scope()->count() === 1 && Route::has('showOrganiserDashboard') && ($request->route()->getName() === 'showSelectOrganiser')) {
return redirect(route('showOrganiserDashboard', [
'organiser_id' => Organiser::scope()->first()->id,
]));
Expand Down
1 change: 1 addition & 0 deletions config/attendize.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'fallback_organiser_logo_url' => '/assets/images/logo-dark.png',
'cdn_url' => '',

'single_organiser_mode' => env('SINGLE_ORGANISER_MODE', false),
'checkout_timeout_after' => env('CHECKOUT_TIMEOUT_AFTER', 30), #minutes

'ticket_status_before_sale_date' => 3,
Expand Down
2 changes: 2 additions & 0 deletions resources/views/ManageOrganiser/SelectOrganiser.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ class="list-group-item">
@endforeach
</div>

@if(Route::has('showCreateOrganiser'))
<div style="margin-top:-15px; padding: 10px; text-align: center;">
@lang("Organiser.or_caps")
</div>
<a style="color: white;" href="{{route('showCreateOrganiser')}}" class="btn btn-block btn-success">@lang("Organiser.create_new_organiser")</a>
@endif
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions resources/views/Shared/Layouts/Master.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@


<ul class="dropdown-menu" role="menu">
@if(Route::has('showCreateOrganiser'))
<li>
<a href="{{route('showCreateOrganiser')}}">
<i class="ico ico-plus"></i>
@lang("Top.create_organiser")
</a>
</li>
@endif
@foreach($organisers as $org)
<li>
<a href="{{route('showOrganiserDashboard', ['organiser_id' => $org->id])}}">
Expand Down
46 changes: 29 additions & 17 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,25 @@
/*
* Registration / Account creation
*/
Route::get('/signup',
[UserSignupController::class, 'showSignup']
)->name('showSignup');
// true if not in single_organiser_mode or there is no accounts table or if there no accounts
if (!config('attendize.single_organiser_mode')
|| !Schema::hasTable('accounts') ||
(Schema::hasTable('accounts') && DB::table('accounts')->count() == 0)) {

Route::post('/signup',
[UserSignupController::class, 'postSignup']);
Route::get('/signup',
[UserSignupController::class, 'showSignup']
)->name('showSignup');

/*
* Confirm Email
*/
Route::get('signup/confirm_email/{confirmation_code}',
[UserSignupController::class, 'confirmEmail']
)->name('confirmEmail');
Route::post('/signup',
[UserSignupController::class, 'postSignup']);

/*
* Confirm Email
*/
Route::get('signup/confirm_email/{confirmation_code}',
[UserSignupController::class, 'confirmEmail']
)->name('confirmEmail');
}
});

/*
Expand Down Expand Up @@ -268,13 +274,19 @@
[OrganiserCustomizeController::class, 'postEditOrganiser']
)->name('postEditOrganiser');

Route::get('create',
[OrganiserController::class, 'showCreateOrganiser']
)->name('showCreateOrganiser');
// block the creation of additional organisers when in single organiser mode
if (!config('attendize.single_organiser_mode') ||
!Schema::hasTable('accounts') ||
(Schema::hasTable('accounts') && DB::table('accounts')->count() == 0)) {

Route::get('create',
[OrganiserController::class, 'showCreateOrganiser']
)->name('showCreateOrganiser');

Route::post('create',
[OrganiserController::class, 'postCreateOrganiser']
)->name('postCreateOrganiser');
Route::post('create',
[OrganiserController::class, 'postCreateOrganiser']
)->name('postCreateOrganiser');
}

Route::post('{organiser_id}/page_design',
[OrganiserCustomizeController::class, 'postEditOrganiserPageDesign']
Expand Down