FIX: fix minor bugs in blog module

This commit is contained in:
Michal Kváček
2016-10-04 11:16:04 +02:00
parent 581e32e98b
commit f699d2c569
3 changed files with 81 additions and 97 deletions
+2 -1
View File
@@ -11,7 +11,8 @@ class Comment extends Model
'content_id', 'content_id',
'content', 'content',
'email', 'email',
'name' 'name',
'approved'
]; ];
public function author() public function author()
@@ -40,7 +40,8 @@ class CreateNewComment extends Controller
'content_id' => $article->id, 'content_id' => $article->id,
'name' => $name, 'name' => $name,
'email' => $email, 'email' => $email,
'content' => $content 'content' => $content,
'approved' => !is_null($user)
]); ]);
// fire event about new comment // fire event about new comment
@@ -1,12 +1,9 @@
<?php namespace Modules\Blog\ArticleList\Providers; <?php namespace Modules\Blog\ArticleList\Providers;
use App\Handlers\Registrators\TemplateRegistrator;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use InvalidArgumentException;
use Modules\Blog\ArticleList\Handlers\ArticleList;
class ArticleListServiceProvider extends ServiceProvider {
class ArticleListServiceProvider extends ServiceProvider
{
/** /**
* Indicates if loading of the provider is deferred. * Indicates if loading of the provider is deferred.
* *
@@ -55,29 +52,15 @@ class ArticleListServiceProvider extends ServiceProvider {
{ {
$viewPath = base_path('resources/views/modules/articlelist'); $viewPath = base_path('resources/views/modules/articlelist');
$sourcePath = __DIR__ . '/../Resources/views'; $sourcePath = __DIR__ . '/../Resources/views';
if (!is_dir($sourcePath)) {
return;
}
$this->publishes([$sourcePath => $viewPath]); $this->publishes([$sourcePath => $viewPath]);
$this->loadViewsFrom(array_merge(array_map(function ($path) { $this->loadViewsFrom(array_merge(array_map(function ($path) {
return $path . '/modules/articlelist'; return $path . '/modules/articlelist';
}, \Config::get('view.paths')), [$sourcePath]), 'articlelist'); }, \Config::get('view.paths')), [$sourcePath]), 'articlelist');
/**
* @var $registrator TemplateRegistrator
*/
try {
// setup some global variables
$registrator = $this->app->make('registerTemplateDir');
$registrator->setBaseDirectory('resources/views/modules/articlelist/visitor');
$registrator->setNamespace('articlelist');
$registrator->setModuleId(ArticleList::getModuleId());
// register path with current template name
$registrator->register(config('app.theme'), 'articlelist::module.templatePath');
} catch (InvalidArgumentException $e) {
// ignore this exception
}
} }
/** /**
@@ -105,5 +88,4 @@ class ArticleListServiceProvider extends ServiceProvider {
{ {
return array (); return array ();
} }
} }