Initial supported apps support

This commit is contained in:
KodeStar
2018-02-05 20:59:38 +00:00
parent 0cd8f551a1
commit 3e02d92105
10 changed files with 37 additions and 7 deletions

View File

@@ -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);
}

View File

@@ -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()

View File

@@ -3,5 +3,7 @@
interface Applications {
public function defaultColour();
public function icon();
}

View File

@@ -5,4 +5,9 @@ class Nzbget implements Contracts\Applications {
{
return '#ccc';
}
public function icon()
{
return 'supportedapps/nzbget.png';
}
}

View File

@@ -5,4 +5,8 @@ class Plex implements Contracts\Applications {
{
return '#222';
}
public function icon()
{
return 'supportedapps/plex.png';
}
}

4
public/css/app.css vendored
View File

@@ -1003,6 +1003,10 @@ a.settinglink {
font-weight: 700;
}
#appimage img {
max-width: 150px;
}
/*! Huebee v2.0.0
http://huebee.buzz
---------------------------------------------- */

View File

@@ -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"
}

View File

@@ -640,4 +640,10 @@ div.create {
.ui-state-hover, .ui-state-active {
font-weight: 700;
}
#appimage {
img {
max-width: 150px;
}
}

View File

@@ -28,10 +28,12 @@
<div class="input">
<label>Icon</label>
<div id="appimage">
@if(isset($item->icon) && !empty($item->icon))
<a href="{{ asset('storage/'.$item->icon) }}">View current icon</a>
<img src="{{ asset('storage/'.$item->icon) }}" />
{!! Form::hidden('icon', $item->icon, ['class' => 'form-control']) !!}
@endif
</div>
<input name="file" type="file" class="form-control">
</div>

View File

@@ -12,8 +12,9 @@
source: availableTags,
select: function( event, ui ) {
$.post('/appload', { app: ui.item.value }, function(data) {
alert(data);
});
$('#appimage').html("<img src='/storage/"+data.icon+"' /><input type='hidden' name='icon' value='"+data.icon+"' />");
$('input[name=colour]').val(data.colour);
}, "json");
}
});
});