FEATURE: add blade template registration into templates

This commit is contained in:
Michal Kváček
2016-09-20 11:50:41 +02:00
parent f087da1b43
commit d43073a011
17 changed files with 191 additions and 108 deletions
+18 -15
View File
@@ -33,14 +33,21 @@ class SetTemplate extends Command
}
// try to find currently installed template
$current = Module::where('is_template', true)->first();
$current = Module::where('is_template', true)
->first();
// install template
$config = @include $templatePath . '/config.php';
$config['staticName'] = $template;
if ($current) {
$this->line('Template is already set up. Currently using '.trans($current->name).'.');
$confirm = $this->ask('Uninstall it and install '.$template.'? [y/n]');
$info = json_decode($current->module_settings);
$this->line('Template is already installed. Currently using template ' . trans($current->name) . ' located in /templates/' . $info->staticName.'.');
$confirm = $this->ask('Uninstall it and install *' . trans($config['name']) . '*? All data associated with installed template will be lost! [y/n]');
if ($confirm === 'y') {
$this->line('Uninstalling '.$current->name.'.');
$this->line('Uninstalling ' . $current->name . '.');
$current->uninstall();
} else {
$this->line('Aborting installation.');
@@ -48,24 +55,20 @@ class SetTemplate extends Command
}
}
// install template
$config = @include $templatePath . '/config.php';
try {
$config['staticName'] = $template;
Module::install($config['name'], $config['alias'], $config['description'], $config['handler'], false, $config);
} catch (\Exception $e) {
$this->error('Cannot install template '.$template.'.');
$this->error('Cannot install template ' . $template . '. Message: ' . $e->getMessage());
return;
}
// theme written
$this->line('Template successfully setup.');
// $this->line('');
// $this->line(' ** PUBLISHING ASSETS AND VIEWS **');
// // publish assets and views for module and theme
// $this->call('vendor:publish', ['--tag' => ['public-assets'], '--force' => true]);
// $this->call('vendor:publish', ['--tag' => ['module-views'], '--force' => true]);
// $this->call('vendor:publish');
$this->line('');
$this->line(' ** PUBLISHING ASSETS AND VIEWS **');
// publish assets and views for module and theme
$this->call('vendor:publish', ['--tag' => ['public-assets'], '--force' => true]);
$this->call('vendor:publish', ['--tag' => ['module-views'], '--force' => true]);
$this->call('vendor:publish');
}
}