mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-04-28 15:14:06 +08:00
Fixed some bugs and added a proper home page
This commit is contained in:
parent
5d9d096028
commit
732f3a9986
43
app/Http/Controllers/HomeController.php
Normal file
43
app/Http/Controllers/HomeController.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Oxbow\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
use Oxbow\Http\Requests;
|
||||||
|
use Oxbow\Http\Controllers\Controller;
|
||||||
|
use Oxbow\Repos\BookRepo;
|
||||||
|
use Oxbow\Services\ActivityService;
|
||||||
|
use Oxbow\Services\Facades\Activity;
|
||||||
|
|
||||||
|
class HomeController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $activityService;
|
||||||
|
protected $bookRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HomeController constructor.
|
||||||
|
* @param ActivityService $activityService
|
||||||
|
* @param BookRepo $bookRepo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityService $activityService, BookRepo $bookRepo)
|
||||||
|
{
|
||||||
|
$this->activityService = $activityService;
|
||||||
|
$this->bookRepo = $bookRepo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the homepage.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$books = $this->bookRepo->getAll();
|
||||||
|
$activity = $this->activityService->latest();
|
||||||
|
return view('home', ['books' => $books, 'activity' => $activity]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -79,12 +79,9 @@ Route::group(['middleware' => 'auth'], function() {
|
|||||||
// Search
|
// Search
|
||||||
Route::get('/pages/search/all', 'PageController@searchAll');
|
Route::get('/pages/search/all', 'PageController@searchAll');
|
||||||
|
|
||||||
Route::get('/', function () {
|
// Other Pages
|
||||||
return view('home');
|
Route::get('/', 'HomeController@index');
|
||||||
});
|
Route::get('/home', 'HomeController@index');
|
||||||
Route::get('/home', function () {
|
|
||||||
return view('home');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,6 @@ class ActivityService
|
|||||||
$this->user = Auth::user();
|
$this->user = Auth::user();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add activity data to database.
|
* Add activity data to database.
|
||||||
* @para Entity $entity
|
* @para Entity $entity
|
||||||
@ -54,4 +53,15 @@ class ActivityService
|
|||||||
$this->activity->save();
|
$this->activity->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest activity.
|
||||||
|
* @param int $count
|
||||||
|
* @param int $page
|
||||||
|
*/
|
||||||
|
public function latest($count = 20, $page = 0)
|
||||||
|
{
|
||||||
|
return $this->activity->orderBy('created_at', 'desc')
|
||||||
|
->skip($count*$page)->take($count)->get();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -18,6 +18,7 @@
|
|||||||
"tinymce-dist": "~4.2.1",
|
"tinymce-dist": "~4.2.1",
|
||||||
"bootstrap": "~3.3.5",
|
"bootstrap": "~3.3.5",
|
||||||
"jquery-sortable": "~0.9.13",
|
"jquery-sortable": "~0.9.13",
|
||||||
"material-design-iconic-font": "~2.1.1"
|
"material-design-iconic-font": "~2.1.1",
|
||||||
|
"vue": "~0.12.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"laravel-elixir-livereload": "0.0.3"
|
"laravel-elixir-livereload": "0.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"laravel-elixir": "^2.0.0",
|
"bootstrap-sass": "^3.0.0",
|
||||||
"bootstrap-sass": "^3.0.0"
|
"laravel-elixir": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,13 @@ header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.logo-container {
|
.logo-container {
|
||||||
padding: $-xl $-s $-l $-s;
|
padding: $-l $-s;
|
||||||
color: #CCC;
|
color: #CCC;
|
||||||
.logo {
|
.logo {
|
||||||
|
display: block;
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-bottom: $-m;
|
padding: $-m 0;
|
||||||
}
|
}
|
||||||
i {
|
i {
|
||||||
padding-right: $-s;
|
padding-right: $-s;
|
||||||
@ -63,11 +64,12 @@ header {
|
|||||||
input {
|
input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
padding: $-s $-m;
|
padding: $-m;
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
border: none;
|
border: none;
|
||||||
border-top: 1px solid #333;
|
border-top: 1px solid #333;
|
||||||
border-bottom: 1px solid #333;
|
border-bottom: 1px solid #333;
|
||||||
|
color: #EEE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,5 +22,6 @@ return [
|
|||||||
'book_create' => 'created book',
|
'book_create' => 'created book',
|
||||||
'book_update' => 'updated book',
|
'book_update' => 'updated book',
|
||||||
'book_delete' => 'deleted book',
|
'book_delete' => 'deleted book',
|
||||||
|
'book_sort' => 'sorted book',
|
||||||
|
|
||||||
];
|
];
|
@ -12,7 +12,7 @@
|
|||||||
<script src="/bower/bootstrap/dist/js/bootstrap.js"></script>
|
<script src="/bower/bootstrap/dist/js/bootstrap.js"></script>
|
||||||
<script src="/bower/jquery-sortable/source/js/jquery-sortable.js"></script>
|
<script src="/bower/jquery-sortable/source/js/jquery-sortable.js"></script>
|
||||||
<script src="/bower/dropzone/dist/min/dropzone.min.js"></script>
|
<script src="/bower/dropzone/dist/min/dropzone.min.js"></script>
|
||||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/vue/0.12.10/vue.min.js"></script>
|
<script src="/bower/vue/dist/vue.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$.fn.smoothScrollTo = function() {
|
$.fn.smoothScrollTo = function() {
|
||||||
if(this.length === 0) return;
|
if(this.length === 0) return;
|
||||||
@ -36,9 +36,8 @@
|
|||||||
<header>
|
<header>
|
||||||
<div class="padded row clearfix">
|
<div class="padded row clearfix">
|
||||||
<div class="col-md-12 logo-container">
|
<div class="col-md-12 logo-container">
|
||||||
{{--<div ><img class="logo float left" src="/bookstack.svg" alt="BookStack"></div>--}}
|
<a href="/" class="logo">BookStack</a>
|
||||||
<div class="logo">BookStack</div>
|
<div><i class="zmdi zmdi-account"></i> {{ Auth::user()->name }}</div>
|
||||||
<div><i class="zmdi zmdi-account"></i> {{ \Illuminate\Support\Facades\Auth::user()->name }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
<div class="col-md-3 col-md-offset-1">
|
<div class="col-md-3 col-md-offset-1">
|
||||||
<div class="margin-top large"><br></div>
|
<div class="margin-top large"><br></div>
|
||||||
<h3>Recent Activity</h3>
|
<h3>Recent Activity</h3>
|
||||||
@include('partials/activity-list', ['entity' => $book])
|
@include('partials/activity-list', ['activity' => $book->recentActivity()])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,15 +1,25 @@
|
|||||||
@extends('base')
|
@extends('base')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div id="container"></div>
|
|
||||||
@stop
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 col-md-offset-1">
|
||||||
|
<div class="page-content">
|
||||||
|
<h2>Books</h2>
|
||||||
|
@foreach($books as $book)
|
||||||
|
<div class="book">
|
||||||
|
<h3><a href="{{$book->getUrl()}}">{{$book->name}}</a></h3>
|
||||||
|
<p class="text-muted">{{$book->description}}</p>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3 col-md-offset-1">
|
||||||
|
<div class="margin-top large"> </div>
|
||||||
|
<h3>Recent Activity</h3>
|
||||||
|
@include('partials/activity-list', ['activity' => $activity])
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@section('bottom')
|
|
||||||
@include('pages/image-manager')
|
|
||||||
<div id="image-manager-container"></div>
|
|
||||||
<script src="/js/image-manager.js"></script>
|
|
||||||
<script>
|
|
||||||
window.ImageManager.show();
|
|
||||||
</script>
|
|
||||||
@stop
|
@stop
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
@section('head')
|
@section('head')
|
||||||
<script src="/bower/tinymce-dist/tinymce.jquery.min.js"></script>
|
<script src="/bower/tinymce-dist/tinymce.jquery.min.js"></script>
|
||||||
<script src="/bower/dropzone/dist/min/dropzone.min.js"></script>
|
|
||||||
<script src="/js/image-manager.js"></script>
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@ -17,4 +15,5 @@
|
|||||||
|
|
||||||
@section('bottom')
|
@section('bottom')
|
||||||
@include('pages/image-manager')
|
@include('pages/image-manager')
|
||||||
|
<script src="/js/image-manager.js"></script>
|
||||||
@stop
|
@stop
|
@ -15,6 +15,5 @@
|
|||||||
|
|
||||||
@section('bottom')
|
@section('bottom')
|
||||||
@include('pages/image-manager')
|
@include('pages/image-manager')
|
||||||
<div id="image-manager-container"></div>
|
|
||||||
<script src="/js/image-manager.js"></script>
|
<script src="/js/image-manager.js"></script>
|
||||||
@stop
|
@stop
|
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
{{--Requires an entity to be passed with the name $entity--}}
|
{{--Requires an entity to be passed with the name $entity--}}
|
||||||
|
|
||||||
@if(count($entity->recentActivity()) > 0)
|
@if(count($activity) > 0)
|
||||||
<div class="activity-list">
|
<div class="activity-list">
|
||||||
@foreach($entity->recentActivity() as $activity)
|
@foreach($activity as $activityItem)
|
||||||
<div class="activity-list-item">
|
<div class="activity-list-item">
|
||||||
@include('partials/activity-item')
|
@include('partials/activity-item', ['activity' => $activityItem])
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user