From 0f95d98c37390945c0032af700e85a7ed915f163 Mon Sep 17 00:00:00 2001 From: purple Date: Sun, 26 Mar 2023 17:24:30 +0200 Subject: [PATCH] Updates to extension installation Extension logo's get imported correctly now, as well as extension buttons in the /admin/extensions page. Routes and view controllers get added automatically as well. --- blueprint.sh | 16 ++++++++++++++-- blueprint/defaults/extensions/button.default | 1 + .../extensions/blueprint/blueprint.style.css | 5 ----- resources/views/admin/extensions.blade.php | 4 ++-- routes/admin.php | 3 +-- 5 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 blueprint/defaults/extensions/button.default diff --git a/blueprint.sh b/blueprint.sh index c7d95f0..6e5ec85 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -81,25 +81,34 @@ if [[ $2 == "-i" ]]; then cp -R .blueprint/defaults/extensions/admin.default .blueprint/defaults/extensions/admin.default.bak 2> /dev/null; cp -R .blueprint/defaults/extensions/controller.default .blueprint/defaults/extensions/controller.default.bak 2> /dev/null; cp -R .blueprint/defaults/extensions/route.default .blueprint/defaults/extensions/route.default.bak 2> /dev/null; + cp -R .blueprint/defaults/extensions/button.default .blueprint/defaults/extensions/button.default.bak 2> /dev/null; mkdir public/assets/extensions/$identifier; cp .blueprint/tmp/$3/icon.jpg public/assets/extensions/$identifier/icon.jpg; - ICON="public/assets/extensions/$identifier/icon.jpg"; + ICON="/assets/extensions/$identifier/icon.jpg"; CONTENT=$(cat .blueprint/tmp/$3/admin/index.blade.php); sed -i "s!␀title␀!$name!g" .blueprint/defaults/extensions/admin.default.bak > /dev/null; sed -i "s!␀name␀!$name!g" .blueprint/defaults/extensions/admin.default.bak > /dev/null; sed -i "s!␀breadcrumb␀!$name!g" .blueprint/defaults/extensions/admin.default.bak > /dev/null; + sed -i "s?␀name␀?$name?g" .blueprint/defaults/extensions/button.default.bak > /dev/null; + sed -i "s!␀description␀!$description!g" .blueprint/defaults/extensions/admin.default.bak > /dev/null; + sed -i "s!␀version␀!$version!g" .blueprint/defaults/extensions/admin.default.bak > /dev/null; + sed -i "s?␀version␀?$version?g" .blueprint/defaults/extensions/button.default.bak > /dev/null; + sed -i "s!␀icon␀!$ICON!g" .blueprint/defaults/extensions/admin.default.bak > /dev/null; + sed -i "s!␀content␀!$CONTENT!g" .blueprint/defaults/extensions/admin.default.bak > /dev/null; sed -i "s!␀id␀!$identifier!g" .blueprint/defaults/extensions/controller.default.bak > /dev/null; sed -i "s!␀id␀!$identifier!g" .blueprint/defaults/extensions/route.default.bak > /dev/null; + sed -i "s?␀id␀?$identifier?g" .blueprint/defaults/extensions/button.default.bak > /dev/null; ADMINVIEW_RESULT=$(cat .blueprint/defaults/extensions/admin.default.bak); ADMINROUTE_RESULT=$(cat .blueprint/defaults/extensions/route.default.bak); + ADMINBUTTON_RESULT=$(cat .blueprint/defaults/extensions/button.default.bak); ADMINCONTROLLER_RESULT=$(cat .blueprint/defaults/extensions/controller.default.bak); ADMINCONTROLLER_NAME=$identifier"ExtensionController.php"; @@ -111,11 +120,14 @@ if [[ $2 == "-i" ]]; then touch app/Http/Controllers/Admin/Extensions/$identifier/$ADMINCONTROLLER_NAME; echo $ADMINCONTROLLER_RESULT > app/Http/Controllers/Admin/Extensions/$identifier/$ADMINCONTROLLER_NAME; - sed -i "s!/*␀**␀*/!$ADMINROUTE_RESULT!g" routes/admin.php > /dev/null; + echo $ADMINROUTE_RESULT >> routes/admin.php; + + sed -i "s??$ADMINBUTTON_RESULT\n?g" resources/views/admin/extensions.blade.php > /dev/null; rm .blueprint/defaults/extensions/admin.default.bak; rm .blueprint/defaults/extensions/controller.default.bak; rm .blueprint/defaults/extensions/route.default.bak; + rm .blueprint/defaults/extensions/button.default.bak; rm -R .blueprint/tmp/$3; fi; diff --git a/blueprint/defaults/extensions/button.default b/blueprint/defaults/extensions/button.default new file mode 100644 index 0000000..382e3ad --- /dev/null +++ b/blueprint/defaults/extensions/button.default @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/public/assets/extensions/blueprint/blueprint.style.css b/public/assets/extensions/blueprint/blueprint.style.css index 341e862..c9cac20 100644 --- a/public/assets/extensions/blueprint/blueprint.style.css +++ b/public/assets/extensions/blueprint/blueprint.style.css @@ -30,9 +30,4 @@ tag[blue] {background-color:#288afb;} height:25px; border-radius:3px; margin-right:2px; -}; - -.btn-row { - width:100%; - margin-bottom:25px; }; \ No newline at end of file diff --git a/resources/views/admin/extensions.blade.php b/resources/views/admin/extensions.blade.php index a8b5587..bd8633e 100644 --- a/resources/views/admin/extensions.blade.php +++ b/resources/views/admin/extensions.blade.php @@ -14,7 +14,7 @@ @section('content')
- +
- + @endsection \ No newline at end of file diff --git a/routes/admin.php b/routes/admin.php index b1704a9..1fa67f9 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -241,5 +241,4 @@ Route::group(['prefix' => 'extensions'], function () { Route::group(['prefix' => 'extensions/blueprint'], function () { Route::get('/', [Admin\Extensions\Blueprint\BlueprintExtensionController::class, 'index'])->name('admin.extensions.blueprint.index'); Route::patch('/', [Admin\Extensions\Blueprint\BlueprintExtensionController::class, 'update']); -}); -/*␀**␀*/ \ No newline at end of file +}); \ No newline at end of file