From c90c08b904beaa65c74f1ec791c6b8c96207507a Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 5 Feb 2018 15:02:18 +0000 Subject: [PATCH] Added upgrade process --- app/Providers/AppServiceProvider.php | 7 +++++++ database/seeds/SettingsSeeder.php | 6 +++++- public/css/app.css | 18 ++++++++++++++++++ public/js/app.js | 2 ++ public/mix-manifest.json | 4 ++-- resources/assets/js/app.js | 2 ++ resources/assets/sass/_app.scss | 17 +++++++++++++++++ resources/views/item.blade.php | 2 ++ 8 files changed, 55 insertions(+), 3 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 1061a061..674b8290 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -30,6 +30,13 @@ class AppServiceProvider extends ServiceProvider if($bg_image = Setting::fetch('background_image')) { $alt_bg = ' style="background-image: url('.asset('storage/'.$bg_image).')"'; } + + // check version to see if an upgrade is needed + $db_version = Setting::fetch('version'); + $app_version = config('app.version'); + if(version_compare($app_version, $db_version) == 1) { // app is higher than db, so need to run migrations etc + Artisan::call('migrate', array('--path' => 'database/migrations', '--force' => true, '--seed' => true)); + } } view()->share('alt_bg', $alt_bg); diff --git a/database/seeds/SettingsSeeder.php b/database/seeds/SettingsSeeder.php index cc4280ae..d6ad7157 100644 --- a/database/seeds/SettingsSeeder.php +++ b/database/seeds/SettingsSeeder.php @@ -36,7 +36,10 @@ class SettingsSeeder extends Seeder $setting_group->save(); } - if(!Setting::find(1)) { + if($version = Setting::find(1)) { + $version->value = config('app.version'); + $version->save(); + } else { $setting = new Setting; $setting->id = 1; $setting->group_id = 1; @@ -47,6 +50,7 @@ class SettingsSeeder extends Seeder $setting->system = true; $setting->save(); } + if(!Setting::find(2)) { $setting = new Setting; $setting->id = 2; diff --git a/public/css/app.css b/public/css/app.css index ea8febe0..64d6050b 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -378,6 +378,24 @@ body { margin-top: 12px; } +.item-container { + position: relative; +} + +.item-container .item-edit { + color: white; + position: absolute; + bottom: 20px; + left: 8px; + width: 30px; + height: 30px; + background: rgba(0, 0, 0, 0.7); + border-radius: 50%; + text-align: center; + line-height: 30px; + display: none; +} + .message-container { width: 100%; padding: 10px 20px; diff --git a/public/js/app.js b/public/js/app.js index 519cd71c..834be77c 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -46,6 +46,7 @@ $.when( $.ready ).then(function() { app.toggleClass('header'); if(active) { $('.add-item').hide(); + $('.item-edit').hide(); $('#app').removeClass('sidebar'); $("#sortable").sortable("disable") } else { @@ -54,6 +55,7 @@ $.when( $.ready ).then(function() { function() { $('.add-item').fadeIn(); + $('.item-edit').fadeIn(); }, 350); } diff --git a/public/mix-manifest.json b/public/mix-manifest.json index adcf0e3f..2149eb01 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,4 @@ { - "/css/app.css": "/css/app.css?id=d47acbf87c5ae533ddf5", - "/js/app.js": "/js/app.js?id=a809f8ee6ee8636e0f2b" + "/css/app.css": "/css/app.css?id=93569633795ce0c63222", + "/js/app.js": "/js/app.js?id=9cbe042c4b6921658a84" } \ No newline at end of file diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index efcb3809..1eb4981b 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -37,6 +37,7 @@ $.when( $.ready ).then(function() { app.toggleClass('header'); if(active) { $('.add-item').hide(); + $('.item-edit').hide(); $('#app').removeClass('sidebar'); $("#sortable").sortable("disable") } else { @@ -45,6 +46,7 @@ $.when( $.ready ).then(function() { function() { $('.add-item').fadeIn(); + $('.item-edit').fadeIn(); }, 350); } diff --git a/resources/assets/sass/_app.scss b/resources/assets/sass/_app.scss index 04775e28..cad9f907 100644 --- a/resources/assets/sass/_app.scss +++ b/resources/assets/sass/_app.scss @@ -107,6 +107,20 @@ body { .item-container { //width: 340px; //transition: width .35s ease-in-out; + position: relative; + .item-edit { + color: white; + position: absolute; + bottom: 20px; + left: 8px; + width: 30px; + height: 30px; + background: rgba(0,0,0,0.7); + border-radius: 50%; + text-align: center; + line-height: 30px; + display: none; + } } .message-container { width: 100%; @@ -166,6 +180,9 @@ body { } .item-container { //width: 240px; + .item-edit { + //display: block; + } } .item, .add-item { transform: scale(0.9); diff --git a/resources/views/item.blade.php b/resources/views/item.blade.php index b6b2a4fe..e1b67d86 100644 --- a/resources/views/item.blade.php +++ b/resources/views/item.blade.php @@ -9,4 +9,6 @@ + +