diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index 15f000aa..0c863244 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -246,7 +246,13 @@ class ItemController extends Controller public function appload(Request $request) { $app = $request->input('app'); - return "a: ".$app; + if($app) { + $all_supported = Item::supportedList(); + $app_details = new $all_supported[$app]; + } + $output['icon'] = $app_details->icon(); + $output['colour'] = $app_details->defaultColour(); + return json_encode($output); } diff --git a/app/Item.php b/app/Item.php index 2121698d..9abc4971 100644 --- a/app/Item.php +++ b/app/Item.php @@ -26,8 +26,8 @@ class Item extends Model public static function supportedList() { return [ - 'NZBGet' => App\SupportedApps\Nzbget::class, - 'Plex' => App\SupportedApps\Plex::class, + 'NZBGet' => \App\SupportedApps\Nzbget::class, + 'Plex' => \App\SupportedApps\Plex::class, ]; } public static function supportedOptions() diff --git a/app/SupportedApps/Contracts/Applications.php b/app/SupportedApps/Contracts/Applications.php index 31fe5e58..535c7958 100644 --- a/app/SupportedApps/Contracts/Applications.php +++ b/app/SupportedApps/Contracts/Applications.php @@ -3,5 +3,7 @@ interface Applications { public function defaultColour(); + + public function icon(); } \ No newline at end of file diff --git a/app/SupportedApps/Nzbget.php b/app/SupportedApps/Nzbget.php index 529b2d8d..91a13b71 100644 --- a/app/SupportedApps/Nzbget.php +++ b/app/SupportedApps/Nzbget.php @@ -5,4 +5,9 @@ class Nzbget implements Contracts\Applications { { return '#ccc'; } + public function icon() + { + return 'supportedapps/nzbget.png'; + } + } \ No newline at end of file diff --git a/app/SupportedApps/Plex.php b/app/SupportedApps/Plex.php index fd724736..669d36d5 100644 --- a/app/SupportedApps/Plex.php +++ b/app/SupportedApps/Plex.php @@ -5,4 +5,8 @@ class Plex implements Contracts\Applications { { return '#222'; } + public function icon() + { + return 'supportedapps/plex.png'; + } } \ No newline at end of file diff --git a/public/css/app.css b/public/css/app.css index 2b8ecb9b..ec198820 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -1003,6 +1003,10 @@ a.settinglink { font-weight: 700; } +#appimage img { + max-width: 150px; +} + /*! Huebee v2.0.0 http://huebee.buzz ---------------------------------------------- */ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 4f70ff4e..2c387c10 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,4 @@ { - "/css/app.css": "/css/app.css?id=e01da6a30207cefea3dd", + "/css/app.css": "/css/app.css?id=69336a09561650860b52", "/js/app.js": "/js/app.js?id=2dffa24cf7255229e085" } \ No newline at end of file diff --git a/resources/assets/sass/_app.scss b/resources/assets/sass/_app.scss index 198b7086..7bf5a22d 100644 --- a/resources/assets/sass/_app.scss +++ b/resources/assets/sass/_app.scss @@ -640,4 +640,10 @@ div.create { .ui-state-hover, .ui-state-active { font-weight: 700; +} + +#appimage { + img { + max-width: 150px; + } } \ No newline at end of file diff --git a/resources/views/items/form.blade.php b/resources/views/items/form.blade.php index 9a74ddaa..1c065f4c 100644 --- a/resources/views/items/form.blade.php +++ b/resources/views/items/form.blade.php @@ -28,10 +28,12 @@
+
@if(isset($item->icon) && !empty($item->icon)) - View current icon + {!! Form::hidden('icon', $item->icon, ['class' => 'form-control']) !!} @endif +
diff --git a/resources/views/items/scripts.blade.php b/resources/views/items/scripts.blade.php index ba767781..821238dc 100644 --- a/resources/views/items/scripts.blade.php +++ b/resources/views/items/scripts.blade.php @@ -12,8 +12,9 @@ source: availableTags, select: function( event, ui ) { $.post('/appload', { app: ui.item.value }, function(data) { - alert(data); - }); + $('#appimage').html(""); + $('input[name=colour]').val(data.colour); + }, "json"); } }); });