User profile can be updated by clicking on profile picture

This commit is contained in:
James Brooks
2014-12-21 10:14:58 +00:00
parent c84217d5be
commit feb7dfea84
5 changed files with 73 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
<?php
class DashUserController extends Controller
{
/**
* Shows the user view.
* @return \Illuminate\View\View
*/
public function showUser()
{
return View::make('dashboard.user')->with([
'pageTitle' => 'User - Dashboard',
]);
}
/**
* Updates the statsu page user.
* @return \Illuminate\View\View
*/
public function postUser()
{
$items = Input::all();
$updated = Auth::user()->update($items);
return Redirect::back()->with('updated', $updated);
}
}

View File

@@ -43,5 +43,6 @@ return [
'notifications' => 'Notifications',
'toggle_navigation' => 'Toggle Navigation',
'search' => 'Search...',
'user' => 'User',
],
];

View File

@@ -28,4 +28,8 @@ Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function () {
// Settings
Route::get('settings', ['as' => 'dashboard.settings', 'uses' => 'DashSettingsController@showSettings']);
Route::post('settings', 'DashSettingsController@postSettings');
// User Settings
Route::get('user', ['as' => 'dashboard.user', 'uses' => 'DashUserController@showUser']);
Route::post('user', 'DashUserController@postUser');
});

View File

@@ -0,0 +1,39 @@
@extends('layout.dashboard')
@section('content')
<div class="header">
<i class="fa fa-user"></i> {{ Lang::get('cachet.dashboard.user') }}
</div>
<div class="row">
<div class="col-sm-12">
@if($updated = Session::get('updated'))
<div class='alert alert-{{ $updated ? "success" : "danger" }}'>
@if($updated)
<strong>Awesome.</strong> Profile updated.
@else
<strong>Whoops.</strong> Something went wrong when updating.
@endif
</div>
@endif
<form name='UserForm' class='form-vertical' role='form' action='/dashboard/user' method='POST'>
<fieldset>
<div class='form-group'>
<label>Username</label>
<input type='text' class='form-control' name='username' value='{{ Auth::user()->username }}' required />
</div>
<div class='form-group'>
<label>Email Address</label>
<input type='email' class='form-control' name='email' value='{{ Auth::user()->email }}' required />
</div>
<div class='form-group'>
<label>Password</label>
<input type='password' class='form-control' name='password' value='' />
</div>
</fieldset>
<button type="submit" class="btn btn-primary">Update profile</button>
</form>
</div>
</div>
@stop

View File

@@ -3,7 +3,7 @@
<div class='sidebar-inner'>
<div class="profile">
<div class="avatar pull-left">
<a href="{{ URL::to('settings') }}">
<a href="{{ URL::to('dashboard/user') }}">
<img src="{{ Auth::user()->gravatar }}" alt="">
</a>
</div>