diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index bfbe9675..b427a3a6 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -304,6 +304,7 @@ class ItemController extends Controller // basic details $output['icon'] = $app_details->icon(); + $output['name'] = $app_details->name; $output['iconview'] = $app_details->iconView(); $output['colour'] = $app_details->defaultColour(); $output['class'] = $appclass; @@ -357,7 +358,7 @@ class ItemController extends Controller SupportedApps::saveApp($app, $application); } else { // check if there has been an update for this app - $localapp = $localapps->where('name', $app->name)->first(); + $localapp = $localapps->where('appid', $app->appid)->first(); if($localapp) { if($localapp->sha !== $app->sha) { SupportedApps::getFiles($app); diff --git a/app/SupportedApps.php b/app/SupportedApps.php index 55b7685d..852363d0 100644 --- a/app/SupportedApps.php +++ b/app/SupportedApps.php @@ -75,14 +75,14 @@ abstract class SupportedApps { $list_url = 'https://apps.heimdall.site/list'; $client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]); - return $client->request($this->method, $list_url); + return $client->request('GET', $list_url); } public static function getFiles($app) { $zipurl = $app->files; $client = new Client(['http_errors' => false, 'timeout' => 60, 'connect_timeout' => 15]); - $res = $client->request($this->method, $zipurl); + $res = $client->request('GET', $zipurl); if(!file_exists(app_path('SupportedApps'))) { mkdir(app_path('SupportedApps'), 0777, true); diff --git a/resources/views/items/form.blade.php b/resources/views/items/form.blade.php index bc6dcc2e..82782bd1 100644 --- a/resources/views/items/form.blade.php +++ b/resources/views/items/form.blade.php @@ -33,7 +33,7 @@
- {!! Form::text('colour', null, array('placeholder' => __('app.apps.hex'),'class' => 'form-control color-picker')) !!} + {!! Form::text('colour', null, array('placeholder' => __('app.apps.hex'), 'id' => 'appcolour', 'class' => 'form-control color-picker set-bg-elem')) !!}
@@ -74,7 +74,7 @@
-
+
@include('items.preview')
diff --git a/resources/views/items/preview.blade.php b/resources/views/items/preview.blade.php index 568e52d3..8ba1cfa3 100644 --- a/resources/views/items/preview.blade.php +++ b/resources/views/items/preview.blade.php @@ -2,7 +2,7 @@ $item = $item ?? new App\Item; ?>
-
+
@if(isset($item->icon) && !empty($item->icon)) @else diff --git a/resources/views/items/scripts.blade.php b/resources/views/items/scripts.blade.php index 6520eea7..d20e6c07 100644 --- a/resources/views/items/scripts.blade.php +++ b/resources/views/items/scripts.blade.php @@ -5,19 +5,33 @@ var elem = $('.color-picker')[0]; var hueb = new Huebee( elem, { // options + setBGColor: '.set-bg-elem' }); + hueb.on( 'change', function( color, hue, sat, lum ) { + $.get('{{ route('titlecolour') }}', {color}, function(data) { + $('#tile-preview .title').removeClass("black white"); + $('#tile-preview .link').removeClass("black white"); + $('#tile-preview .title').addClass(data); + $('#tile-preview .link').addClass(data); + }); + }) + var availableTags = @json(App\Application::all()->pluck('name')); $( "#appname" ).autocomplete({ source: availableTags, select: function( event, ui ) { - $.post('/appload', { app: ui.item.value }, function(data) { + $.post('{{ route('appload') }}', { app: ui.item.value }, function(data) { + // Main details $('#appimage').html(""); $('input[name=colour]').val(data.colour); $('select[name=class]').val(data.class); hueb.setColor( data.colour ); $('input[name=pinned]').prop('checked', true); + // Preview details + $('#tile-preview .app-icon').attr('src', data.iconview); + $('#tile-preview .title').html(data.name); if(data.config != null) { $.get('/view/'+data.config, function(getdata) { $('#sapconfig').html(getdata).show(); @@ -26,6 +40,12 @@ }, "json"); } }); + $('#appname').on('keyup change', function(e) { + $('#tile-preview .title').html($(this).val()); + }) + $('#appcolour').on('change', function(e) { + $('#tile-preview .item').css('backgroundColor', $(this).val()); + }) $('.tags').select2(); diff --git a/routes/web.php b/routes/web.php index d3eb8550..31a4379c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,7 @@ input('color'); + if($color) { + return title_color($color); + }; + +})->name('titlecolour'); + Route::resource('users', 'UserController'); /**