Skip to content

Commit

Permalink
feat(frontend): New Homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
scouillard committed Feb 13, 2020
1 parent 9a85461 commit 65fc476
Show file tree
Hide file tree
Showing 27 changed files with 272 additions and 155 deletions.
3 changes: 2 additions & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class LoginController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/';


/**
* Create a new controller instance.
Expand Down
12 changes: 10 additions & 2 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers\Auth;

use App\Profile;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;
Expand All @@ -28,7 +29,7 @@ class RegisterController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/';

/**
* Create a new controller instance.
Expand Down Expand Up @@ -63,10 +64,17 @@ protected function validator(array $data)
*/
protected function create(array $data)
{
return User::create([
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);


Profile::create([
'user_id' => $user->id
]);

return $user;
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/';

/**
* Create a new controller instance.
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/VerificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class VerificationController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/';

/**
* Create a new controller instance.
Expand Down
4 changes: 1 addition & 3 deletions app/Http/Controllers/ProfilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ class ProfilesController extends Controller
{
public function index($user)
{

$user = User::find($user);

$user = User::findOrFail($user);

return view('home', [
'user' => $user,
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Middleware;

use App\User;
use Closure;
use Illuminate\Support\Facades\Auth;

Expand All @@ -18,7 +19,7 @@ class RedirectIfAuthenticated
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/home');
return redirect('/profile/' . auth()->user()->id);
}

return $next($request);
Expand Down
93 changes: 93 additions & 0 deletions app/Policies/ProfilePolicy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php

namespace App\Policies;

use App\User;
use App\Profile;
use Illuminate\Auth\Access\HandlesAuthorization;

class ProfilePolicy
{
use HandlesAuthorization;

/**
* Determine whether the user can view any profiles.
*
* @param \App\User $user
* @return mixed
*/
public function viewAny(User $user)
{
//
}

/**
* Determine whether the user can view the profile.
*
* @param \App\User $user
* @param \App\Profile $profile
* @return mixed
*/
public function view(User $user, Profile $profile)
{
//
}

/**
* Determine whether the user can create profiles.
*
* @param \App\User $user
* @return mixed
*/
public function create(User $user)
{
//
}

/**
* Determine whether the user can update the profile.
*
* @param \App\User $user
* @param \App\Profile $profile
* @return mixed
*/
public function update(User $user, Profile $profile)
{
return $user->id == $profile->user_id;
}
/**
* Determine whether the user can delete the profile.
*
* @param \App\User $user
* @param \App\Profile $profile
* @return mixed
*/
public function delete(User $user, Profile $profile)
{
//
}

/**
* Determine whether the user can restore the profile.
*
* @param \App\User $user
* @param \App\Profile $profile
* @return mixed
*/
public function restore(User $user, Profile $profile)
{
//
}

/**
* Determine whether the user can permanently delete the profile.
*
* @param \App\User $user
* @param \App\Profile $profile
* @return mixed
*/
public function forceDelete(User $user, Profile $profile)
{
//
}
}
5 changes: 5 additions & 0 deletions app/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
class Profile extends Model
{

protected $fillable = [
'user_id',
];


public function profile() {
return $this->belongsTo(User::class);
}
Expand Down
3 changes: 2 additions & 1 deletion app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
'name', 'email', 'password','profile_id'
];


/**
* The attributes that should be hidden for arrays.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ public function up()
$table->string('name')->nullable();
$table->text('description')->nullable();
$table->string('image')->nullable();
$table->string('ingredient')->nullable();
$table->string('instruction')->nullable();
$table->text('ingredient')->nullable();
$table->text('instruction')->nullable();
$table->float('rating')->nullable();
$table->integer('spiciness')->nullable();
$table->integer('serving')->nullable();
$table->integer('time')->nullable();
$table->index('user_id');
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public function up()
$table->bigIncrements('id');
$table->timestamps();

$table->string('image')->nullable();

$table->unsignedBigInteger('user_id');
$table->index('user_id');
});
Expand Down
42 changes: 42 additions & 0 deletions public/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -17280,6 +17280,7 @@ readers do not read off random characters that represent icons */
background-color: #cf0c0c;
font-weight: 600;
color: white;
border-radius: 10px;
}

.primary_button:hover {
Expand All @@ -17288,13 +17289,54 @@ readers do not read off random characters that represent icons */

.navbar {
background-color: black !important;
height: 80px !important;
max-height: 80px !important;
}

pre {
white-space: pre-wrap !important;
overflow-wrap: break-word;
}

.is-full-height {
height: calc(100vh - 80px);
}

.homepage {
background-image: url(/images/mychili.jpg?1fd168981d3eba1f7dec319235816e67);
}

.homepage .primary_button {
width: 350px;
height: 80px;
font-size: 32px;
line-height: 64px;
weight: 600;
text-align: center;
}

.homepage .homepage_jumbotron_wrapper {
position: relative;
height: 100%;
text-align: center;
}

.homepage .homepage_jumbotron_wrapper .homepage_jumbotron {
position: absolute;
top: 20%;
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
}

.homepage .homepage_jumbotron_wrapper img {
width: 800px;
display: block;
margin-right: auto;
margin-left: auto;
margin-bottom: 50px;
}

.user_header {
border-bottom: 2px solid black;
padding-bottom: 50px;
Expand Down
Binary file added public/images/mychili.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions resources/sass/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
background-color: $primary;
font-weight: 600;
color: white;
border-radius: 10px;

&:hover{
color: white;
Expand All @@ -23,10 +24,17 @@

.navbar {
background-color: black !important;
height: $navbar-height;
max-height: $navbar-height;
}

pre {
white-space: pre-wrap !important;
overflow-wrap: break-word;
// text-align: left;
}

//why is this not accepting the navbar-height variable??
.is-full-height {
height: calc(100vh - 80px);
}
39 changes: 39 additions & 0 deletions resources/sass/_homepage.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@


.homepage {
background-image: url("mychili.jpg");

.primary_button {
width: 350px;
height: 80px;
font-size: 32px;
line-height: 64px;
weight: 600;
text-align: center;
}

.homepage_jumbotron_wrapper{
position:relative;
height:100%;
text-align: center;

.homepage_jumbotron {
position: absolute;
top: 20%;
left: 50%;
transform: translateX(-50%);
}

img {
width: 800px;
display: block;
margin-right: auto;
margin-left: auto;
margin-bottom: 50px;

}

}


}
2 changes: 2 additions & 0 deletions resources/sass/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ $cyan: #6cb2eb;

// THEME
$primary: #cf0c0c;

$navbar-height: 80px !important;
2 changes: 2 additions & 0 deletions resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@extends('layouts.app')

@section('content')
<div class="py-4">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
Expand Down Expand Up @@ -70,4 +71,5 @@
</div>
</div>
</div>
</div>
@endsection
2 changes: 2 additions & 0 deletions resources/views/auth/passwords/email.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@extends('layouts.app')

@section('content')
<div class="py-4">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
Expand Down Expand Up @@ -44,4 +45,5 @@
</div>
</div>
</div>
</div>
@endsection
Loading

0 comments on commit 65fc476

Please sign in to comment.