From ab8b3e7b9f14c4db528c395529df32b77a201359 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 15 Apr 2016 16:40:15 +0200 Subject: [PATCH 01/65] prepare for spatie translatable --- src/Models/Partner.php | 51 ++----------------- ...014_06_15_200602_create_partners_table.php | 24 +++------ 2 files changed, 11 insertions(+), 64 deletions(-) diff --git a/src/Models/Partner.php b/src/Models/Partner.php index dcc8ce2..8323710 100644 --- a/src/Models/Partner.php +++ b/src/Models/Partner.php @@ -2,38 +2,22 @@ namespace TypiCMS\Modules\Partners\Models; -use Dimsav\Translatable\Translatable; use Laracasts\Presenter\PresentableTrait; +use Spatie\Translatable\HasTranslations; use TypiCMS\Modules\Core\Models\Base; use TypiCMS\Modules\History\Traits\Historable; class Partner extends Base { + use HasTranslations; use Historable; use PresentableTrait; - use Translatable; protected $presenter = 'TypiCMS\Modules\Partners\Presenters\ModulePresenter'; - protected $fillable = [ - 'image', - 'position', - 'homepage', - // Translatable columns - 'title', - 'slug', - 'status', - 'website', - 'summary', - 'body', - ]; + protected $guarded = ['id']; - /** - * Translatable model configs. - * - * @var array - */ - public $translatedAttributes = [ + public $translatable = [ 'title', 'slug', 'status', @@ -42,37 +26,12 @@ class Partner extends Base 'body', ]; - protected $appends = ['status', 'title', 'thumb', 'website']; + protected $appends = ['thumb', 'website']; - /** - * Columns that are file. - * - * @var array - */ public $attachments = [ 'image', ]; - /** - * Append status attribute from translation table. - * - * @return string - */ - public function getStatusAttribute() - { - return $this->status; - } - - /** - * Append title attribute from translation table. - * - * @return string title - */ - public function getTitleAttribute() - { - return $this->title; - } - /** * Append thumb attribute. * diff --git a/src/database/migrations/2014_06_15_200602_create_partners_table.php b/src/database/migrations/2014_06_15_200602_create_partners_table.php index c5b5790..9f699de 100644 --- a/src/database/migrations/2014_06_15_200602_create_partners_table.php +++ b/src/database/migrations/2014_06_15_200602_create_partners_table.php @@ -18,25 +18,14 @@ public function up() $table->boolean('homepage')->default(0); $table->integer('position')->unsigned()->default(1); $table->string('image')->nullable(); + $table->json('status'); + $table->json('title'); + $table->json('slug'); + $table->json('website'); + $table->json('summary'); + $table->json('body'); $table->timestamps(); }); - - Schema::create('partner_translations', function (Blueprint $table) { - $table->engine = 'InnoDB'; - $table->increments('id'); - $table->integer('partner_id')->unsigned(); - $table->string('locale'); - $table->boolean('status')->default(0); - $table->string('title'); - $table->string('slug')->nullable(); - $table->string('website')->nullable(); - $table->text('summary'); - $table->text('body'); - $table->timestamps(); - $table->unique(['partner_id', 'locale']); - $table->unique(['locale', 'slug']); - $table->foreign('partner_id')->references('id')->on('partners')->onDelete('cascade'); - }); } /** @@ -46,7 +35,6 @@ public function up() */ public function down() { - Schema::drop('partner_translations'); Schema::drop('partners'); } } From 94876898b67e1136436d21d3bd45dc215382c5f4 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 15 Apr 2016 19:39:28 +0200 Subject: [PATCH 02/65] get locales + validation --- src/Http/Requests/FormRequest.php | 6 +++--- src/Providers/RouteServiceProvider.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Http/Requests/FormRequest.php b/src/Http/Requests/FormRequest.php index 1b2c4fe..07e1ea0 100644 --- a/src/Http/Requests/FormRequest.php +++ b/src/Http/Requests/FormRequest.php @@ -11,9 +11,9 @@ public function rules() return [ 'position' => 'required|integer|min:1', 'image' => 'image|max:2000', - '*.title' => 'max:255', - '*.slug' => 'max:255', - '*.website' => 'url', + 'title.*' => 'max:255', + 'slug.*' => 'max:255', + 'website.*' => 'url', ]; } } diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 6053df0..2c24552 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -33,7 +33,7 @@ public function map(Router $router) */ if ($page = TypiCMS::getPageLinkedToModule('partners')) { $options = $page->private ? ['middleware' => 'auth'] : []; - foreach (config('translatable.locales') as $lang) { + foreach (config('translatable-bootforms.locales') as $lang) { if ($page->translate($lang)->status && $uri = $page->uri($lang)) { $router->get($uri, $options + ['as' => $lang.'.partners', 'uses' => 'PublicController@index']); $router->get($uri.'/{slug}', $options + ['as' => $lang.'.partners.slug', 'uses' => 'PublicController@show']); From b5b11791162a9688b71a47bde8d3a0b3a8e58e5e Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 27 Apr 2016 20:23:15 +0200 Subject: [PATCH 03/65] h1 + translate --- src/Providers/RouteServiceProvider.php | 2 +- src/resources/views/admin/index.blade.php | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 2c24552..d7e8e27 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -34,7 +34,7 @@ public function map(Router $router) if ($page = TypiCMS::getPageLinkedToModule('partners')) { $options = $page->private ? ['middleware' => 'auth'] : []; foreach (config('translatable-bootforms.locales') as $lang) { - if ($page->translate($lang)->status && $uri = $page->uri($lang)) { + if ($page->translate('status', $lang) && $uri = $page->uri($lang)) { $router->get($uri, $options + ['as' => $lang.'.partners', 'uses' => 'PublicController@index']); $router->get($uri.'/{slug}', $options + ['as' => $lang.'.partners.slug', 'uses' => 'PublicController@show']); } diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 4255e05..1203ec2 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -8,9 +8,7 @@ @include('core::admin._button-create', ['module' => 'partners']) -

- @{{ models.length }} @choice('partners::global.partners', 2) -

+

@lang('partners::global.name')

@include('core::admin._lang-switcher') From be1c31cffa2b59cd6b9c547409409dba33bc11b1 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 27 Apr 2016 23:44:11 +0200 Subject: [PATCH 04/65] SlugObserver --- src/Providers/ModuleProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index 2e6a59e..e09c085 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -41,7 +41,7 @@ public function boot() ); // Observers - PartnerTranslation::observe(new SlugObserver()); + Partner::observe(new SlugObserver()); Partner::observe(new FileObserver()); } From 4c0af01fb5161eb31ff77dc072128580b5a3c37b Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 27 Apr 2016 23:50:16 +0200 Subject: [PATCH 05/65] cleaning --- src/Providers/ModuleProvider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index e09c085..a163e7a 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -10,7 +10,6 @@ use TypiCMS\Modules\Core\Observers\SlugObserver; use TypiCMS\Modules\Core\Services\Cache\LaravelCache; use TypiCMS\Modules\Partners\Models\Partner; -use TypiCMS\Modules\Partners\Models\PartnerTranslation; use TypiCMS\Modules\Partners\Repositories\CacheDecorator; use TypiCMS\Modules\Partners\Repositories\EloquentPartner; From 7403bf641dafb0febe248bb810d7614cdd8db87d Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 10 May 2016 09:36:49 +0200 Subject: [PATCH 06/65] @return null --- src/Providers/RouteServiceProvider.php | 2 +- .../migrations/2014_06_15_200602_create_partners_table.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index d7e8e27..90d1433 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -22,7 +22,7 @@ class RouteServiceProvider extends ServiceProvider * * @param \Illuminate\Routing\Router $router * - * @return void + * @return null */ public function map(Router $router) { diff --git a/src/database/migrations/2014_06_15_200602_create_partners_table.php b/src/database/migrations/2014_06_15_200602_create_partners_table.php index 9f699de..bb22bf4 100644 --- a/src/database/migrations/2014_06_15_200602_create_partners_table.php +++ b/src/database/migrations/2014_06_15_200602_create_partners_table.php @@ -8,7 +8,7 @@ class CreatePartnersTable extends Migration /** * Run the migrations. * - * @return void + * @return null */ public function up() { @@ -31,7 +31,7 @@ public function up() /** * Reverse the migrations. * - * @return void + * @return null */ public function down() { From 4d5024ce5230b9bc2f5f43a080de4afbc04a7c0f Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 16 Sep 2016 14:34:04 +0200 Subject: [PATCH 07/65] typicms/core: ~3.0.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e770647..2824067 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "typicms/core": "~2.8.0" + "typicms/core": "~3.0.0" }, "autoload": { "psr-4": { From b0d3ecf07eb1aae2d722edea06b6d1dbeb2a7b6f Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 16 Sep 2016 14:40:55 +0200 Subject: [PATCH 08/65] core dev-dev --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2824067..e022105 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "typicms/core": "~3.0.0" + "typicms/core": "dev-dev" }, "autoload": { "psr-4": { From c0c2e3318719bb0dc56b18e937e9f83febfb0f79 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 16 Sep 2016 16:07:10 +0200 Subject: [PATCH 09/65] [L5.3] RouteServiceProvider --- src/Providers/RouteServiceProvider.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 90d1433..2539b1d 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -4,6 +4,7 @@ use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Routing\Router; +use Illuminate\Support\Facades\Route; use TypiCMS\Modules\Core\Facades\TypiCMS; class RouteServiceProvider extends ServiceProvider @@ -20,13 +21,11 @@ class RouteServiceProvider extends ServiceProvider /** * Define the routes for the application. * - * @param \Illuminate\Routing\Router $router - * * @return null */ - public function map(Router $router) + public function map() { - $router->group(['namespace' => $this->namespace], function (Router $router) { + Route::group(['namespace' => $this->namespace], function (Router $router) { /* * Front office routes From 427b2814bf7fcb274f96259941778c1d331ad543 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 16 Sep 2016 23:05:34 +0200 Subject: [PATCH 10/65] Use of Rinvex Repository --- src/Facades/Facade.php | 2 +- src/Http/Controllers/AdminController.php | 4 ++-- src/Http/Controllers/ApiController.php | 2 +- src/Http/Controllers/PublicController.php | 4 ++-- src/Models/Partner.php | 2 +- src/Models/PartnerTranslation.php | 16 ---------------- src/Providers/ModuleProvider.php | 12 +----------- src/Repositories/CacheDecorator.php | 15 --------------- src/Repositories/EloquentPartner.php | 12 +++++------- src/Repositories/PartnerInterface.php | 9 --------- 10 files changed, 13 insertions(+), 65 deletions(-) delete mode 100644 src/Models/PartnerTranslation.php delete mode 100644 src/Repositories/CacheDecorator.php delete mode 100644 src/Repositories/PartnerInterface.php diff --git a/src/Facades/Facade.php b/src/Facades/Facade.php index 1c6d0ea..cd4107d 100644 --- a/src/Facades/Facade.php +++ b/src/Facades/Facade.php @@ -13,6 +13,6 @@ class Facade extends MainFacade */ protected static function getFacadeAccessor() { - return 'TypiCMS\Modules\Partners\Repositories\PartnerInterface'; + return 'Partners'; } } diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index e10d5e8..9062727 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -5,11 +5,11 @@ use TypiCMS\Modules\Core\Http\Controllers\BaseAdminController; use TypiCMS\Modules\Partners\Http\Requests\FormRequest; use TypiCMS\Modules\Partners\Models\Partner; -use TypiCMS\Modules\Partners\Repositories\PartnerInterface; +use TypiCMS\Modules\Partners\Repositories\EloquentPartner; class AdminController extends BaseAdminController { - public function __construct(PartnerInterface $partner) + public function __construct(EloquentPartner $partner) { parent::__construct($partner); } diff --git a/src/Http/Controllers/ApiController.php b/src/Http/Controllers/ApiController.php index 693bea4..e81e2ae 100644 --- a/src/Http/Controllers/ApiController.php +++ b/src/Http/Controllers/ApiController.php @@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Request; use TypiCMS\Modules\Core\Http\Controllers\BaseApiController; use TypiCMS\Modules\Partners\Models\Partner; -use TypiCMS\Modules\Partners\Repositories\PartnerInterface as Repository; +use TypiCMS\Modules\Partners\Repositories\EloquentPartner as Repository; class ApiController extends BaseApiController { diff --git a/src/Http/Controllers/PublicController.php b/src/Http/Controllers/PublicController.php index 0520367..b044660 100644 --- a/src/Http/Controllers/PublicController.php +++ b/src/Http/Controllers/PublicController.php @@ -3,11 +3,11 @@ namespace TypiCMS\Modules\Partners\Http\Controllers; use TypiCMS\Modules\Core\Http\Controllers\BasePublicController; -use TypiCMS\Modules\Partners\Repositories\PartnerInterface; +use TypiCMS\Modules\Partners\Repositories\EloquentPartner; class PublicController extends BasePublicController { - public function __construct(PartnerInterface $partner) + public function __construct(EloquentPartner $partner) { parent::__construct($partner); } diff --git a/src/Models/Partner.php b/src/Models/Partner.php index 8323710..5e3517c 100644 --- a/src/Models/Partner.php +++ b/src/Models/Partner.php @@ -15,7 +15,7 @@ class Partner extends Base protected $presenter = 'TypiCMS\Modules\Partners\Presenters\ModulePresenter'; - protected $guarded = ['id']; + protected $guarded = ['id', 'exit']; public $translatable = [ 'title', diff --git a/src/Models/PartnerTranslation.php b/src/Models/PartnerTranslation.php deleted file mode 100644 index 510e79d..0000000 --- a/src/Models/PartnerTranslation.php +++ /dev/null @@ -1,16 +0,0 @@ -belongsTo('TypiCMS\Modules\Partners\Models\Partner', 'partner_id'); - } -} diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index a163e7a..c4d2edd 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -8,9 +8,7 @@ use TypiCMS\Modules\Core\Facades\TypiCMS; use TypiCMS\Modules\Core\Observers\FileObserver; use TypiCMS\Modules\Core\Observers\SlugObserver; -use TypiCMS\Modules\Core\Services\Cache\LaravelCache; use TypiCMS\Modules\Partners\Models\Partner; -use TypiCMS\Modules\Partners\Repositories\CacheDecorator; use TypiCMS\Modules\Partners\Repositories\EloquentPartner; class ModuleProvider extends ServiceProvider @@ -65,14 +63,6 @@ public function register() $view->page = TypiCMS::getPageLinkedToModule('partners'); }); - $app->bind('TypiCMS\Modules\Partners\Repositories\PartnerInterface', function (Application $app) { - $repository = new EloquentPartner(new Partner()); - if (!config('typicms.cache')) { - return $repository; - } - $laravelCache = new LaravelCache($app['cache'], 'partners', 10); - - return new CacheDecorator($repository, $laravelCache); - }); + $app->bind('Partners', EloquentPartner::class); } } diff --git a/src/Repositories/CacheDecorator.php b/src/Repositories/CacheDecorator.php deleted file mode 100644 index 11c9100..0000000 --- a/src/Repositories/CacheDecorator.php +++ /dev/null @@ -1,15 +0,0 @@ -repo = $repo; - $this->cache = $cache; - } -} diff --git a/src/Repositories/EloquentPartner.php b/src/Repositories/EloquentPartner.php index 8a37f23..6da198a 100644 --- a/src/Repositories/EloquentPartner.php +++ b/src/Repositories/EloquentPartner.php @@ -2,13 +2,11 @@ namespace TypiCMS\Modules\Partners\Repositories; -use Illuminate\Database\Eloquent\Model; -use TypiCMS\Modules\Core\Repositories\RepositoriesAbstract; +use TypiCMS\Modules\Partners\Models\Partner; -class EloquentPartner extends RepositoriesAbstract implements PartnerInterface +class EloquentPartner extends EloquentRepository { - public function __construct(Model $model) - { - $this->model = $model; - } + protected $repositoryId = 'partners'; + + protected $model = Partner::class; } diff --git a/src/Repositories/PartnerInterface.php b/src/Repositories/PartnerInterface.php deleted file mode 100644 index 362980d..0000000 --- a/src/Repositories/PartnerInterface.php +++ /dev/null @@ -1,9 +0,0 @@ - Date: Fri, 16 Sep 2016 23:39:05 +0200 Subject: [PATCH 11/65] missing use --- src/Repositories/EloquentPartner.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Repositories/EloquentPartner.php b/src/Repositories/EloquentPartner.php index 6da198a..6b75833 100644 --- a/src/Repositories/EloquentPartner.php +++ b/src/Repositories/EloquentPartner.php @@ -2,6 +2,7 @@ namespace TypiCMS\Modules\Partners\Repositories; +use TypiCMS\Modules\Core\EloquentRepository; use TypiCMS\Modules\Partners\Models\Partner; class EloquentPartner extends EloquentRepository From 57d6690f005b36a8c0c64904b66b00928c35fc9c Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Sat, 17 Sep 2016 09:54:36 +0200 Subject: [PATCH 12/65] Facade renamed --- src/Facades/{Facade.php => Partners.php} | 4 ++-- src/Providers/ModuleProvider.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/Facades/{Facade.php => Partners.php} (73%) diff --git a/src/Facades/Facade.php b/src/Facades/Partners.php similarity index 73% rename from src/Facades/Facade.php rename to src/Facades/Partners.php index cd4107d..52ba4e8 100644 --- a/src/Facades/Facade.php +++ b/src/Facades/Partners.php @@ -2,9 +2,9 @@ namespace TypiCMS\Modules\Partners\Facades; -use Illuminate\Support\Facades\Facade as MainFacade; +use Illuminate\Support\Facades\Facade; -class Facade extends MainFacade +class Partners extends Facade { /** * Get the registered name of the component. diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index c4d2edd..8782079 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -34,7 +34,7 @@ public function boot() AliasLoader::getInstance()->alias( 'Partners', - 'TypiCMS\Modules\Partners\Facades\Facade' + 'TypiCMS\Modules\Slides\Facades\Partners' ); // Observers From 855cbc36a3f0362acf9fcb57cad1992a223abc93 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Sat, 17 Sep 2016 15:37:32 +0200 Subject: [PATCH 13/65] Dependency to core removed + AliasLoader + repo methods --- composer.json | 2 +- src/Http/Controllers/PublicController.php | 4 ++-- src/Providers/ModuleProvider.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index e022105..ef7d529 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "typicms/core": "dev-dev" + "laravel/framework": "~5.3.0" }, "autoload": { "psr-4": { diff --git a/src/Http/Controllers/PublicController.php b/src/Http/Controllers/PublicController.php index b044660..41c8709 100644 --- a/src/Http/Controllers/PublicController.php +++ b/src/Http/Controllers/PublicController.php @@ -19,7 +19,7 @@ public function __construct(EloquentPartner $partner) */ public function index() { - $models = $this->repository->all(); + $models = $this->repository->published()->findAll(); return view('partners::public.index') ->with(compact('models')); @@ -32,7 +32,7 @@ public function index() */ public function show($slug) { - $model = $this->repository->bySlug($slug); + $model = $this->repository->published()->bySlug($slug); return view('partners::public.show') ->with(compact('model')); diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index 8782079..ce2f0b5 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -34,7 +34,7 @@ public function boot() AliasLoader::getInstance()->alias( 'Partners', - 'TypiCMS\Modules\Slides\Facades\Partners' + 'TypiCMS\Modules\Partners\Facades\Partners' ); // Observers From 0b5807985a2fc4c1018d8609bcb8a1b54e90c7ea Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 29 Sep 2016 17:34:04 +0200 Subject: [PATCH 14/65] createModel in place of getModel --- src/Http/Controllers/AdminController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index 9062727..8e8d2f2 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -34,7 +34,7 @@ public function index() */ public function create() { - $model = $this->repository->getModel(); + $model = $this->repository->createModel(); return view('partners::admin.create') ->with(compact('model')); From 5fe4128b8418a6476fb0a4e20745cc1907f2dbda Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 29 Sep 2016 15:34:17 +0000 Subject: [PATCH 15/65] Applied fixes from StyleCI --- src/Providers/ModuleProvider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index ce2f0b5..ebe9f05 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -3,7 +3,6 @@ namespace TypiCMS\Modules\Partners\Providers; use Illuminate\Foundation\AliasLoader; -use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; use TypiCMS\Modules\Core\Facades\TypiCMS; use TypiCMS\Modules\Core\Observers\FileObserver; From 912feff1f47783e6f0fb9dea8b954078a29a9e69 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 29 Sep 2016 19:29:09 +0200 Subject: [PATCH 16/65] findAll + routes + EloquentRepository moved --- src/Http/Controllers/AdminController.php | 2 +- src/Providers/RouteServiceProvider.php | 20 ++++++++++++-------- src/Repositories/EloquentPartner.php | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index 8e8d2f2..5ebbc79 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -21,7 +21,7 @@ public function __construct(EloquentPartner $partner) */ public function index() { - $models = $this->repository->all([], true); + $models = $this->repository->findAll(); app('JavaScript')->put('models', $models); return view('partners::admin.index'); diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 2539b1d..c1935fa 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -43,18 +43,22 @@ public function map() /* * Admin routes */ - $router->get('admin/partners', 'AdminController@index')->name('admin::index-partners'); - $router->get('admin/partners/create', 'AdminController@create')->name('admin::create-partner'); - $router->get('admin/partners/{partner}/edit', 'AdminController@edit')->name('admin::edit-partner'); - $router->post('admin/partners', 'AdminController@store')->name('admin::store-partner'); - $router->put('admin/partners/{partner}', 'AdminController@update')->name('admin::update-partner'); + $router->group(['middleware' => 'admin', 'prefix' => 'admin'], function(Router $router) { + $router->get('partners', 'AdminController@index')->name('admin::index-partners'); + $router->get('partners/create', 'AdminController@create')->name('admin::create-partner'); + $router->get('partners/{partner}/edit', 'AdminController@edit')->name('admin::edit-partner'); + $router->post('partners', 'AdminController@store')->name('admin::store-partner'); + $router->put('partners/{partner}', 'AdminController@update')->name('admin::update-partner'); + }); /* * API routes */ - $router->get('api/partners', 'ApiController@index')->name('api::index-partners'); - $router->put('api/partners/{partner}', 'ApiController@update')->name('api::update-partner'); - $router->delete('api/partners/{partner}', 'ApiController@destroy')->name('api::destroy-partner'); + $router->group(['middleware' => 'api', 'prefix' => 'api'], function(Router $router) { + $router->get('partners', 'ApiController@index')->name('api::index-partners'); + $router->put('partners/{partner}', 'ApiController@update')->name('api::update-partner'); + $router->delete('partners/{partner}', 'ApiController@destroy')->name('api::destroy-partner'); + }); }); } } diff --git a/src/Repositories/EloquentPartner.php b/src/Repositories/EloquentPartner.php index 6b75833..6e5ef32 100644 --- a/src/Repositories/EloquentPartner.php +++ b/src/Repositories/EloquentPartner.php @@ -2,7 +2,7 @@ namespace TypiCMS\Modules\Partners\Repositories; -use TypiCMS\Modules\Core\EloquentRepository; +use TypiCMS\Modules\Core\Repositories\EloquentRepository; use TypiCMS\Modules\Partners\Models\Partner; class EloquentPartner extends EloquentRepository From 852340e934cb3b7f993e2d35fe364c4e55014b77 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 29 Sep 2016 17:29:15 +0000 Subject: [PATCH 17/65] Applied fixes from StyleCI --- src/Providers/RouteServiceProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index c1935fa..e6cd191 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -43,7 +43,7 @@ public function map() /* * Admin routes */ - $router->group(['middleware' => 'admin', 'prefix' => 'admin'], function(Router $router) { + $router->group(['middleware' => 'admin', 'prefix' => 'admin'], function (Router $router) { $router->get('partners', 'AdminController@index')->name('admin::index-partners'); $router->get('partners/create', 'AdminController@create')->name('admin::create-partner'); $router->get('partners/{partner}/edit', 'AdminController@edit')->name('admin::edit-partner'); @@ -54,7 +54,7 @@ public function map() /* * API routes */ - $router->group(['middleware' => 'api', 'prefix' => 'api'], function(Router $router) { + $router->group(['middleware' => 'api', 'prefix' => 'api'], function (Router $router) { $router->get('partners', 'ApiController@index')->name('api::index-partners'); $router->put('partners/{partner}', 'ApiController@update')->name('api::update-partner'); $router->delete('partners/{partner}', 'ApiController@destroy')->name('api::destroy-partner'); From 59febe914b75e3cc7e0ff558fa6ff54ea2a375c8 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 30 Sep 2016 11:04:33 +0200 Subject: [PATCH 18/65] update method --- src/Http/Controllers/AdminController.php | 2 +- src/Http/Controllers/ApiController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index 5ebbc79..d21613c 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -77,7 +77,7 @@ public function store(FormRequest $request) */ public function update(Partner $partner, FormRequest $request) { - $this->repository->update($request->all()); + $this->repository->update(request('id'), $request->all()); return $this->redirect($request, $partner); } diff --git a/src/Http/Controllers/ApiController.php b/src/Http/Controllers/ApiController.php index e81e2ae..7b4fe4d 100644 --- a/src/Http/Controllers/ApiController.php +++ b/src/Http/Controllers/ApiController.php @@ -39,7 +39,7 @@ public function store() */ public function update() { - $updated = $this->repository->update(Request::all()); + $updated = $this->repository->update(request('id'), Request::all()); return response()->json([ 'error' => !$updated, From 6c28ba05cb90b1924a021df3acb32565e214f37e Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 5 Oct 2016 22:15:28 +0200 Subject: [PATCH 19/65] Admin routes --- src/Http/Controllers/AdminController.php | 18 +++++++++++++++++- src/Providers/RouteServiceProvider.php | 11 ++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index d21613c..09f6d4d 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -77,8 +77,24 @@ public function store(FormRequest $request) */ public function update(Partner $partner, FormRequest $request) { - $this->repository->update(request('id'), $request->all()); + $this->repository->update($request->id, $request->all()); return $this->redirect($request, $partner); } + + /** + * Remove the specified resource from storage. + * + * @param \TypiCMS\Modules\Partners\Models\Partner $partner + * + * @return \Illuminate\Http\JsonResponse + */ + public function destroy(Partner $partner) + { + $deleted = $this->repository->delete($partner); + + return response()->json([ + 'error' => !$deleted, + ]); + } } diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index e6cd191..505ca82 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -49,15 +49,8 @@ public function map() $router->get('partners/{partner}/edit', 'AdminController@edit')->name('admin::edit-partner'); $router->post('partners', 'AdminController@store')->name('admin::store-partner'); $router->put('partners/{partner}', 'AdminController@update')->name('admin::update-partner'); - }); - - /* - * API routes - */ - $router->group(['middleware' => 'api', 'prefix' => 'api'], function (Router $router) { - $router->get('partners', 'ApiController@index')->name('api::index-partners'); - $router->put('partners/{partner}', 'ApiController@update')->name('api::update-partner'); - $router->delete('partners/{partner}', 'ApiController@destroy')->name('api::destroy-partner'); + $router->patch('partners/{partner}', 'AdminController@ajaxUpdate'); + $router->delete('partners/{partner}', 'AdminController@destroy')->name('admin::destroy-partner'); }); }); } From 0aa47df339e55392388e5d3796a9d56753a323d2 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 13 Jan 2017 23:33:34 +0100 Subject: [PATCH 20/65] laravel 5.4 required --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ef7d529..198bc69 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "laravel/framework": "~5.3.0" + "laravel/framework": "~5.4.0" }, "autoload": { "psr-4": { From 7839afa420115117c8a01d06cf09ad98e3da56dc Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 18 Jan 2017 22:48:44 +0100 Subject: [PATCH 21/65] locales helper method --- src/Providers/RouteServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 505ca82..7faa848 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -32,7 +32,7 @@ public function map() */ if ($page = TypiCMS::getPageLinkedToModule('partners')) { $options = $page->private ? ['middleware' => 'auth'] : []; - foreach (config('translatable-bootforms.locales') as $lang) { + foreach (locales() as $lang) { if ($page->translate('status', $lang) && $uri = $page->uri($lang)) { $router->get($uri, $options + ['as' => $lang.'.partners', 'uses' => 'PublicController@index']); $router->get($uri.'/{slug}', $options + ['as' => $lang.'.partners.slug', 'uses' => 'PublicController@show']); From fb2e43881219b3436fc37ad2d75964b6de31b3cf Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 19 Jan 2017 10:02:19 +0100 Subject: [PATCH 22/65] array alignment removed --- src/resources/lang/en/global.php | 8 ++++---- src/resources/lang/es/global.php | 8 ++++---- src/resources/lang/fr/global.php | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/resources/lang/en/global.php b/src/resources/lang/en/global.php index 7a2779b..7063df3 100644 --- a/src/resources/lang/en/global.php +++ b/src/resources/lang/en/global.php @@ -1,9 +1,9 @@ 'Partners', + 'name' => 'Partners', 'partners' => 'partner|partners', - 'New' => 'New partner', - 'Edit' => 'Edit partner', - 'Back' => 'Back to partners', + 'New' => 'New partner', + 'Edit' => 'Edit partner', + 'Back' => 'Back to partners', ]; diff --git a/src/resources/lang/es/global.php b/src/resources/lang/es/global.php index 22a3d71..b9eb599 100644 --- a/src/resources/lang/es/global.php +++ b/src/resources/lang/es/global.php @@ -1,9 +1,9 @@ 'Socios', + 'name' => 'Socios', 'partners' => 'socio|socios', - 'New' => 'Nuevo socio', - 'Edit' => 'Editar socios', - 'Back' => 'Volver a los socios', + 'New' => 'Nuevo socio', + 'Edit' => 'Editar socios', + 'Back' => 'Volver a los socios', ]; diff --git a/src/resources/lang/fr/global.php b/src/resources/lang/fr/global.php index ec3d02a..c64482e 100644 --- a/src/resources/lang/fr/global.php +++ b/src/resources/lang/fr/global.php @@ -1,9 +1,9 @@ 'Partenaires', + 'name' => 'Partenaires', 'partners' => 'partenaire|partenaires', - 'New' => 'Nouveau partenaire', - 'Edit' => 'Modifier le partenaire', - 'Back' => 'Retour à la liste des partenaires', + 'New' => 'Nouveau partenaire', + 'Edit' => 'Modifier le partenaire', + 'Back' => 'Retour à la liste des partenaires', ]; From 236cae8cb7fabc6ae04b4f02c3656960b8d257e4 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 19 Jan 2017 10:21:53 +0100 Subject: [PATCH 23/65] double arrow alignment removed --- src/Http/Requests/FormRequest.php | 8 ++++---- src/config/config.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Http/Requests/FormRequest.php b/src/Http/Requests/FormRequest.php index 07e1ea0..425d044 100644 --- a/src/Http/Requests/FormRequest.php +++ b/src/Http/Requests/FormRequest.php @@ -9,10 +9,10 @@ class FormRequest extends AbstractFormRequest public function rules() { return [ - 'position' => 'required|integer|min:1', - 'image' => 'image|max:2000', - 'title.*' => 'max:255', - 'slug.*' => 'max:255', + 'position' => 'required|integer|min:1', + 'image' => 'image|max:2000', + 'title.*' => 'max:255', + 'slug.*' => 'max:255', 'website.*' => 'url', ]; } diff --git a/src/config/config.php b/src/config/config.php index 1775ec5..5ba447f 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -2,7 +2,7 @@ return [ 'per_page' => 50, - 'order' => [ + 'order' => [ 'position' => 'asc', ], 'sidebar' => [ From 9c74abe138bd01c78610df4f279f0946f0f2bdc3 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 19 Jan 2017 15:14:08 +0100 Subject: [PATCH 24/65] findAllTranslated --- src/Http/Controllers/AdminController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index 09f6d4d..a11ff7d 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -21,7 +21,7 @@ public function __construct(EloquentPartner $partner) */ public function index() { - $models = $this->repository->findAll(); + $models = $this->repository->findAllTranslated(); app('JavaScript')->put('models', $models); return view('partners::admin.index'); From 5b0ca3ecb27bfa8f0898b544ddf1dea7d57819c3 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 20 Jan 2017 17:28:01 +0100 Subject: [PATCH 25/65] __() in place of trans() --- src/Composers/SidebarViewComposer.php | 4 ++-- src/resources/views/admin/_form.blade.php | 12 ++++++------ src/resources/views/admin/create.blade.php | 2 +- src/resources/views/admin/edit.blade.php | 2 +- src/resources/views/admin/index.blade.php | 2 +- src/resources/views/public/show.blade.php | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Composers/SidebarViewComposer.php b/src/Composers/SidebarViewComposer.php index ce96661..47ea7f0 100644 --- a/src/Composers/SidebarViewComposer.php +++ b/src/Composers/SidebarViewComposer.php @@ -11,8 +11,8 @@ class SidebarViewComposer { public function compose(View $view) { - $view->sidebar->group(trans('global.menus.content'), function (SidebarGroup $group) { - $group->addItem(trans('partners::global.name'), function (SidebarItem $item) { + $view->sidebar->group(__('global.menus.content'), function (SidebarGroup $group) { + $group->addItem(__('partners::global.name'), function (SidebarItem $item) { $item->id = 'partners'; $item->icon = config('typicms.partners.sidebar.icon', 'icon fa fa-fw fa-cubes'); $item->weight = config('typicms.partners.sidebar.weight'); diff --git a/src/resources/views/admin/_form.blade.php b/src/resources/views/admin/_form.blade.php index 10d1ab6..569dbba 100644 --- a/src/resources/views/admin/_form.blade.php +++ b/src/resources/views/admin/_form.blade.php @@ -9,17 +9,17 @@ @include('core::admin._image-fieldset', ['field' => 'image']) {!! BootForm::hidden('homepage')->value(0) !!} -{!! BootForm::checkbox(trans('validation.attributes.homepage'), 'homepage') !!} +{!! BootForm::checkbox(__('validation.attributes.homepage'), 'homepage') !!}
- {!! BootForm::text(trans('validation.attributes.position'), 'position') !!} + {!! BootForm::text(__('validation.attributes.position'), 'position') !!}
@include('core::form._title-and-slug') {!! TranslatableBootForm::hidden('status')->value(0) !!} -{!! TranslatableBootForm::checkbox(trans('validation.attributes.online'), 'status') !!} -{!! TranslatableBootForm::text(trans('validation.attributes.website'), 'website') !!} -{!! TranslatableBootForm::textarea(trans('validation.attributes.summary'), 'summary')->rows(4) !!} -{!! TranslatableBootForm::textarea(trans('validation.attributes.body'), 'body')->addClass('ckeditor') !!} +{!! TranslatableBootForm::checkbox(__('validation.attributes.online'), 'status') !!} +{!! TranslatableBootForm::text(__('validation.attributes.website'), 'website') !!} +{!! TranslatableBootForm::textarea(__('validation.attributes.summary'), 'summary')->rows(4) !!} +{!! TranslatableBootForm::textarea(__('validation.attributes.body'), 'body')->addClass('ckeditor') !!} diff --git a/src/resources/views/admin/create.blade.php b/src/resources/views/admin/create.blade.php index 2752870..42b1ebc 100644 --- a/src/resources/views/admin/create.blade.php +++ b/src/resources/views/admin/create.blade.php @@ -1,6 +1,6 @@ @extends('core::admin.master') -@section('title', trans('partners::global.New')) +@section('title', __('partners::global.New')) @section('main') diff --git a/src/resources/views/admin/edit.blade.php b/src/resources/views/admin/edit.blade.php index 7246b8c..332b24e 100644 --- a/src/resources/views/admin/edit.blade.php +++ b/src/resources/views/admin/edit.blade.php @@ -6,7 +6,7 @@ @include('core::admin._button-back', ['module' => 'partners'])

- {{ $model->present()->title ?: trans('core::global.Untitled') }} + {{ $model->present()->title ?: __('core::global.Untitled') }}

{!! BootForm::open()->put()->action(route('admin::update-partner', $model->id))->multipart()->role('form') !!} diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 1203ec2..979db14 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -1,6 +1,6 @@ @extends('core::admin.master') -@section('title', trans('partners::global.name')) +@section('title', __('partners::global.name')) @section('main') diff --git a/src/resources/views/public/show.blade.php b/src/resources/views/public/show.blade.php index 75f04c8..bb44624 100644 --- a/src/resources/views/public/show.blade.php +++ b/src/resources/views/public/show.blade.php @@ -1,6 +1,6 @@ @extends('core::public.master') -@section('title', $model->title.' – '.trans('partners::global.name').' – '.$websiteTitle) +@section('title', $model->title.' – '.__('partners::global.name').' – '.$websiteTitle) @section('ogTitle', $model->title) @section('description', $model->summary) @section('image', $model->present()->thumbUrl()) From 2de8639b12e8119808feb1ae36868199430ecde0 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 20 Jan 2017 18:22:45 +0100 Subject: [PATCH 26/65] validations attributes in a json file --- src/resources/views/admin/_form.blade.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/resources/views/admin/_form.blade.php b/src/resources/views/admin/_form.blade.php index 569dbba..3350edf 100644 --- a/src/resources/views/admin/_form.blade.php +++ b/src/resources/views/admin/_form.blade.php @@ -9,17 +9,17 @@ @include('core::admin._image-fieldset', ['field' => 'image']) {!! BootForm::hidden('homepage')->value(0) !!} -{!! BootForm::checkbox(__('validation.attributes.homepage'), 'homepage') !!} +{!! BootForm::checkbox(__('Homepage'), 'homepage') !!}
- {!! BootForm::text(__('validation.attributes.position'), 'position') !!} + {!! BootForm::text(__('Position'), 'position') !!}
@include('core::form._title-and-slug') {!! TranslatableBootForm::hidden('status')->value(0) !!} -{!! TranslatableBootForm::checkbox(__('validation.attributes.online'), 'status') !!} -{!! TranslatableBootForm::text(__('validation.attributes.website'), 'website') !!} -{!! TranslatableBootForm::textarea(__('validation.attributes.summary'), 'summary')->rows(4) !!} -{!! TranslatableBootForm::textarea(__('validation.attributes.body'), 'body')->addClass('ckeditor') !!} +{!! TranslatableBootForm::checkbox(__('Online'), 'status') !!} +{!! TranslatableBootForm::text(__('Website'), 'website') !!} +{!! TranslatableBootForm::textarea(__('Summary'), 'summary')->rows(4) !!} +{!! TranslatableBootForm::textarea(__('Body'), 'body')->addClass('ckeditor') !!} From 13082e0f715848def200689169ac90f9405c1184 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Sun, 22 Jan 2017 22:37:41 +0100 Subject: [PATCH 27/65] section 'main' is now 'content' --- src/resources/views/admin/create.blade.php | 2 +- src/resources/views/admin/edit.blade.php | 4 ++-- src/resources/views/admin/index.blade.php | 2 +- src/resources/views/public/index.blade.php | 2 +- src/resources/views/public/show.blade.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/resources/views/admin/create.blade.php b/src/resources/views/admin/create.blade.php index 42b1ebc..9fa2418 100644 --- a/src/resources/views/admin/create.blade.php +++ b/src/resources/views/admin/create.blade.php @@ -2,7 +2,7 @@ @section('title', __('partners::global.New')) -@section('main') +@section('content') @include('core::admin._button-back', ['module' => 'partners'])

diff --git a/src/resources/views/admin/edit.blade.php b/src/resources/views/admin/edit.blade.php index 332b24e..8480329 100644 --- a/src/resources/views/admin/edit.blade.php +++ b/src/resources/views/admin/edit.blade.php @@ -2,11 +2,11 @@ @section('title', $model->present()->title) -@section('main') +@section('content') @include('core::admin._button-back', ['module' => 'partners'])

- {{ $model->present()->title ?: __('core::global.Untitled') }} + {{ $model->present()->title ?: __('Untitled') }}

{!! BootForm::open()->put()->action(route('admin::update-partner', $model->id))->multipart()->role('form') !!} diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 979db14..2d78240 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -2,7 +2,7 @@ @section('title', __('partners::global.name')) -@section('main') +@section('content')
diff --git a/src/resources/views/public/index.blade.php b/src/resources/views/public/index.blade.php index 4e94b64..2482ea1 100644 --- a/src/resources/views/public/index.blade.php +++ b/src/resources/views/public/index.blade.php @@ -2,7 +2,7 @@ @section('bodyClass', 'body-partners body-partners-index body-page body-page-'.$page->id) -@section('main') +@section('content') {!! $page->present()->body !!} diff --git a/src/resources/views/public/show.blade.php b/src/resources/views/public/show.blade.php index bb44624..847ac93 100644 --- a/src/resources/views/public/show.blade.php +++ b/src/resources/views/public/show.blade.php @@ -6,7 +6,7 @@ @section('image', $model->present()->thumbUrl()) @section('bodyClass', 'body-partners body-partner-'.$model->id.' body-page body-page-'.$page->id) -@section('main') +@section('content') @include('core::public._btn-prev-next', ['module' => 'Partners', 'model' => $model])
From 453955972747ec9b10986cb941279d62e9b672f4 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Sun, 22 Jan 2017 23:09:50 +0100 Subject: [PATCH 28/65] translations --- src/resources/views/admin/_form.blade.php | 2 +- src/resources/views/admin/index.blade.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/resources/views/admin/_form.blade.php b/src/resources/views/admin/_form.blade.php index 3350edf..c17ea6e 100644 --- a/src/resources/views/admin/_form.blade.php +++ b/src/resources/views/admin/_form.blade.php @@ -19,7 +19,7 @@ @include('core::form._title-and-slug') {!! TranslatableBootForm::hidden('status')->value(0) !!} -{!! TranslatableBootForm::checkbox(__('Online'), 'status') !!} +{!! TranslatableBootForm::checkbox(__('Published'), 'status') !!} {!! TranslatableBootForm::text(__('Website'), 'website') !!} {!! TranslatableBootForm::textarea(__('Summary'), 'summary')->rows(4) !!} {!! TranslatableBootForm::textarea(__('Body'), 'body')->addClass('ckeditor') !!} diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 2d78240..8d14809 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -31,10 +31,10 @@ - + - + From 673adacbbc0e2312e9ddc204878d207ee72f52c8 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Mon, 23 Jan 2017 19:56:05 +0100 Subject: [PATCH 29/65] Front office routes name --- src/Providers/RouteServiceProvider.php | 4 ++-- src/resources/views/public/_list-item.blade.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 7faa848..b826fa1 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -34,8 +34,8 @@ public function map() $options = $page->private ? ['middleware' => 'auth'] : []; foreach (locales() as $lang) { if ($page->translate('status', $lang) && $uri = $page->uri($lang)) { - $router->get($uri, $options + ['as' => $lang.'.partners', 'uses' => 'PublicController@index']); - $router->get($uri.'/{slug}', $options + ['as' => $lang.'.partners.slug', 'uses' => 'PublicController@show']); + $router->get($uri, $options + ['uses' => 'PublicController@index'])->name($lang.'::index-partners'); + $router->get($uri.'/{slug}', $options + ['uses' => 'PublicController@show'])->name($lang.'::partner'); } } } diff --git a/src/resources/views/public/_list-item.blade.php b/src/resources/views/public/_list-item.blade.php index 051c1d3..7047c78 100644 --- a/src/resources/views/public/_list-item.blade.php +++ b/src/resources/views/public/_list-item.blade.php @@ -1,5 +1,5 @@
  • - + {{-- --}} {!! $partner->present()->thumb(null, 200) !!} From 059e8971272ba5fc5dd3889e916842bcf1295367 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Mon, 23 Jan 2017 20:19:34 +0100 Subject: [PATCH 30/65] default classes --- src/resources/views/public/_list-item.blade.php | 6 +++--- src/resources/views/public/_list.blade.php | 2 +- src/resources/views/public/show.blade.php | 13 ++++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/resources/views/public/_list-item.blade.php b/src/resources/views/public/_list-item.blade.php index 7047c78..5da2f70 100644 --- a/src/resources/views/public/_list-item.blade.php +++ b/src/resources/views/public/_list-item.blade.php @@ -1,6 +1,6 @@ -
  • - - {{-- --}} +
  • + + {{-- --}} {!! $partner->present()->thumb(null, 200) !!}
  • diff --git a/src/resources/views/public/_list.blade.php b/src/resources/views/public/_list.blade.php index 3323fa0..2b382a8 100644 --- a/src/resources/views/public/_list.blade.php +++ b/src/resources/views/public/_list.blade.php @@ -1,4 +1,4 @@ -
      +
        @foreach ($items as $partner) @include('partners::public._list-item') @endforeach diff --git a/src/resources/views/public/show.blade.php b/src/resources/views/public/show.blade.php index 847ac93..82bb548 100644 --- a/src/resources/views/public/show.blade.php +++ b/src/resources/views/public/show.blade.php @@ -9,12 +9,15 @@ @section('content') @include('core::public._btn-prev-next', ['module' => 'Partners', 'model' => $model]) -
        -

        {{ $model->title }}

        + +
        +

        {{ $model->title }}

        {!! $model->present()->thumb(null, 200) !!} -

        {{ $model->website }}

        -

        {{ nl2br($model->summary) }}

        -
        {!! $model->present()->body !!}
        +

        + {{ $model->website }} +

        +

        {{ nl2br($model->summary) }}

        +
        {!! $model->present()->body !!}
        @endsection From 86c52d322a9e73c13ce684ba848f104f81293099 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Mon, 23 Jan 2017 22:19:51 +0100 Subject: [PATCH 31/65] nullable validation rules --- src/Http/Requests/FormRequest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Http/Requests/FormRequest.php b/src/Http/Requests/FormRequest.php index 425d044..1519137 100644 --- a/src/Http/Requests/FormRequest.php +++ b/src/Http/Requests/FormRequest.php @@ -11,9 +11,9 @@ public function rules() return [ 'position' => 'required|integer|min:1', 'image' => 'image|max:2000', - 'title.*' => 'max:255', - 'slug.*' => 'max:255', - 'website.*' => 'url', + 'title.*' => 'nullable|max:255', + 'slug.*' => 'nullable|alpha_dash|max:255', + 'website.*' => 'nullable|url', ]; } } From 003d6140c4b5d5587d51afff74fee3c9cb37f96e Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 24 Jan 2017 20:00:36 +0100 Subject: [PATCH 32/65] th translations --- src/resources/views/admin/index.blade.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 8d14809..17c3db7 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -21,12 +21,12 @@ - Status - Image - Position - Home - Title - Website + @lang('Status') + @lang('Image') + @lang('Position') + @lang('Home') + @lang('Title') + @lang('Website') From 3560193eec5844047a3d0f1202b088e54d001fcc Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 24 Jan 2017 23:16:45 +0100 Subject: [PATCH 33/65] getWebsiteAttribute removed --- src/Models/Partner.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Models/Partner.php b/src/Models/Partner.php index 5e3517c..3aa4910 100644 --- a/src/Models/Partner.php +++ b/src/Models/Partner.php @@ -26,7 +26,7 @@ class Partner extends Base 'body', ]; - protected $appends = ['thumb', 'website']; + protected $appends = ['thumb']; public $attachments = [ 'image', @@ -41,14 +41,4 @@ public function getThumbAttribute() { return $this->present()->thumbSrc(null, 22); } - - /** - * Append website attribute from translation table. - * - * @return string - */ - public function getWebsiteAttribute() - { - return $this->website; - } } From cb313e9eee77afdf4bb0aed267ffce4998c65837 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 24 Jan 2017 23:55:29 +0100 Subject: [PATCH 34/65] th translations --- src/resources/views/admin/index.blade.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 17c3db7..4ddf6a7 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -21,12 +21,12 @@ - @lang('Status') - @lang('Image') - @lang('Position') - @lang('Home') - @lang('Title') - @lang('Website') + {{ __('Status') }} + {{ __('Image') }} + {{ __('Position') }} + {{ __('Home') }} + {{ __('Title') }} + {{ __('Website') }} From 782a6ac7f3957f61014e3f9b496b5cdb8abe3673 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 25 Jan 2017 23:00:45 +0100 Subject: [PATCH 35/65] ::class syntax --- src/Providers/ModuleProvider.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index ebe9f05..e324b52 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -7,6 +7,8 @@ use TypiCMS\Modules\Core\Facades\TypiCMS; use TypiCMS\Modules\Core\Observers\FileObserver; use TypiCMS\Modules\Core\Observers\SlugObserver; +use TypiCMS\Modules\Partners\Composers\SidebarViewComposer; +use TypiCMS\Modules\Partners\Facades\Partners; use TypiCMS\Modules\Partners\Models\Partner; use TypiCMS\Modules\Partners\Repositories\EloquentPartner; @@ -31,10 +33,7 @@ public function boot() __DIR__.'/../database' => base_path('database'), ], 'migrations'); - AliasLoader::getInstance()->alias( - 'Partners', - 'TypiCMS\Modules\Partners\Facades\Partners' - ); + AliasLoader::getInstance()->alias('Partners', Partners::class); // Observers Partner::observe(new SlugObserver()); @@ -48,12 +47,12 @@ public function register() /* * Register route service provider */ - $app->register('TypiCMS\Modules\Partners\Providers\RouteServiceProvider'); + $app->register(RouteServiceProvider::class); /* * Sidebar view composer */ - $app->view->composer('core::admin._sidebar', 'TypiCMS\Modules\Partners\Composers\SidebarViewComposer'); + $app->view->composer('core::admin._sidebar', SidebarViewComposer::class); /* * Add the page in the view. From c4b598972fc669f2c1e3f7cc74aedae200725367 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 8 Feb 2017 09:55:17 +0100 Subject: [PATCH 36/65] admin list --- src/Http/Controllers/AdminController.php | 2 +- src/resources/views/admin/index.blade.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index a11ff7d..09f6d4d 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -21,7 +21,7 @@ public function __construct(EloquentPartner $partner) */ public function index() { - $models = $this->repository->findAllTranslated(); + $models = $this->repository->findAll(); app('JavaScript')->put('models', $models); return view('partners::admin.index'); diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 4ddf6a7..183ad3f 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -53,8 +53,8 @@ @{{ model.homepage }} - @{{ model.title }} - @{{ model.website }} + @{{ model.title | translated }} + @{{ model.website | translated }} From a636d7b3e343255d754301687ccb72d4a8fa2654 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 15 Feb 2017 16:56:36 +0100 Subject: [PATCH 37/65] api controller removed --- src/Http/Controllers/ApiController.php | 64 -------------------------- 1 file changed, 64 deletions(-) delete mode 100644 src/Http/Controllers/ApiController.php diff --git a/src/Http/Controllers/ApiController.php b/src/Http/Controllers/ApiController.php deleted file mode 100644 index 7b4fe4d..0000000 --- a/src/Http/Controllers/ApiController.php +++ /dev/null @@ -1,64 +0,0 @@ -repository->create(Request::all()); - $error = $model ? false : true; - - return response()->json([ - 'error' => $error, - 'model' => $model, - ], 200); - } - - /** - * Update the specified resource in storage. - * - * @param $model - * - * @return \Illuminate\Http\JsonResponse - */ - public function update() - { - $updated = $this->repository->update(request('id'), Request::all()); - - return response()->json([ - 'error' => !$updated, - ]); - } - - /** - * Remove the specified resource from storage. - * - * @param \TypiCMS\Modules\Partners\Models\Partner $partner - * - * @return \Illuminate\Http\JsonResponse - */ - public function destroy(Partner $partner) - { - $deleted = $this->repository->delete($partner); - - return response()->json([ - 'error' => !$deleted, - ]); - } -} From 3a560f786cd3c5dcfc29187e47a1bf3446bd99bc Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 15 Feb 2017 16:56:45 +0100 Subject: [PATCH 38/65] translated attribute in admin list --- src/Models/Partner.php | 24 ++++++++++++++++++++++- src/resources/views/admin/index.blade.php | 12 ++++++------ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/Models/Partner.php b/src/Models/Partner.php index 3aa4910..849aca2 100644 --- a/src/Models/Partner.php +++ b/src/Models/Partner.php @@ -26,12 +26,34 @@ class Partner extends Base 'body', ]; - protected $appends = ['thumb']; + protected $appends = ['thumb', 'title_translated', 'website_translated']; public $attachments = [ 'image', ]; + /** + * Append title_translated attribute. + * + * @return string + */ + public function getTitleTranslatedAttribute() + { + $locale = config('app.locale'); + return $this->translate('title', config('typicms.content_locale', $locale)); + } + + /** + * Append website_translated attribute. + * + * @return string + */ + public function getWebsiteTranslatedAttribute() + { + $locale = config('app.locale'); + return $this->translate('website', config('typicms.content_locale', $locale)); + } + /** * Append thumb attribute. * diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 183ad3f..af80fd1 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -25,16 +25,16 @@ {{ __('Image') }} {{ __('Position') }} {{ __('Home') }} - {{ __('Title') }} - {{ __('Website') }} + {{ __('Title') }} + {{ __('Website') }} - + - + @@ -53,8 +53,8 @@ @{{ model.homepage }} - @{{ model.title | translated }} - @{{ model.website | translated }} + @{{ model.title_translated }} + @{{ model.website_translated }} From e229e9d234b369f15bc2ae3cedc5c8208deedfec Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Sat, 18 Feb 2017 14:07:54 +0100 Subject: [PATCH 39/65] lang switcher template --- src/resources/views/admin/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index af80fd1..7a80e90 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -11,7 +11,7 @@

        @lang('partners::global.name')

        - @include('core::admin._lang-switcher') + @include('core::admin._lang-switcher-for-list')
        From edc478076352c0cde3ead9d6201e67e7c250595a Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 2 Mar 2017 15:02:42 +0100 Subject: [PATCH 40/65] checkboxes in list + routes --- src/Providers/RouteServiceProvider.php | 4 ++-- src/resources/views/admin/index.blade.php | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index b826fa1..7a0b5a8 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -49,8 +49,8 @@ public function map() $router->get('partners/{partner}/edit', 'AdminController@edit')->name('admin::edit-partner'); $router->post('partners', 'AdminController@store')->name('admin::store-partner'); $router->put('partners/{partner}', 'AdminController@update')->name('admin::update-partner'); - $router->patch('partners/{partner}', 'AdminController@ajaxUpdate'); - $router->delete('partners/{partner}', 'AdminController@destroy')->name('admin::destroy-partner'); + $router->patch('partners/{ids}', 'AdminController@ajaxUpdate')->name('admin::update-partner'); + $router->delete('partners/{ids}', 'AdminController@destroyMultiple')->name('admin::destroy-partner'); }); }); } diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 7a80e90..fa4095a 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -11,6 +11,9 @@

        @lang('partners::global.name')

        + @include('core::admin._button-select') + @include('core::admin._button-actions') + @include('core::admin._button-export') @include('core::admin._lang-switcher-for-list')
        @@ -41,7 +44,9 @@ - + + + @include('core::admin._button-edit', ['module' => 'partners']) From 6163d536c8d1086b7b18f3685c886eb31ec886c3 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 2 Mar 2017 15:40:49 +0100 Subject: [PATCH 41/65] update position in list --- src/resources/views/admin/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index fa4095a..52efcb7 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -55,7 +55,7 @@ - + @{{ model.homepage }} @{{ model.title_translated }} From 4227de0826f47c87fdeb55337b50249734452e63 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Mon, 6 Mar 2017 22:29:13 +0100 Subject: [PATCH 42/65] Use of @component for buttons in form --- src/resources/views/admin/_form.blade.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/resources/views/admin/_form.blade.php b/src/resources/views/admin/_form.blade.php index c17ea6e..3f7c2bc 100644 --- a/src/resources/views/admin/_form.blade.php +++ b/src/resources/views/admin/_form.blade.php @@ -2,7 +2,8 @@ @endsection -@include('core::admin._buttons-form') +@component('core::admin._buttons-form', ['model' => $model]) +@endcomponent {!! BootForm::hidden('id') !!} From 73ee9acff75144244876f936b3299cf6cecdbec7 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Mon, 6 Mar 2017 22:30:32 +0100 Subject: [PATCH 43/65] ::class syntax --- src/Models/Partner.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Models/Partner.php b/src/Models/Partner.php index 849aca2..95cd366 100644 --- a/src/Models/Partner.php +++ b/src/Models/Partner.php @@ -6,6 +6,7 @@ use Spatie\Translatable\HasTranslations; use TypiCMS\Modules\Core\Models\Base; use TypiCMS\Modules\History\Traits\Historable; +use TypiCMS\Modules\Partners\Presenters\ModulePresenter; class Partner extends Base { @@ -13,7 +14,7 @@ class Partner extends Base use Historable; use PresentableTrait; - protected $presenter = 'TypiCMS\Modules\Partners\Presenters\ModulePresenter'; + protected $presenter = ModulePresenter::class; protected $guarded = ['id', 'exit']; From 1d3f9bf752819ea01a971056b018996355c28f00 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 16 Mar 2017 09:22:50 +0100 Subject: [PATCH 44/65] The model belongs to Image --- src/Http/Controllers/AdminController.php | 3 +++ src/Http/Requests/FormRequest.php | 2 +- src/Models/Partner.php | 15 +++++++++++---- src/Providers/ModuleProvider.php | 2 -- .../2014_06_15_200602_create_partners_table.php | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index 09f6d4d..dd27b03 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -35,6 +35,7 @@ public function index() public function create() { $model = $this->repository->createModel(); + app('JavaScript')->put('model', $model); return view('partners::admin.create') ->with(compact('model')); @@ -49,6 +50,8 @@ public function create() */ public function edit(Partner $partner) { + app('JavaScript')->put('model', $partner); + return view('partners::admin.edit') ->with(['model' => $partner]); } diff --git a/src/Http/Requests/FormRequest.php b/src/Http/Requests/FormRequest.php index 1519137..a1b5dd6 100644 --- a/src/Http/Requests/FormRequest.php +++ b/src/Http/Requests/FormRequest.php @@ -10,7 +10,7 @@ public function rules() { return [ 'position' => 'required|integer|min:1', - 'image' => 'image|max:2000', + 'image_id' => 'nullable|integer', 'title.*' => 'nullable|max:255', 'slug.*' => 'nullable|alpha_dash|max:255', 'website.*' => 'nullable|url', diff --git a/src/Models/Partner.php b/src/Models/Partner.php index 95cd366..70d6a00 100644 --- a/src/Models/Partner.php +++ b/src/Models/Partner.php @@ -5,6 +5,7 @@ use Laracasts\Presenter\PresentableTrait; use Spatie\Translatable\HasTranslations; use TypiCMS\Modules\Core\Models\Base; +use TypiCMS\Modules\Files\Models\File; use TypiCMS\Modules\History\Traits\Historable; use TypiCMS\Modules\Partners\Presenters\ModulePresenter; @@ -29,10 +30,6 @@ class Partner extends Base protected $appends = ['thumb', 'title_translated', 'website_translated']; - public $attachments = [ - 'image', - ]; - /** * Append title_translated attribute. * @@ -64,4 +61,14 @@ public function getThumbAttribute() { return $this->present()->thumbSrc(null, 22); } + + /** + * This model belongs to one image. + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function image() + { + return $this->belongsTo(File::class, 'image_id'); + } } diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index e324b52..5a8b85f 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -5,7 +5,6 @@ use Illuminate\Foundation\AliasLoader; use Illuminate\Support\ServiceProvider; use TypiCMS\Modules\Core\Facades\TypiCMS; -use TypiCMS\Modules\Core\Observers\FileObserver; use TypiCMS\Modules\Core\Observers\SlugObserver; use TypiCMS\Modules\Partners\Composers\SidebarViewComposer; use TypiCMS\Modules\Partners\Facades\Partners; @@ -37,7 +36,6 @@ public function boot() // Observers Partner::observe(new SlugObserver()); - Partner::observe(new FileObserver()); } public function register() diff --git a/src/database/migrations/2014_06_15_200602_create_partners_table.php b/src/database/migrations/2014_06_15_200602_create_partners_table.php index bb22bf4..a6fc0c9 100644 --- a/src/database/migrations/2014_06_15_200602_create_partners_table.php +++ b/src/database/migrations/2014_06_15_200602_create_partners_table.php @@ -17,7 +17,7 @@ public function up() $table->increments('id'); $table->boolean('homepage')->default(0); $table->integer('position')->unsigned()->default(1); - $table->string('image')->nullable(); + $table->integer('image_id')->unsigned()->nullable(); $table->json('status'); $table->json('title'); $table->json('slug'); From b161b2da1057f8a3594ca3b1bfc04da5a7e73264 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 31 Mar 2017 22:19:37 +0200 Subject: [PATCH 45/65] Duplicate route name --- src/Providers/RouteServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 7a0b5a8..1e6bdcc 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -49,7 +49,7 @@ public function map() $router->get('partners/{partner}/edit', 'AdminController@edit')->name('admin::edit-partner'); $router->post('partners', 'AdminController@store')->name('admin::store-partner'); $router->put('partners/{partner}', 'AdminController@update')->name('admin::update-partner'); - $router->patch('partners/{ids}', 'AdminController@ajaxUpdate')->name('admin::update-partner'); + $router->patch('partners/{ids}', 'AdminController@ajaxUpdate')->name('admin::update-partner-ajax'); $router->delete('partners/{ids}', 'AdminController@destroyMultiple')->name('admin::destroy-partner'); }); }); From 0e140f2896b72ac983d583d719008be9037b5422 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Sat, 1 Apr 2017 11:14:50 +0200 Subject: [PATCH 46/65] allowing to sort list by status --- src/Models/Partner.php | 15 ++++++++++++++- src/resources/views/admin/index.blade.php | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Models/Partner.php b/src/Models/Partner.php index 70d6a00..ea005b8 100644 --- a/src/Models/Partner.php +++ b/src/Models/Partner.php @@ -28,7 +28,7 @@ class Partner extends Base 'body', ]; - protected $appends = ['thumb', 'title_translated', 'website_translated']; + protected $appends = ['thumb', 'title_translated', 'website_translated', 'status_translated']; /** * Append title_translated attribute. @@ -38,9 +38,22 @@ class Partner extends Base public function getTitleTranslatedAttribute() { $locale = config('app.locale'); + return $this->translate('title', config('typicms.content_locale', $locale)); } + /** + * Append status_translated attribute. + * + * @return string + */ + public function getStatusTranslatedAttribute() + { + $locale = config('app.locale'); + + return $this->translate('status', config('typicms.content_locale', $locale)); + } + /** * Append website_translated attribute. * diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 52efcb7..7e1faec 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -24,7 +24,7 @@ - {{ __('Status') }} + {{ __('Status') }} {{ __('Image') }} {{ __('Position') }} {{ __('Home') }} From fa615c75daba2c08ea8d9146a533cddc48c496c1 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Sat, 1 Apr 2017 11:49:04 +0200 Subject: [PATCH 47/65] load image --- src/Http/Controllers/AdminController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index dd27b03..c2d8a14 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -21,7 +21,7 @@ public function __construct(EloquentPartner $partner) */ public function index() { - $models = $this->repository->findAll(); + $models = $this->repository->with('image')->findAll(); app('JavaScript')->put('models', $models); return view('partners::admin.index'); From 3a93577368d38404e7e1ad248731830c11d1eb7f Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Sat, 1 Apr 2017 16:34:00 +0200 Subject: [PATCH 48/65] loadMigrationsFrom --- src/Providers/ModuleProvider.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index 5a8b85f..86ddf31 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -24,13 +24,11 @@ public function boot() $this->loadViewsFrom(__DIR__.'/../resources/views/', 'partners'); $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'partners'); + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); $this->publishes([ __DIR__.'/../resources/views' => base_path('resources/views/vendor/partners'), ], 'views'); - $this->publishes([ - __DIR__.'/../database' => base_path('database'), - ], 'migrations'); AliasLoader::getInstance()->alias('Partners', Partners::class); From 154158337f24e8efe9d0465520e46717440dbe22 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 14 Apr 2017 11:49:54 +0200 Subject: [PATCH 49/65] Export button removed --- src/resources/views/admin/index.blade.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 7e1faec..27fc49c 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -13,7 +13,6 @@
        @include('core::admin._button-select') @include('core::admin._button-actions') - @include('core::admin._button-export') @include('core::admin._lang-switcher-for-list')
        From 16c94f6b11ce979377dac7d55494da96d740f6bb Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 14 Apr 2017 13:27:39 +0200 Subject: [PATCH 50/65] permissions in config --- src/Providers/ModuleProvider.php | 3 +++ src/config/permissions.php | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/config/permissions.php diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index 86ddf31..57ef3e1 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -18,6 +18,9 @@ public function boot() $this->mergeConfigFrom( __DIR__.'/../config/config.php', 'typicms.partners' ); + $this->mergeConfigFrom( + __DIR__.'/../config/permissions.php', 'typicms.permissions' + ); $modules = $this->app['config']['typicms']['modules']; $this->app['config']->set('typicms.modules', array_merge(['partners' => ['linkable_to_page']], $modules)); diff --git a/src/config/permissions.php b/src/config/permissions.php new file mode 100644 index 0000000..667114a --- /dev/null +++ b/src/config/permissions.php @@ -0,0 +1,13 @@ + [ + 'index-partners' => 'Show list', + 'create-partner' => 'Create', + 'store-partner' => 'Store', + 'edit-partner' => 'Edit', + 'update-partner' => 'Update', + 'sort-partners' => 'Sort', + 'destroy-partner' => 'Destroy', + ], +]; From 78f57673fbbf5d4b24cd89c9b5aed55a92635908 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 18 Apr 2017 16:34:51 +0200 Subject: [PATCH 51/65] sidebar group translation --- src/Composers/SidebarViewComposer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composers/SidebarViewComposer.php b/src/Composers/SidebarViewComposer.php index 47ea7f0..5e5541e 100644 --- a/src/Composers/SidebarViewComposer.php +++ b/src/Composers/SidebarViewComposer.php @@ -11,7 +11,7 @@ class SidebarViewComposer { public function compose(View $view) { - $view->sidebar->group(__('global.menus.content'), function (SidebarGroup $group) { + $view->sidebar->group(__('Content'), function (SidebarGroup $group) { $group->addItem(__('partners::global.name'), function (SidebarItem $item) { $item->id = 'partners'; $item->icon = config('typicms.partners.sidebar.icon', 'icon fa fa-fw fa-cubes'); From d7188f43ef5c63da88da0ba0c6126919658a1bc5 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 18 Apr 2017 23:02:56 +0200 Subject: [PATCH 52/65] class status --- src/resources/views/admin/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 27fc49c..f199c94 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -23,7 +23,7 @@ - {{ __('Status') }} + {{ __('Status') }} {{ __('Image') }} {{ __('Position') }} {{ __('Home') }} From 0aa8cbd83fe6f987ba63258e4bcec8c90a1c3391 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 18 Apr 2017 23:50:15 +0200 Subject: [PATCH 53/65] Simpler permissions --- src/config/permissions.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/config/permissions.php b/src/config/permissions.php index 667114a..b255825 100644 --- a/src/config/permissions.php +++ b/src/config/permissions.php @@ -2,12 +2,9 @@ return [ 'partners' => [ - 'index-partners' => 'Show list', + 'index-partners' => 'View list', 'create-partner' => 'Create', - 'store-partner' => 'Store', 'edit-partner' => 'Edit', - 'update-partner' => 'Update', - 'sort-partners' => 'Sort', 'destroy-partner' => 'Destroy', ], ]; From fd156f52ad9ebe63863ca7a0ee57b817afd4644d Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 19 Apr 2017 23:49:18 +0200 Subject: [PATCH 54/65] Use of Authorize middleware --- src/Composers/SidebarViewComposer.php | 8 +++++--- src/Providers/RouteServiceProvider.php | 14 +++++++------- src/config/permissions.php | 6 +++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Composers/SidebarViewComposer.php b/src/Composers/SidebarViewComposer.php index 5e5541e..cc9cc56 100644 --- a/src/Composers/SidebarViewComposer.php +++ b/src/Composers/SidebarViewComposer.php @@ -11,16 +11,18 @@ class SidebarViewComposer { public function compose(View $view) { + if (Gate::denies('see-all-partners')) { + return; + } $view->sidebar->group(__('Content'), function (SidebarGroup $group) { + $group->id = 'content'; + $group->weight = 30; $group->addItem(__('partners::global.name'), function (SidebarItem $item) { $item->id = 'partners'; $item->icon = config('typicms.partners.sidebar.icon', 'icon fa fa-fw fa-cubes'); $item->weight = config('typicms.partners.sidebar.weight'); $item->route('admin::index-partners'); $item->append('admin::create-partner'); - $item->authorize( - Gate::allows('index-partners') - ); }); }); } diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php index 1e6bdcc..c3e6b20 100644 --- a/src/Providers/RouteServiceProvider.php +++ b/src/Providers/RouteServiceProvider.php @@ -44,13 +44,13 @@ public function map() * Admin routes */ $router->group(['middleware' => 'admin', 'prefix' => 'admin'], function (Router $router) { - $router->get('partners', 'AdminController@index')->name('admin::index-partners'); - $router->get('partners/create', 'AdminController@create')->name('admin::create-partner'); - $router->get('partners/{partner}/edit', 'AdminController@edit')->name('admin::edit-partner'); - $router->post('partners', 'AdminController@store')->name('admin::store-partner'); - $router->put('partners/{partner}', 'AdminController@update')->name('admin::update-partner'); - $router->patch('partners/{ids}', 'AdminController@ajaxUpdate')->name('admin::update-partner-ajax'); - $router->delete('partners/{ids}', 'AdminController@destroyMultiple')->name('admin::destroy-partner'); + $router->get('partners', 'AdminController@index')->name('admin::index-partners')->middleware('can:see-all-partners'); + $router->get('partners/create', 'AdminController@create')->name('admin::create-partner')->middleware('can:create-partner'); + $router->get('partners/{partner}/edit', 'AdminController@edit')->name('admin::edit-partner')->middleware('can:update-partner'); + $router->post('partners', 'AdminController@store')->name('admin::store-partner')->middleware('can:create-partner'); + $router->put('partners/{partner}', 'AdminController@update')->name('admin::update-partner')->middleware('can:update-partner'); + $router->patch('partners/{ids}', 'AdminController@ajaxUpdate')->name('admin::update-partner-ajax')->middleware('can:update-partner'); + $router->delete('partners/{ids}', 'AdminController@destroyMultiple')->name('admin::destroy-partner')->middleware('can:delete-partner'); }); }); } diff --git a/src/config/permissions.php b/src/config/permissions.php index b255825..dab7d63 100644 --- a/src/config/permissions.php +++ b/src/config/permissions.php @@ -2,9 +2,9 @@ return [ 'partners' => [ - 'index-partners' => 'View list', + 'see-all-partners' => 'View list', 'create-partner' => 'Create', - 'edit-partner' => 'Edit', - 'destroy-partner' => 'Destroy', + 'update-partner' => 'Edit', + 'delete-partner' => 'Delete', ], ]; From 3bb43f40ac47fac338818a373c2ac5e691594f54 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 11 May 2017 17:44:53 +0200 Subject: [PATCH 55/65] Public files partial --- src/resources/views/public/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/views/public/index.blade.php b/src/resources/views/public/index.blade.php index 2482ea1..137f3fd 100644 --- a/src/resources/views/public/index.blade.php +++ b/src/resources/views/public/index.blade.php @@ -6,7 +6,7 @@ {!! $page->present()->body !!} - @include('galleries::public._galleries', ['model' => $page]) + @include('files::public._files', ['model' => $page]) @if ($models->count()) @include('partners::public._list', ['items' => $models]) From c63fda04b6fc885ec69713b80cd0605122585fcc Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 11 May 2017 21:18:04 +0200 Subject: [PATCH 56/65] html5 required field --- src/resources/views/admin/_form.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/views/admin/_form.blade.php b/src/resources/views/admin/_form.blade.php index 3f7c2bc..27bfa7f 100644 --- a/src/resources/views/admin/_form.blade.php +++ b/src/resources/views/admin/_form.blade.php @@ -14,7 +14,7 @@
        - {!! BootForm::text(__('Position'), 'position') !!} + {!! BootForm::text(__('Position'), 'position')->type('number')->min(1)->required() !!}
        From e62f8f62fef09c8aa66797f348d101d983264d30 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 24 May 2017 13:53:52 +0200 Subject: [PATCH 57/65] ng-app in master template --- src/resources/views/admin/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index f199c94..6be2134 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -4,7 +4,7 @@ @section('content') -
        +
        @include('core::admin._button-create', ['module' => 'partners']) From 0ff7120c250dd478d313b947fbba1cf92b89bcdb Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 1 Jun 2017 23:52:07 +0200 Subject: [PATCH 58/65] json translations --- composer.json | 8 ++++++++ src/Composers/SidebarViewComposer.php | 2 +- src/Providers/ModuleProvider.php | 1 - src/resources/lang/en/global.php | 9 --------- src/resources/lang/es.json | 6 ++++++ src/resources/lang/es/global.php | 9 --------- src/resources/lang/fr.json | 6 ++++++ src/resources/lang/fr/global.php | 9 --------- src/resources/views/admin/_form.blade.php | 2 +- src/resources/views/admin/create.blade.php | 4 ++-- src/resources/views/admin/edit.blade.php | 2 +- src/resources/views/admin/index.blade.php | 8 ++++---- src/resources/views/public/show.blade.php | 2 +- 13 files changed, 30 insertions(+), 38 deletions(-) delete mode 100644 src/resources/lang/en/global.php create mode 100644 src/resources/lang/es.json delete mode 100644 src/resources/lang/es/global.php create mode 100644 src/resources/lang/fr.json delete mode 100644 src/resources/lang/fr/global.php diff --git a/composer.json b/composer.json index 198bc69..ce63715 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,14 @@ "TypiCMS\\Modules\\Partners\\": "src/" } }, + "scripts": { + "post-install-cmd": [ + "php artisan translations:add /vendor/typicms/Partners/src/resources/lang" + ], + "post-update-cmd": [ + "php artisan translations:add /vendor/typicms/Partners/src/resources/lang" + ] + }, "minimum-stability": "dev", "prefer-stable": true } diff --git a/src/Composers/SidebarViewComposer.php b/src/Composers/SidebarViewComposer.php index cc9cc56..df15577 100644 --- a/src/Composers/SidebarViewComposer.php +++ b/src/Composers/SidebarViewComposer.php @@ -17,7 +17,7 @@ public function compose(View $view) $view->sidebar->group(__('Content'), function (SidebarGroup $group) { $group->id = 'content'; $group->weight = 30; - $group->addItem(__('partners::global.name'), function (SidebarItem $item) { + $group->addItem(__('Partners'), function (SidebarItem $item) { $item->id = 'partners'; $item->icon = config('typicms.partners.sidebar.icon', 'icon fa fa-fw fa-cubes'); $item->weight = config('typicms.partners.sidebar.weight'); diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index 57ef3e1..0e9b230 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -26,7 +26,6 @@ public function boot() $this->app['config']->set('typicms.modules', array_merge(['partners' => ['linkable_to_page']], $modules)); $this->loadViewsFrom(__DIR__.'/../resources/views/', 'partners'); - $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'partners'); $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); $this->publishes([ diff --git a/src/resources/lang/en/global.php b/src/resources/lang/en/global.php deleted file mode 100644 index 7063df3..0000000 --- a/src/resources/lang/en/global.php +++ /dev/null @@ -1,9 +0,0 @@ - 'Partners', - 'partners' => 'partner|partners', - 'New' => 'New partner', - 'Edit' => 'Edit partner', - 'Back' => 'Back to partners', -]; diff --git a/src/resources/lang/es.json b/src/resources/lang/es.json new file mode 100644 index 0000000..34a3e45 --- /dev/null +++ b/src/resources/lang/es.json @@ -0,0 +1,6 @@ +{ + "Back to partners list": "Volver a los socios", + "Edit partner": "Editar socio", + "New partner": "Nuevo socio", + "Partners": "Socios" +} diff --git a/src/resources/lang/es/global.php b/src/resources/lang/es/global.php deleted file mode 100644 index b9eb599..0000000 --- a/src/resources/lang/es/global.php +++ /dev/null @@ -1,9 +0,0 @@ - 'Socios', - 'partners' => 'socio|socios', - 'New' => 'Nuevo socio', - 'Edit' => 'Editar socios', - 'Back' => 'Volver a los socios', -]; diff --git a/src/resources/lang/fr.json b/src/resources/lang/fr.json new file mode 100644 index 0000000..41829b9 --- /dev/null +++ b/src/resources/lang/fr.json @@ -0,0 +1,6 @@ +{ + "Back to partners list": "Retour à la liste des partenaires", + "Edit partner": "Modifier le partenaire", + "New partner": "Nouveau partenaire", + "Partners": "Partenaires" +} diff --git a/src/resources/lang/fr/global.php b/src/resources/lang/fr/global.php deleted file mode 100644 index c64482e..0000000 --- a/src/resources/lang/fr/global.php +++ /dev/null @@ -1,9 +0,0 @@ - 'Partenaires', - 'partners' => 'partenaire|partenaires', - 'New' => 'Nouveau partenaire', - 'Edit' => 'Modifier le partenaire', - 'Back' => 'Retour à la liste des partenaires', -]; diff --git a/src/resources/views/admin/_form.blade.php b/src/resources/views/admin/_form.blade.php index 27bfa7f..2888466 100644 --- a/src/resources/views/admin/_form.blade.php +++ b/src/resources/views/admin/_form.blade.php @@ -13,7 +13,7 @@ {!! BootForm::checkbox(__('Homepage'), 'homepage') !!}
        -
        +
        {!! BootForm::text(__('Position'), 'position')->type('number')->min(1)->required() !!}
        diff --git a/src/resources/views/admin/create.blade.php b/src/resources/views/admin/create.blade.php index 9fa2418..4f03b21 100644 --- a/src/resources/views/admin/create.blade.php +++ b/src/resources/views/admin/create.blade.php @@ -1,12 +1,12 @@ @extends('core::admin.master') -@section('title', __('partners::global.New')) +@section('title', __('New partner')) @section('content') @include('core::admin._button-back', ['module' => 'partners'])

        - @lang('partners::global.New') + @lang('New partner')

        {!! BootForm::open()->action(route('admin::index-partners'))->multipart()->role('form') !!} diff --git a/src/resources/views/admin/edit.blade.php b/src/resources/views/admin/edit.blade.php index 8480329..3b36823 100644 --- a/src/resources/views/admin/edit.blade.php +++ b/src/resources/views/admin/edit.blade.php @@ -5,7 +5,7 @@ @section('content') @include('core::admin._button-back', ['module' => 'partners']) -

        +

        {{ $model->present()->title ?: __('Untitled') }}

        diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php index 6be2134..b681391 100644 --- a/src/resources/views/admin/index.blade.php +++ b/src/resources/views/admin/index.blade.php @@ -1,6 +1,6 @@ @extends('core::admin.master') -@section('title', __('partners::global.name')) +@section('title', __('Partners')) @section('content') @@ -8,7 +8,7 @@ @include('core::admin._button-create', ['module' => 'partners']) -

        @lang('partners::global.name')

        +

        @lang('Partners')

        @include('core::admin._button-select') @@ -33,10 +33,10 @@ - + - + diff --git a/src/resources/views/public/show.blade.php b/src/resources/views/public/show.blade.php index 82bb548..7888a2c 100644 --- a/src/resources/views/public/show.blade.php +++ b/src/resources/views/public/show.blade.php @@ -1,6 +1,6 @@ @extends('core::public.master') -@section('title', $model->title.' – '.__('partners::global.name').' – '.$websiteTitle) +@section('title', $model->title.' – '.__('Partners').' – '.$websiteTitle) @section('ogTitle', $model->title) @section('description', $model->summary) @section('image', $model->present()->thumbUrl()) From 5232d8e05237729bc3b701b0984fbe0a34db9f38 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 2 Jun 2017 09:56:08 +0200 Subject: [PATCH 59/65] composer scripts removed --- composer.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/composer.json b/composer.json index ce63715..198bc69 100644 --- a/composer.json +++ b/composer.json @@ -16,14 +16,6 @@ "TypiCMS\\Modules\\Partners\\": "src/" } }, - "scripts": { - "post-install-cmd": [ - "php artisan translations:add /vendor/typicms/Partners/src/resources/lang" - ], - "post-update-cmd": [ - "php artisan translations:add /vendor/typicms/Partners/src/resources/lang" - ] - }, "minimum-stability": "dev", "prefer-stable": true } From 6732ba275fb3ddc3731facc72c54b587869845eb Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 2 Jun 2017 10:47:57 +0200 Subject: [PATCH 60/65] translations removed --- src/resources/lang/es.json | 6 ------ src/resources/lang/fr.json | 6 ------ 2 files changed, 12 deletions(-) delete mode 100644 src/resources/lang/es.json delete mode 100644 src/resources/lang/fr.json diff --git a/src/resources/lang/es.json b/src/resources/lang/es.json deleted file mode 100644 index 34a3e45..0000000 --- a/src/resources/lang/es.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Back to partners list": "Volver a los socios", - "Edit partner": "Editar socio", - "New partner": "Nuevo socio", - "Partners": "Socios" -} diff --git a/src/resources/lang/fr.json b/src/resources/lang/fr.json deleted file mode 100644 index 41829b9..0000000 --- a/src/resources/lang/fr.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Back to partners list": "Retour à la liste des partenaires", - "Edit partner": "Modifier le partenaire", - "New partner": "Nouveau partenaire", - "Partners": "Partenaires" -} From ce4a26a58c017d8b03afe3589c01e8ad7d6bb233 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Fri, 9 Jun 2017 18:52:14 +0200 Subject: [PATCH 61/65] service provider auto discover --- composer.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/composer.json b/composer.json index 198bc69..e19bbf3 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,13 @@ "TypiCMS\\Modules\\Partners\\": "src/" } }, + "extra": { + "laravel": { + "providers": [ + "TypiCMS\\Modules\\Partners\\Providers\\ModuleProvider" + ] + } + }, "minimum-stability": "dev", "prefer-stable": true } From dc4a652f28a57ecd3dc35fdd2808efb54c52a997 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Mon, 12 Jun 2017 11:27:10 +0200 Subject: [PATCH 62/65] L5.5 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e19bbf3..4fa7693 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "laravel/framework": "~5.4.0" + "laravel/framework": "~5.5.0" }, "autoload": { "psr-4": { From f6cfe6aa93fce3f824a0dd3f6dcde4bf625a005b Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 13 Jun 2017 15:32:05 +0200 Subject: [PATCH 63/65] autodiscover disabled + view composer in boot method --- composer.json | 7 ------- src/Providers/ModuleProvider.php | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index 4fa7693..21ba437 100644 --- a/composer.json +++ b/composer.json @@ -16,13 +16,6 @@ "TypiCMS\\Modules\\Partners\\": "src/" } }, - "extra": { - "laravel": { - "providers": [ - "TypiCMS\\Modules\\Partners\\Providers\\ModuleProvider" - ] - } - }, "minimum-stability": "dev", "prefer-stable": true } diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index 0e9b230..de2d9f2 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -36,28 +36,28 @@ public function boot() // Observers Partner::observe(new SlugObserver()); - } - - public function register() - { - $app = $this->app; - - /* - * Register route service provider - */ - $app->register(RouteServiceProvider::class); /* * Sidebar view composer */ - $app->view->composer('core::admin._sidebar', SidebarViewComposer::class); + $this->app->view->composer('core::admin._sidebar', SidebarViewComposer::class); /* * Add the page in the view. */ - $app->view->composer('partners::public.*', function ($view) { + $this->app->view->composer('partners::public.*', function ($view) { $view->page = TypiCMS::getPageLinkedToModule('partners'); }); + } + + public function register() + { + $app = $this->app; + + /* + * Register route service provider + */ + $app->register(RouteServiceProvider::class); $app->bind('Partners', EloquentPartner::class); } From 183a9a56a55ab92ee3d0e79e43984b95ed050fda Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Wed, 14 Jun 2017 11:53:44 +0200 Subject: [PATCH 64/65] @includeWhen --- src/resources/views/public/index.blade.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/resources/views/public/index.blade.php b/src/resources/views/public/index.blade.php index 137f3fd..694b3c7 100644 --- a/src/resources/views/public/index.blade.php +++ b/src/resources/views/public/index.blade.php @@ -8,8 +8,6 @@ @include('files::public._files', ['model' => $page]) - @if ($models->count()) - @include('partners::public._list', ['items' => $models]) - @endif + @includeWhen($models->count() > 0, 'partners::public._list', ['items' => $models]) @endsection From e9c2670368d1daff2239e55186d3f65e2b4f18d8 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 20 Jun 2017 12:34:05 +0200 Subject: [PATCH 65/65] @push in place of @section for js/css --- src/resources/views/admin/_form.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/resources/views/admin/_form.blade.php b/src/resources/views/admin/_form.blade.php index 2888466..a042451 100644 --- a/src/resources/views/admin/_form.blade.php +++ b/src/resources/views/admin/_form.blade.php @@ -1,6 +1,6 @@ -@section('js') +@push('js') -@endsection +@endpush @component('core::admin._buttons-form', ['model' => $model]) @endcomponent