Skip to content

Commit

Permalink
Merge branch 'release/v0.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
torralbodavid committed May 1, 2020
2 parents 2533f43 + 9387e63 commit 3c71225
Show file tree
Hide file tree
Showing 35 changed files with 263 additions and 55 deletions.
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,27 @@

All notable changes to `duck-funk-core` will be documented in this file

## 0.4.2 - 2020-05-01

### Added
- New tests for dynamic page development

### Fixed
- Fixed auth tests
- Fixed icon sprites
- Fixed vendor publishing in order to have more than one template.

### Deleted
- Non habbo icons

## 0.4.1 - 2020-04-26

### Added
- Added support for project page controllers.
+ You will be redirected by default to your page slug blade.
+ You can create your PageControllers on the project at `App/App\Http\Controllers\Pages` namespace and with the name `SlugController`.
+ You can create your PageControllers on the project at `App\Http\Controllers\Pages` namespace and with the name `SlugController`.
+ You can pass additional data to the blade by overriding `getData` method. Page object is always injected.
- You can get page route by calling `coure()->page('slug')`
- You can get page route by calling `core()->page('slug')`

### Fixed
- Route and styles corrections
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![Total Downloads](https://img.shields.io/packagist/dt/torralbodavid/duck-funk-core.svg?style=flat-square)](https://packagist.org/packages/torralbodavid/duck-funk-core)
[![StyleCI](https://github.styleci.io/repos/7548986/shield)](https://github.styleci.io/repos/213175095)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/torralbodavid/duck-funk-core/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/torralbodavid/duck-funk-core/?branch=master)
[![Build Status](https://travis-ci.org/torralbodavid/duck-funk-core.svg?branch=master)](https://travis-ci.org/torralbodavid/duck-funk-core)

> **Note:** This is the core of the Duck Funk CMS for Arcturus Morningstar. If you want to build your own hotel, visit the main [Duck funk repository](https://github.com/torralbodavid/duck-funk).
Expand All @@ -14,6 +15,11 @@ You can install the package via composer:
```bash
composer require torralbodavid/duck-funk-core
```
### Testing

``` bash
composer test
```

### Changelog

Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
"socialiteproviders/facebook": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5",
"laravel/ui": "^2.0",
"mockery/mockery": "^1.3",
"orchestra/testbench": "^5.0",
"mockery/mockery": "^1.3"
"phpunit/phpunit": "^8.5",
"spatie/laravel-permission": "^3.11"
},
"prefer-stable" : true,
"autoload": {
Expand Down
10 changes: 9 additions & 1 deletion database/factories/Arcturus/UserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
/** @var \Illuminate\Database\Eloquent\Factory $factory */

use Faker\Generator as Faker;
use Torralbodavid\DuckFunkCore\Models\Arcturus\Bans;
use Torralbodavid\DuckFunkCore\Models\Arcturus\User;
use Torralbodavid\DuckFunkCore\Models\Arcturus\UserSettings;

$factory->define(User::class, function (Faker $faker) {
return [
'username' => $faker->userName,
'rank' => 1,
'mail' => $faker->email,
'password' => $faker->password(6, 64),
'account_created' => $faker->unixTime,
Expand All @@ -17,11 +20,16 @@
];
});

$factory->define(\Torralbodavid\DuckFunkCore\Models\Arcturus\UserSettings::class, function () {
$factory->define(UserSettings::class, function () {
return [
'welcome_flow_enabled' => true,
'welcome_flow_step' => 1,
'allow_name_change' => true,
'can_change_name' => true,
];
});

$factory->define(Bans::class, function () {
return [
];
});
25 changes: 25 additions & 0 deletions database/factories/DuckFunk/PageFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use Faker\Generator as Faker;
use Torralbodavid\DuckFunkCore\Models\CMS\Page;

$factory->define(Page::class, function (Faker $faker) {
return [
'id' => $faker->randomNumber(),
'title' => $faker->name,
'slug' => $faker->slug,
'route' => $faker->slug,
'meta_title' => $faker->text(25),
'meta_description' => $faker->text(),
'min_rank' => 0,
'parent_id' => 0,
'active' => true,
'no_robots' => false,
'created_at' => now(),
'updated_at' => now(),
'published_at' => now(),
'deleted_at' => null,
];
});
2 changes: 1 addition & 1 deletion public/css/housekeeping/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/style.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"/js/housekeeping/legacy/labs.js": "/js/housekeeping/legacy/labs.js?id=b9941e96a1d81fa61581",
"/css/style.css": "/css/style.css?id=fe593470214b569334a7",
"/css/housekeeping/style.css": "/css/housekeeping/style.css?id=4922dba951ad4aa92d4c",
"/css/style.css": "/css/style.css?id=79fd535b9fdf24cb4179",
"/css/housekeeping/style.css": "/css/housekeeping/style.css?id=c9ec77b74d2141ca7688",
"/js/initial.min.js": "/js/initial.min.js?id=c2365275a644d0ae1a65",
"/js/labs/dependencies/dashboard.min.js": "/js/labs/dependencies/dashboard.min.js?id=3f955c59cfd2a246a8f6",
"/js/labs/dependencies/news.min.js": "/js/labs/dependencies/news.min.js?id=fea7921eaa23d806694c",
Expand Down
4 changes: 2 additions & 2 deletions src/DuckFunkCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DuckFunkCore
/*
* Package version
*/
const PACKAGE_VERSION = '0.4.1';
const PACKAGE_VERSION = '0.4.2';

protected User $user;

Expand All @@ -27,7 +27,7 @@ public function user(): User

public function page($slug = null): string
{
$page = Page::where('slug', $slug)->firstOrFail();
$page = Page::where('route', $slug)->firstOrFail();

return $page->route;
}
Expand Down
12 changes: 6 additions & 6 deletions src/DuckFunkCoreServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Torralbodavid\DuckFunkCore;

use Illuminate\Support\ServiceProvider;
use Laravel\Ui\UiServiceProvider;
use Torralbodavid\DuckFunkCore\Models\Arcturus\User;
use Torralbodavid\DuckFunkCore\Models\Housekeeping\News;
use Torralbodavid\DuckFunkCore\Observers\NewsObserver;
Expand All @@ -16,7 +17,7 @@ class DuckFunkCoreServiceProvider extends ServiceProvider
public function boot()
{
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'duck-funk-core');
$this->loadViewsFrom(__DIR__.'/resources/views/'.config('duck-funk.template'), 'duck-funk-core');
$this->loadViewsFrom(__DIR__.'/resources/views', 'duck-funk-core');
$this->loadViewsFrom(__DIR__.'/resources/views/housekeeping', 'housekeeping');
$this->loadViewsFrom(__DIR__.'/resources/views/auth', 'auth');

Expand All @@ -28,12 +29,10 @@ public function boot()
__DIR__.'/../config/config.php' => config_path('duck-funk.php'),
], 'duck-funk-core/config');

// Publishing the views.
/*$this->publishes([
__DIR__.'/resources/views' => resource_path('views/vendor/duck-funk-core'),
], 'views');*/
$this->publishes([
__DIR__.'/resources/views' => resource_path('views/vendor/duck-funk-core/'),
], 'duck-funk-core/views');

// Publishing assets.
$this->publishes([
__DIR__.'/../public' => public_path('vendor/duck-funk-core'),
], 'duck-funk-core/assets');
Expand All @@ -54,6 +53,7 @@ public function boot()
*/
public function register()
{
$this->app->register(UiServiceProvider::class);
$this->app->register(DuckFunkEventServiceProvider::class);
// Automatically apply the package configuration
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'duck-funk');
Expand Down
6 changes: 4 additions & 2 deletions src/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Torralbodavid\DuckFunkCore\Models\Arcturus\User;

class RegisterController extends Controller
{
Expand Down Expand Up @@ -59,13 +60,14 @@ protected function validator(array $data)
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \Torralbodavid\DuckFunkCore\Models\Arcturus\User
* @return User
*/
protected function create(array $data)
{
return \Torralbodavid\DuckFunkCore\Models\Arcturus\User::create([
return User::create([
'username' => $data['username'],
'mail' => $data['mail'],
'rank' => 1,
'password' => Hash::make($data['password']),
'account_created' => Carbon::now()->timestamp,
'last_login' => Carbon::now()->getTimestamp(),
Expand Down
1 change: 1 addition & 0 deletions src/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function handleProviderCallback()
'username' => User::randomNickname(),
'real_name' => $user->getName(),
'mail' => $user->getEmail(),
'rank' => 1,
'account_created' => Carbon::now()->getTimestamp(),
'ip_register' => request()->ip(),
'ip_current' => request()->ip(),
Expand Down
6 changes: 3 additions & 3 deletions src/Http/Controllers/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ public function __invoke(Request $request)
? $projectController
: $packageController;

if (! view()->exists("duck-funk-core::{$page->slug}") && ! class_exists($controller)) {
if (! view()->exists(template_namespace().".{$page->slug}") && ! class_exists($controller)) {
return abort(404);
}

if (! class_exists($controller)) {
return abort(404);
}

if (view()->exists("duck-funk-core::{$page->slug}")) {
$response = view("duck-funk-core::{$page->slug}")->with('page', $page);
if (view()->exists(template_namespace().".{$page->slug}")) {
$response = view(template_namespace().".{$page->slug}")->with('page', $page);
}

$action = new $controller();
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/Pages/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct()

public function index()
{
return view('duck-funk-core::'.$this->page->slug, $this->data);
return view(template_namespace().'.'.$this->page->slug, $this->data);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Arcturus/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class User extends Model implements Authenticatable, CanResetPassword
* @var array
*/
protected $fillable = [
'username', 'mail', 'password', 'account_created', 'ip_register', 'ip_current', 'last_login',
'username', 'mail', 'password', 'rank', 'account_created', 'ip_register', 'ip_current', 'last_login',
];

/**
Expand Down
5 changes: 5 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ function package_namespace(): string
{
return 'Torralbodavid\DuckFunkCore';
}

function template_namespace(): string
{
return 'duck-funk-core::'.config('duck-funk.template');
}
1 change: 1 addition & 0 deletions src/resources/assets/housekeeping-scss/_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
.notification-list {
&.list-inline-item:not(:last-child) {
margin-right: 0;
vertical-align: middle;
}

.nav-link {
Expand Down
1 change: 1 addition & 0 deletions src/resources/assets/scss/_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ body {
.notification-list {
&.list-inline-item:not(:last-child) {
margin-right: 0;
vertical-align: middle;
}

.nav-link {
Expand Down
3 changes: 2 additions & 1 deletion src/resources/assets/scss/_sprites.scss

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/resources/views/auth/passwords/confirm.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@extends('duck-funk-core::layouts.master-without-nav')
@extends('duck-funk-core::fuse.layouts.master-without-nav')

@section('css')
@endsection
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/fuse/avatar/select.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@extends('duck-funk-core::layouts.master')
@extends('duck-funk-core::fuse.layouts.master')

@section('css')
@endsection
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/fuse/ban.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@extends('duck-funk-core::layouts.master-without-nav')
@extends('duck-funk-core::fuse.layouts.master-without-nav')

@section('css')
@endsection
Expand Down
6 changes: 3 additions & 3 deletions src/resources/views/fuse/hello.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@extends('duck-funk-core::layouts.master')
@extends('duck-funk-core::fuse.layouts.master')

@section('css')
@endsection
Expand All @@ -20,10 +20,10 @@
<div class="card">
<div class="card-body">
@guest
@include('duck-funk-core::home.guest.content')
@include('duck-funk-core::fuse.home.guest.content')
@endguest
@auth
@include('duck-funk-core::home.auth.content')
@include('duck-funk-core::fuse.home.auth.content')
@endauth
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/resources/views/fuse/home.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@extends('duck-funk-core::layouts.master')
@extends('duck-funk-core::fuse.layouts.master')

@section('css')
@endsection
Expand All @@ -20,10 +20,10 @@
<div class="card">
<div class="card-body">
@guest
@include('duck-funk-core::home.guest.content')
@include('duck-funk-core::fuse.home.guest.content')
@endguest
@auth
@include('duck-funk-core::home.auth.content')
@include('duck-funk-core::fuse.home.auth.content')
@endauth
</div>
</div>
Expand Down
15 changes: 3 additions & 12 deletions src/resources/views/fuse/layouts/header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,18 +371,9 @@ class="mdi mdi-home-outline"></i></a></li>
<div class="col-sm-6">
<div class="float-right d-none d-md-block">
<div class="dropdown">
<button class="btn btn-danger dropdown-toggle arrow-none waves-effect waves-light"
type="button" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
<i class="mdi mdi-settings mr-2"></i> Settings
</button>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
<a href="{{ core()->page('hotel') }}" class="btn btn-danger arrow-none waves-effect waves-light">
<i class="retro retro-mid-hotel-button-medium-icon"></i> Entra en el hotel
</a>
</div>
</div>
</div> <!-- end col-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta content="Admin Dashboard" name="description" />
<meta content="Themesbrand" name="author" />
<link rel="shortcut icon" href="assets/images/favicon.ico">
@include('duck-funk-core::layouts.head')
@include('duck-funk-core::fuse.layouts.head')
</head>
<body class="bg-image pb-0">
@yield('content')
Expand Down
8 changes: 4 additions & 4 deletions src/resources/views/fuse/layouts/master.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
<title>{{ $page->meta_title }}</title>
<meta content="Admin Dashboard" name="description" />
<meta content="Themesbrand" name="author" />
@include('duck-funk-core::layouts.head')
@include('duck-funk-core::fuse.layouts.head')
</head>
<body>
@include('duck-funk-core::layouts.header')
@include('duck-funk-core::fuse.layouts.header')
<div class="wrapper">
<div class="container-fluid">
@yield('content')
</div>
</div>
@include('duck-funk-core::layouts.footer')
@include('duck-funk-core::layouts.footer-script')
@include('duck-funk-core::fuse.layouts.footer')
@include('duck-funk-core::fuse.layouts.footer-script')
</body>
</html>
Loading

0 comments on commit 3c71225

Please sign in to comment.