From ef3e30dbb8184518c5b3f19e7efdd6e51439022f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 19 Jun 2019 14:30:33 -0600 Subject: [PATCH 01/13] Update PageController --- app/Http/Controllers/PageController.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index f1e78d7f9..101f981b2 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -50,4 +50,29 @@ class PageController extends Controller $page->save(); return response()->json(['msg' => 200]); } + + public function generatePage(Request $request) + { + $this->validate($request, [ + 'page' => 'required|string|in:about,terms,privacy', + ]); + + $page = $request->input('page'); + + switch ($page) { + case 'about': + Page::firstOrCreate(['slug' => '/site/about']); + break; + + case 'privacy': + Page::firstOrCreate(['slug' => '/site/privacy']); + break; + + case 'terms': + Page::firstOrCreate(['slug' => '/site/terms']); + break; + } + + return redirect(route('admin.settings.pages')); + } } From 718375aaedb7fcdd206da477dbe9e4aaeebc83d5 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 19 Jun 2019 14:31:00 -0600 Subject: [PATCH 02/13] Update admin pages view --- resources/views/admin/pages/home.blade.php | 52 ++++++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/resources/views/admin/pages/home.blade.php b/resources/views/admin/pages/home.blade.php index 9bd2b9a93..dc597d413 100644 --- a/resources/views/admin/pages/home.blade.php +++ b/resources/views/admin/pages/home.blade.php @@ -8,10 +8,11 @@

Set custom page content


-

+ {{--

Feature Unavailable: This feature will be released in a future version. -

- {{--
+

--}} + @if($pages->count()) +
@@ -45,5 +46,48 @@
{{$pages->links()}} -
--}} + +
+
+
+ @csrf + + + +
+ @csrf + + + +
+ @csrf + + + +
+ @else +
+
+

No custom pages found

