From f7b2c51f9d194cbba2638ab21c2045d53fe5d38b Mon Sep 17 00:00:00 2001 From: Kode Date: Wed, 16 Mar 2022 19:41:01 +0000 Subject: [PATCH] Fix for old apps and icon selector --- app/SupportedApps.php | 1 - public/css/app.css | 38 +++++++++++++++++++++++++ public/mix-manifest.json | 2 +- resources/assets/sass/_app.scss | 35 +++++++++++++++++++++++ resources/views/items/form.blade.php | 6 ++-- resources/views/items/scripts.blade.php | 22 +++++++++++--- 6 files changed, 95 insertions(+), 9 deletions(-) diff --git a/app/SupportedApps.php b/app/SupportedApps.php index d1443f46..071d0049 100644 --- a/app/SupportedApps.php +++ b/app/SupportedApps.php @@ -153,7 +153,6 @@ abstract class SupportedApps $app->icon = 'icons/'.$details->icon; $app->website = $details->website; $app->license = $details->license; - $app->appdescription = $details->description; $appclass = $app->class(); $application = new $appclass; diff --git a/public/css/app.css b/public/css/app.css index 791b8317..28a115ae 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -891,6 +891,44 @@ div.create .input input, div.create .input select { margin-left: 20px; } +#websiteiconoptions { + display: flex; + flex-direction: column; + padding: 20px; +} +#websiteiconoptions .results { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px; +} +#websiteiconoptions .header { + display: flex; + justify-content: space-between; + align-items: center; + gap: 10px; + padding: 10px 0; +} +#websiteiconoptions .selectclose { + cursor: pointer; +} + +.iconbutton { + width: 160px; + height: 160px; + display: flex; + align-items: center; + justify-content: center; + border: 1px solid #ccc; + border-radius: 4px; + cursor: pointer; +} + +.selecticon { + max-width: 120px; + height: auto; +} + .switch { position: relative; display: inline-block; diff --git a/public/mix-manifest.json b/public/mix-manifest.json index d56504d5..b00da8d3 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,4 @@ { - "/css/app.css": "/css/app.css?id=57a0971ee7b40dc03549", + "/css/app.css": "/css/app.css?id=953b8b27868431843dae", "/js/app.js": "/js/app.js?id=ff749484877e4ce6c2f6" } diff --git a/resources/assets/sass/_app.scss b/resources/assets/sass/_app.scss index 0ee17eb0..c59e716b 100644 --- a/resources/assets/sass/_app.scss +++ b/resources/assets/sass/_app.scss @@ -689,6 +689,41 @@ div.create { color: #91a1b3; margin-left: 20px; } +#websiteiconoptions { + display: flex; + flex-direction: column; + padding: 20px; + .results { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px; + } + .header { + display: flex; + justify-content: space-between; + align-items: center; + gap: 10px; + padding: 10px 0; + } + .selectclose { + cursor: pointer; + } +} +.iconbutton { + width: 160px; + height: 160px; + display: flex; + align-items: center; + justify-content: center; + border: 1px solid #ccc; + border-radius: 4px; + cursor: pointer; +} +.selecticon { + max-width: 120px; + height: auto; +} .switch { position: relative; diff --git a/resources/views/items/form.blade.php b/resources/views/items/form.blade.php index 939b1a28..3fe559d3 100644 --- a/resources/views/items/form.blade.php +++ b/resources/views/items/form.blade.php @@ -37,13 +37,13 @@
- {!! Form::text('website', null, array('placeholder' => __('app.apps.website'), 'id' => 'website', 'class' => 'form-control')) !!} + {!! Form::text('website', $item->url ?? null, array('placeholder' => __('app.apps.website'), 'id' => 'website', 'class' => 'form-control')) !!}
- +
@@ -66,7 +66,7 @@
- {!! Form::text('url', null, array('placeholder' => __('app.url'), 'id' => 'appurl', 'class' => 'form-control')) !!} + {!! Form::text('url', $item->url ?? null, array('placeholder' => __('app.url'), 'id' => 'appurl', 'class' => 'form-control')) !!}
diff --git a/resources/views/items/scripts.blade.php b/resources/views/items/scripts.blade.php index f09bca87..5f9d4b94 100644 --- a/resources/views/items/scripts.blade.php +++ b/resources/views/items/scripts.blade.php @@ -46,6 +46,15 @@ $('#tile-preview .item').css('backgroundColor', $(this).val()); }) + $('#websiteiconoptions').on('click', '.iconbutton', function (e) { + const src = $('.selecticon', this).attr('src') + $('#appimage').html(""); + $('#tile-preview .app-icon').attr('src', src); + + }).on('click', '.selectclose', function () { + $('#websiteiconoptions').html('') + }) + $('.tags').select2(); $('#searchwebsite').on('click', 'button.btn', function (e) { @@ -112,11 +121,16 @@ } websitedata.icons = icons - $('#appname').val(websitedata.title) - $('#appurl').val(websiteurl) - $('#appimage').html(""); + if ($('#appname').val() === '') $('#appname').val(websitedata.title) + if ($('#appurl').val() === '') $('#appurl').val(websiteurl) + $('input[name=pinned]').prop('checked', true); + // $('#appimage').html(""); $('#tile-preview .app-icon').attr('src', $('#appimage img').attr('src')); - $('#tile-preview .title').text(websitedata.title); + $('#tile-preview .title').text($('#appname').val()); + $('#websiteiconoptions').html('
Select IconClose
') + icons.forEach(icon => { + $('#websiteiconoptions .results').append('
') + }) console.log(websitedata) }) console.log(website)