Skip to content

Commit

Permalink
Merge pull request #294 from Vatsim-Scandinavia/topic/patch-v2.0.2
Browse files Browse the repository at this point in the history
Topic/patch v2.0.2
  • Loading branch information
blt950 authored Mar 6, 2021
2 parents 2297737 + b94e0fa commit 3f3736e
Show file tree
Hide file tree
Showing 24 changed files with 109 additions and 103 deletions.
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion app/Http/Controllers/TrainingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TrainingController extends Controller
public static $types = [
1 => ["text" => "Standard", "icon" => "fas fa-circle"],
2 => ["text" => "Refresh", "icon" => "fas fa-sync"],
3 => ["text" => "Transfer", "icon" => "fas fa-exchange"],
3 => ["text" => "Transfer", "icon" => "fas fa-exchange-alt"],
4 => ["text" => "Fast-track", "icon" => "fas fa-fast-forward"],
5 => ["text" => "Familiarisation", "icon" => "fas fa-compress-arrows-alt"],
];
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/VoteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function store(Request $request)
'expire_date' => 'required|date_format:d/m/Y|after_or_equal:today',
'expire_time' => 'required|regex:/^\d{2}:\d{2}$/',
'require_active' => '',
'require_member' => '',
'require_our_member' => '',
'question' => 'required|string',
'vote_options' => 'required|string'
]);
Expand All @@ -69,14 +69,14 @@ public function store(Request $request)

// Only ATC active can vote ticked?
isset($data['require_active']) ? $require_active = true : $require_active = false;
isset($data['require_member']) ? $require_member = true : $require_member = false;
isset($data['require_our_member']) ? $require_our_member = true : $require_our_member = false;

// Store the new data
$vote = new Vote();

$vote->question = $data['question'];
$vote->require_active = $require_active;
$vote->require_member = $require_member;
$vote->require_our_member = $require_our_member;
$vote->closed = false;
$vote->end_at = $expire->format('Y-m-d H:i:s');;