+
+
+
+
+
+ @csrf + + + +
+ @csrf + + + +
+ @csrf + + + +
+ @endif @endsection \ No newline at end of file From 79524a057803781c9c344e5eabe003a39a5f5928 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 19 Jun 2019 14:31:14 -0600 Subject: [PATCH 03/13] Update web routes --- routes/web.php | 1 + 1 file changed, 1 insertion(+) diff --git a/routes/web.php b/routes/web.php index d42e34ada..c82adba38 100644 --- a/routes/web.php +++ b/routes/web.php @@ -27,6 +27,7 @@ Route::domain(config('pixelfed.domain.admin'))->prefix('i/admin')->group(functio Route::get('settings/pages', 'AdminController@settingsPages')->name('admin.settings.pages'); Route::get('settings/pages/edit', 'PageController@edit')->name('admin.settings.pages.edit'); Route::post('settings/pages/edit', 'PageController@store'); + Route::post('settings/pages/create', 'PageController@generatePage'); Route::get('settings/maintenance', 'AdminController@settingsMaintenance')->name('admin.settings.maintenance'); Route::get('settings/backups', 'AdminController@settingsBackups')->name('admin.settings.backups'); Route::get('settings/storage', 'AdminController@settingsStorage')->name('admin.settings.storage'); From 13ceef0f9e6a207a07e86470120047c010b6760c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 19 Jun 2019 19:49:17 -0600 Subject: [PATCH 04/13] Update SiteController --- app/Http/Controllers/SiteController.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index d7f158dca..c89077606 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -42,14 +42,19 @@ class SiteController extends Controller public function about() { - $stats = Cache::remember('site:about', now()->addMinutes(120), function() { - return [ + return Cache::remember('site:about', now()->addMinutes(120), function() { + $page = Page::whereSlug('/site/about')->whereActive(true)->first(); + $stats = [ 'posts' => Status::whereLocal(true)->count(), 'users' => User::count(), 'admin' => User::whereIsAdmin(true)->first() ]; + if($page) { + return View::make('site.about-custom')->with(compact('page', 'stats'))->render(); + } else { + return View::make('site.about')->with(compact('stats'))->render(); + } }); - return view('site.about', compact('stats')); } public function language() From 2fbcd6dbbf8b1cc4b0b8f22e1443fc606c9874c2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 19 Jun 2019 19:51:29 -0600 Subject: [PATCH 05/13] Update about views --- resources/views/site/about-custom.blade.php | 119 ++++++++++ resources/views/site/about.blade.php | 233 ++++++++++---------- 2 files changed, 235 insertions(+), 117 deletions(-) create mode 100644 resources/views/site/about-custom.blade.php diff --git a/resources/views/site/about-custom.blade.php b/resources/views/site/about-custom.blade.php new file mode 100644 index 000000000..615c2e067 --- /dev/null +++ b/resources/views/site/about-custom.blade.php @@ -0,0 +1,119 @@ +@extends('layouts.anon') + +@section('content') +
+
+

About

+

{{$page->title ?? 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.'}}

+
+
+
+
+
+
+ {!! $page->content !!} +
+
+
+
+
+

{{$stats['posts']}}

+

Posts

+
+
+ +
+
+

{{$stats['users']}}

+

Users

+
+
+ + @if($stats['admin']) +
+
+

+ + @{{$stats['admin']->username}} + +

+

Instance Admin

+
+
+ @endif +
+
+
+
+
+
+
+
+
+
+
+

+ Ad Free +

+

No Ads or Trackers

+
+
+
+
+
+
+

+ Chronological +

+

Timelines in order

+
+
+
+
+
+
+

+ Federated +

+

A network of millions

+
+
+
+
+
+
+

+ Discover +

+

Discover popular posts

+
+
+
+
+
+
+

+ Photo Filters +

+

Add an optional filter

+
+
+
+
+
+
+

+ Stories +

+

Coming Soon!

+
+
+
+
+
+
+@endsection + +@push('meta') + +@endpush \ No newline at end of file diff --git a/resources/views/site/about.blade.php b/resources/views/site/about.blade.php index 502e97cfc..04f505118 100644 --- a/resources/views/site/about.blade.php +++ b/resources/views/site/about.blade.php @@ -2,134 +2,133 @@ @section('content')
-
-

About

-

Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.

-
+
+

About

+

Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.

+
-
-
- - - username - -
-
- -
- -
-
-
-
-

{{$stats['posts']}}

-

Posts

-
-
+
+
+ + + username + +
+
+ +
+ +
+
+
+
+

{{$stats['posts']}}

+

Posts

+
+
-
-
-

{{$stats['users']}}

-

Users

-
-
+
+
+

{{$stats['users']}}

+

Users

+
+
- @if($stats['admin']) -
-
-

- - @{{$stats['admin']->username}} - -

-

Instance Admin

-
-
- @endif -
+ @if($stats['admin']) +
+
+

+ + @{{$stats['admin']->username}} + +

+

Instance Admin

+
+
+ @endif +
-
-
-
-
-
-

- Ad Free -

-

No Ads or Trackers

-
-
-
-
-
-
-

- Chronological -

-

Timelines in order

-
-
-
-
-
-
-

- Federated -

-

A network of millions

-
-
-
-
-
-
-

- Discover -

-

Discover popular posts

-
-
-
-
-
-
-

- Photo Filters -

-

Add an optional filter

-
-
-
-
-
-
-

- Stories -

-

Coming Soon!

-
-
-
-
+
+
+
+
+

+ Ad Free +

+

No Ads or Trackers

+
+
+
+
+
+
+

+ Chronological +

+

Timelines in order

+
+
+
+
+
+
+

+ Federated +

+

A network of millions

+
+
+
+
+
+
+

+ Discover +

+

Discover popular posts

+
+
+
+
+
+
+

+ Photo Filters +

+

Add an optional filter

+
+
+
+
+
+
+

+ Stories +

+

Coming Soon!

+
+
+
+
@endsection From bb207a42bd97dece8e46bc07e65a8798a5b77a4c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 19 Jun 2019 20:53:40 -0600 Subject: [PATCH 06/13] Update custom page views --- resources/views/site/privacy.blade.php | 9 ++++++++- resources/views/site/terms.blade.php | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/resources/views/site/privacy.blade.php b/resources/views/site/privacy.blade.php index d820f819c..ceed0eadf 100644 --- a/resources/views/site/privacy.blade.php +++ b/resources/views/site/privacy.blade.php @@ -2,6 +2,13 @@ @section('section') + @if($page && $page->content) +
+

Privacy Policy

+
+
+ {!! $page->content !!} + @else

Privacy Policy

@@ -81,7 +88,7 @@

Originally adapted from the Mastodon privacy policy.

- + @endif @endsection @push('meta') diff --git a/resources/views/site/terms.blade.php b/resources/views/site/terms.blade.php index 341388d6f..6ede08305 100644 --- a/resources/views/site/terms.blade.php +++ b/resources/views/site/terms.blade.php @@ -2,6 +2,13 @@ @section('section') + @if($page && $page->content) +
+

Terms Of Use

+
+
+ {!! $page->content !!} + @else

Terms Of Use

@@ -38,7 +45,7 @@

These terms and conditions are governed by and construed in accordance with the laws of Canada and you irrevocably submit to the exclusive jurisdiction of the courts in that State or location.

9. Additional Rules

This website does not have any additional rules.

- + @endif @endsection @push('meta') From ef07e31d9a09e2eb0fd7dd7faa04565fba335de6 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 19 Jun 2019 20:54:01 -0600 Subject: [PATCH 07/13] Update admin page edit view --- resources/views/admin/pages/edit.blade.php | 32 +++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/resources/views/admin/pages/edit.blade.php b/resources/views/admin/pages/edit.blade.php index bf9033045..b47dfcf4b 100644 --- a/resources/views/admin/pages/edit.blade.php +++ b/resources/views/admin/pages/edit.blade.php @@ -14,7 +14,7 @@

Page URL: {{$page->url()}} - Edit + {{-- Edit --}}

{!!$page->content!!} @@ -25,10 +25,11 @@ active?'checked="true"':''}}>
- Set Expire Date + {{-- Set Expire Date --}}
- Preview + {{-- Preview --}} + Delete Save
@@ -37,7 +38,7 @@ @endsection @push('styles') - + @endpush @push('scripts') - - + -