-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
laravel-projects/packages/onix automatic push
- Loading branch information
Showing
19 changed files
with
666 additions
and
132 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<!-- Required Meta Tags --> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<!-- Document Title, Description, and Author --> | ||
<title>Wave - Bootstrap 5 One Page Template</title> | ||
<meta | ||
name="description" | ||
content="Wave is a Bootstrap 5 One Page Template." | ||
/> | ||
<meta name="author" content="BootstrapBrain" /> | ||
<!-- Favicon and Touch Icons --> | ||
<link | ||
rel="icon" | ||
type="image/png" | ||
sizes="512x512" | ||
href="./assets/favicon/favicon-512x512.png" | ||
/> | ||
{{styles}} | ||
</head> | ||
|
||
<!-- Body --> | ||
{{html}} | ||
|
||
{{scripts}} | ||
</html> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?php | ||
|
||
namespace Mariojgt\Onix\Commands; | ||
|
||
use Artisan; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\File; | ||
use Mariojgt\Onix\Model\OnixTemplate; | ||
use Mariojgt\Onix\Database\Seeders\OnixSettingsSeeder; | ||
use Mariojgt\Onix\Database\Seeders\OnixTemplateSeeder; | ||
|
||
class InstallTemplate extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'install:template {template?}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'This Command will install Onix template'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return int | ||
*/ | ||
public function handle() | ||
{ | ||
// get the template value | ||
$template = $this->argument('template'); | ||
|
||
if ($template === null) { | ||
// Read all the zip file on the template folder | ||
$templates = []; | ||
$files = File::files(public_path('templates')); | ||
foreach ($files as $file) { | ||
$templates[] = str_replace('.zip', '', $file->getFilename()); | ||
} | ||
|
||
// reordering the array | ||
$templates = array_values($templates); | ||
$this->info('Please select the template you want to install'); | ||
$this->info('----------------------------------------------'); | ||
$template = $this->choice('Select the template', $templates); | ||
} | ||
|
||
// Unzip the template | ||
$this->info('Unzipping the template'); | ||
$zip = new \ZipArchive; | ||
$res = $zip->open(public_path('templates/' . $template . '.zip')); | ||
|
||
if ($res === TRUE) { | ||
$zip->extractTo(public_path('templates/')); | ||
$zip->close(); | ||
} else { | ||
$this->error('Failed to unzip the template'); | ||
} | ||
|
||
// Copy the css and js to public folder | ||
$this->info('Copying the template assets'); | ||
File::copyDirectory(public_path('templates/' . $template . '/css'), public_path('vendor/Onix/' . $template . '/css')); | ||
File::copyDirectory(public_path('templates/' . $template . '/js'), public_path('vendor/Onix/' . $template . '/js')); | ||
|
||
// Move the blocks to the blocks folder | ||
$this->info('Copying the template blocks'); | ||
File::copyDirectory(public_path('templates/' . $template . '/blocks/phpblock/'), app_path('Onix/Blocks/')); | ||
|
||
$this->info('Copying the html template blocks'); | ||
File::copyDirectory(public_path('templates/' . $template . '/blocks/htmlblock/'), resource_path('views/onix/blocks/')); | ||
|
||
$this->info('Copying the block icons'); | ||
File::copyDirectory(public_path('templates/' . $template . '/blocks/media/'), resource_path('views/onix/media/')); | ||
|
||
// Find the seeder TemplateSeeder and run it | ||
$this->info('Running the template seeder'); | ||
$seeder = public_path('templates/' . $template . '/template.json'); | ||
// Get the class from the $seeder file | ||
$templateInfo = json_decode(file_get_contents($seeder)); | ||
|
||
|
||
$this->info('Copying the template assets'); | ||
foreach ($templateInfo->file_copy_paths as $key => $item) { | ||
File::copyDirectory(public_path($item->from), public_path($item->to)); | ||
} | ||
|
||
OnixTemplate::updateOrCreate([ | ||
'slug' => $templateInfo->template->slug, | ||
], [ | ||
'name' => $templateInfo->template->name, | ||
'slug' => $templateInfo->template->slug, | ||
'description' => $templateInfo->template->description, | ||
'css_file' => $templateInfo->template->css_file, | ||
'js_file' => $templateInfo->template->js_file, | ||
'use_manifest' => $templateInfo->template->use_manifest, | ||
'preview_image' => $templateInfo->template->preview_image, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
namespace Mariojgt\Onix\Controllers; | ||
|
||
use Illuminate\Support\Str; | ||
use Illuminate\Http\Request; | ||
use App\OnixComponents\HomePage; | ||
use Mariojgt\Onix\Model\OnixPage; | ||
use Mariojgt\Onix\Model\OnixBlock; | ||
use App\Http\Controllers\Controller; | ||
use Mariojgt\Onix\Model\OnixTemplate; | ||
use Mariojgt\Onix\Controllers\OnixApiController; | ||
|
||
class OnixTemplateController extends OnixController | ||
{ | ||
/** | ||
* @return [blade view] | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
$templates = OnixTemplate::all(); | ||
return view('onix::content.template.index', compact('templates')); | ||
} | ||
|
||
/** | ||
* @param Request $request | ||
* | ||
* @return [blade view] | ||
*/ | ||
public function edit(Request $request, OnixTemplate $template) | ||
{ | ||
$request->validate([ | ||
'name' => 'required', | ||
'slug' => 'required|unique:onix_templates,slug,' . $template->id | ||
]); | ||
|
||
$template->name = $request->name; | ||
$template->slug = Str::slug($request->slug, '-'); | ||
$template->use_manifest = $request->use_manifest == 'on' ? 1 : 0; | ||
$template->css_file = $request->css_path; | ||
$template->js_file = $request->js_path; | ||
$template->save(); | ||
|
||
return redirect()->back()->with('info', 'Page edited'); | ||
} | ||
|
||
/** | ||
* @param Request $request | ||
* | ||
* @return [blade view] | ||
*/ | ||
public function create(Request $request) | ||
{ | ||
$request->validate([ | ||
'name' => 'required', | ||
'slug' => 'required|unique:onix_templates,slug' | ||
]); | ||
$template = new OnixTemplate(); | ||
$template->name = $request->name; | ||
$template->slug = Str::slug($request->slug, '-'); | ||
$template->use_manifest = $request->use_manifest == 'on' ? 1 : 0; | ||
$template->css_file = $request->css_path; | ||
$template->js_file = $request->js_path; | ||
$template->save(); | ||
|
||
return redirect()->back()->with('info', 'Page edited'); | ||
} | ||
|
||
public function delete(Request $request, OnixTemplate $template) | ||
{ | ||
$template->delete(); | ||
|
||
return redirect()->back()->with('info', 'Page deleted'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.