Expand Down
9 changes: 2 additions & 7 deletions app/Policies/TrainingExaminationPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ public function view(User $user, TrainingExamination $examination)
*/
public function create(User $user)
{
if (($key = session()->get('onetimekey')) != null) {
$link = OneTimeLink::where('key', $key)->get()->first();

return $link != null && $user->isMentorOrAbove($link->training->area);
}

return $user->isMentorOrAbove();
// We use TrainingPolicy-createExamination instead, so this should always return false.
return false;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/Policies/TrainingPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ public function viewReports(User $user, Training $training)
public function createReport(User $user, Training $training)
{
if (($link = $this->getOneTimeLink($training)) != null) {
return $user->isMentor($link->training->area);
return $user->isModerator($link->training->area) || $user->isMentor($link->training->area);
}

// Check if mentor is mentoring area, not filling their own training and the training is in progress
return $training->mentors->contains($user) && $user->isNot($training->user);
return $user->isModerator($training->area) || ($training->mentors->contains($user) && $user->isNot($training->user));
}

public function createExamination(User $user, Training $training)
Expand Down
9 changes: 2 additions & 7 deletions app/Policies/TrainingReportPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,8 @@ public function view(User $user, TrainingReport $trainingReport)
*/
public function create(User $user)
{
if (($key = session()->get('onetimekey')) != null) {
$link = OneTimeLink::where('key', $key)->get()->first();

return $link != null && $user->isMentor($link->training->area);
}

return $user->isMentor();
// We use TrainingPolicy-createReport instead, so this should always return false.
return false;
}

/**
Expand Down
11 changes: 11 additions & 0 deletions app/Policies/UserPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ public function view(User $user, User $model)
return $user->is($model) || $user->isModeratorOrAbove() || $user->isTeaching($model);
}

/**
* Determine whether the user can view the access table.
*
* @param \App\Models\User $user
* @return bool
*/
public function viewAccess(User $user)
{
return $user->isModeratorOrAbove();
}

/**
* Determine whether the user can update the model.
*
Expand Down
2 changes: 1 addition & 1 deletion app/Policies/VotePolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function vote(User $user, Vote $vote)
return Response::deny("The vote closed and concluded at ".Carbon::create($vote->end_at)->toEuropeanDateTime());
}

if ($vote->require_member) {
if ($vote->require_our_member) {
if($user->subdivision != Config::get('app.owner_short')) return Response::deny("Sorry, you do not qualify to participate in this vote. You must belong to ".Config::get('app.owner')." subdivision to vote.");
}

Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
|
*/

'version' => "2.0.1",
'version' => "2.0.2",

/*
|--------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
"@fortawesome/fontawesome-pro": "^5.15.2",
"@fortawesome/fontawesome-free": "^5.15.2",
"axios": "^0.21.1",
"bootstrap": "4.3.1",
"bootstrap-table": "^1.18.2",
Expand Down
1 change: 1 addition & 0 deletions public/images/radar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/sass/_cards.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
line-height: 51px;
font-weight: 900;
content: "\f107";
font-family: "Font Awesome 5 Pro";
font-family: "Font Awesome 5 Free";
color: $gray-400;
}
&.collapsed {
Expand Down
2 changes: 1 addition & 1 deletion resources/sass/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ p {
line-height: 0;

img {
height: 78px;
height: 48px;
}

@include media-breakpoint-down(sm) {
Expand Down
4 changes: 2 additions & 2 deletions resources/sass/navs/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
vertical-align: 0;
border: 0;
font-weight: 900;
content: "\f105";
font-family: "Font Awesome 5 Pro";
content: "\f054";
font-family: "Font Awesome 5 Free";
}
}
&.show {
Expand Down
23 changes: 13 additions & 10 deletions resources/sass/navs/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
&::after {
font-weight: 900;
content: "\f104";
font-family: "Font Awesome 5 Pro";
font-family: "Font Awesome 5 Free";
margin-right: 0.1rem;
}
&:hover {
Expand All @@ -104,8 +104,8 @@
width: 0 !important;
overflow: hidden;
#sidebarToggle::after {
content: "\f105";
font-family: "Font Awesome 5 Pro";
content: "\f105 ";
font-family: "Font Awesome 5 Free";
margin-left: 0.25rem;
}

Expand All @@ -121,8 +121,9 @@
letter-spacing: 0.05rem;
z-index: 1;

.sidebar-brand-icon i {
font-size: 2.1rem;
.sidebar-brand-icon img {
height: 2em;
width: 2em;
}
.sidebar-brand-text {
display: none;
Expand Down Expand Up @@ -219,7 +220,7 @@
border: 0;
font-weight: 900;
content: "\f107";
font-family: "Font Awesome 5 Pro";
font-family: "Font Awesome 5 Free";
}
&.collapsed::after {
content: "\f105";
Expand All @@ -228,8 +229,9 @@
}
}
.sidebar-brand {
.sidebar-brand-icon i {
font-size: 2.1rem;
.sidebar-brand-icon img {
height: 2em;
width: 2em;
}

.sidebar-brand-text {
Expand Down Expand Up @@ -295,8 +297,9 @@
.sidebar-brand {
padding-left: 34px;

.sidebar-brand-icon i {
font-size: 2.1rem;
.sidebar-brand-icon img {
height: 2em;
width: 2em;
}

.sidebar-brand-text {
Expand Down
8 changes: 4 additions & 4 deletions resources/sass/vendor.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// 3rd Party Vendors to include

@import "~@fortawesome/fontawesome-pro/scss/brands";
@import "~@fortawesome/fontawesome-pro/scss/regular";
@import "~@fortawesome/fontawesome-pro/scss/solid";
@import "~@fortawesome/fontawesome-pro/scss/fontawesome";
@import "~@fortawesome/fontawesome-free/scss/brands";
@import "~@fortawesome/fontawesome-free/scss/regular";
@import "~@fortawesome/fontawesome-free/scss/solid";
@import "~@fortawesome/fontawesome-free/scss/fontawesome";

@import "~chart.js/dist/Chart.css";

Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@if($activeVote)
<div class="alert alert-info" role="alert">
<i class="fas fa-box-ballot"></i>&nbsp;&nbsp;Vote <i>"{{ $activeVote->question }}"</i> is available. Vote closes {{ \Carbon\Carbon::create($activeVote->end_at)->toEuropeanDateTime() }}. <a href="{{ route('vote.show', $activeVote) }}">Click here to vote</a>.
<i class="fas fa-vote-yea"></i>&nbsp;&nbsp;Vote <i>"{{ $activeVote->question }}"</i> is available. Vote closes {{ \Carbon\Carbon::create($activeVote->end_at)->toEuropeanDateTime() }}. <a href="{{ route('vote.show', $activeVote) }}">Click here to vote</a>.
</div>
@endif

Expand Down
2 changes: 1 addition & 1 deletion resources/views/front.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>
@endif

<div class="content-title"><i class="far fa-radar"></i> {{ config('app.name') }}</div>
<div class="content-title"><img src="{{ asset('images/radar.svg') }}"> {{ config('app.name') }}</div>
<div class="content-description">
@if(Config::get('app.owner_short') == 'SCA')
Scandinavian Training Administration
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- Sidebar - Brand -->
<a class="sidebar-brand d-flex align-items-center" href="{{ route('dashboard') }}">
<div class="sidebar-brand-icon">
<i class="far fa-radar"></i>
<img src="{{ asset('images/radar.svg') }}">
</div>

<div class="sidebar-brand-text mx-3">{{ config('app.name') }}</div>
Expand Down
18 changes: 9 additions & 9 deletions resources/views/training/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
<div class="card-header p-0">
<h5 class="mb-0 bg-lightorange">
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#{{ $uuid }}" aria-expanded="true">
<i class="far fa-plus mr-2"></i>{{ $examination->examination_date->toEuropeanDate() }}
<i class="fas fa-fw fa-chevron-right mr-2"></i>{{ $examination->examination_date->toEuropeanDate() }}
</button>
</h5>
</div>
Expand All @@ -201,7 +201,7 @@

<small class="text-muted">
@if(isset($examination->position))
<i class="fas fa-radar"></i> {{ \App\Models\Position::find($examination->position_id)->callsign }}&emsp;
<i class="fas fa-map-marker-alt"></i> {{ \App\Models\Position::find($examination->position_id)->callsign }}&emsp;
@endif
<i class="fas fa-user-edit"></i> {{ isset(\App\Models\User::find($examination->examiner_id)->name) ? \App\Models\User::find($examination->examiner_id)->name : "Unknown" }}

Expand Down Expand Up @@ -247,7 +247,7 @@
<div class="card-header p-0">
<h5 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#{{ $uuid }}" aria-expanded="true">
<i class="far fa-plus mr-2"></i>{{ $report->report_date->toEuropeanDate() }}
<i class="fas fa-fw fa-chevron-right mr-2"></i>{{ $report->report_date->toEuropeanDate() }}
@if($report->draft)
<span class='badge badge-danger'>Draft</span>
@endif
Expand All @@ -260,7 +260,7 @@

<small class="text-muted">
@if(isset($report->position))
<i class="fas fa-radar"></i> {{ $report->position }}&emsp;
<i class="fas fa-map-marker-alt"></i> {{ $report->position }}&emsp;
@endif
<i class="fas fa-user-edit"></i> {{ isset(\App\Models\User::find($report->written_by_id)->name) ? \App\Models\User::find($report->written_by_id)->name : "Unknown" }}
@can('update', $report)
Expand Down Expand Up @@ -323,11 +323,11 @@
@if($training->english_only_training)
<i class="fas fa-flag-usa"></i>&nbsp;&nbsp;Requesting training in English only<br>
@else
<i class="fas fa-flag-alt"></i>&nbsp;&nbsp;Requesting training in local language or English<br>
<i class="fas fa-flag"></i>&nbsp;&nbsp;Requesting training in local language or English<br>
@endif

@isset($training->experience)
<i class="fas fa-books"></i>&nbsp;&nbsp;{{ $experiences[$training->experience]["text"] }}
<i class="fas fa-book"></i>&nbsp;&nbsp;{{ $experiences[$training->experience]["text"] }}
@endisset

</div>
Expand Down Expand Up @@ -559,14 +559,14 @@
$(document).ready(function(){
// Add minus icon for collapse element which is open by default
$(".collapse.show").each(function(){
$(this).prev(".card-header").find(".far").addClass("fa-minus").removeClass("fa-plus");
$(this).prev(".card-header").find(".fas").addClass("fa-chevron-down").removeClass("fa-chevron-right");
});
// Toggle plus minus icon on show hide of collapse element
$(".collapse").on('show.bs.collapse', function(){
$(this).prev(".card-header").find(".far").removeClass("fa-plus").addClass("fa-minus");
$(this).prev(".card-header").find(".fas").removeClass("fa-chevron-right").addClass("fa-chevron-down");
}).on('hide.bs.collapse', function(){
$(this).prev(".card-header").find(".far").removeClass("fa-minus").addClass("fa-plus");
$(this).prev(".card-header").find(".fas").removeClass("fa-chevron-down").addClass("fa-chevron-right");
});
// Closure reason input
Expand Down
Loading

0 comments on commit 3f3736e

Please sign in to comment.