Browse Source

add enable button

pull/282/head
Kode 6 years ago
parent
commit
4fba596909
  1. 18
      app/Item.php
  2. 40
      public/css/app.css
  3. 2
      public/mix-manifest.json
  4. 35
      resources/assets/sass/_app.scss
  5. 2
      resources/views/item.blade.php
  6. 12
      resources/views/items/enable.blade.php
  7. 2
      resources/views/items/form.blade.php

18
app/Item.php

@ -143,16 +143,22 @@ class Item extends Model
if(isset($this->class) && !empty($this->class)) { if(isset($this->class) && !empty($this->class)) {
$app = new $this->class; $app = new $this->class;
} else { } else {
$details = $this->getconfig(); return false;
if($details === false) return false;
$class = $details->type;
$app = new $class;
} }
return (bool)($app instanceof \App\EnhancedApps); return (bool)($app instanceof \App\EnhancedApps);
} }
public function enabled()
{
if($this->enhanced()) {
$config = $this->getconfig();
if($config) {
return (bool) $config->enabled;
}
}
return false;
}
public function getconfig() public function getconfig()
{ {
if(!isset($this->description) || empty($this->description)) return false; if(!isset($this->description) || empty($this->description)) return false;

40
public/css/app.css

@ -789,19 +789,7 @@ body {
height: 51px; height: 51px;
} }
.module-actions { .toggleinput {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.module-actions .input {
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
@ -817,10 +805,22 @@ body {
padding: 0 20px; padding: 0 20px;
} }
.module-actions .input label.name { .toggleinput label.name {
margin-top: 6px; margin-top: 6px;
} }
.module-actions {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.module-actions .button { .module-actions .button {
font-size: 18px; font-size: 18px;
color: #515564; color: #515564;
@ -1174,7 +1174,8 @@ a.settinglink {
#sapconfig h2, .newblock h2 { #sapconfig h2, .newblock h2 {
background: #f2f3f6; background: #f2f3f6;
padding: 18px 25px; padding: 2px 25px;
height: 60px;
margin-left: -15px; margin-left: -15px;
width: calc(100% + 30px); width: calc(100% + 30px);
/* margin-right: -30px; */ /* margin-right: -30px; */
@ -1183,6 +1184,15 @@ a.settinglink {
font-size: 18px; font-size: 18px;
color: #5b5b5b; color: #5b5b5b;
font-weight: 500; font-weight: 500;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
} }
#sapconfig .items, .newblock .items { #sapconfig .items, .newblock .items {

2
public/mix-manifest.json

@ -1,4 +1,4 @@
{ {
"/css/app.css": "/css/app.css?id=22a39cc94a111a82ce68", "/css/app.css": "/css/app.css?id=2d647cf8beb1a6515945",
"/js/app.js": "/js/app.js?id=8dc4a6ea723d0df7469d" "/js/app.js": "/js/app.js?id=8dc4a6ea723d0df7469d"
} }

35
resources/assets/sass/_app.scss

@ -449,24 +449,27 @@ body {
.homesearch { .homesearch {
height: 51px; height: 51px;
} }
.toggleinput {
display: flex;
flex-direction: column-reverse;
line-height: 1;
font-size: 9px;
font-weight: 400;
text-transform: uppercase;
color: #ababab;
padding: 0 20px;
label.name {
margin-top: 6px;
}
}
.module-actions { .module-actions {
display: flex; display: flex;
justify-content:space-between; justify-content:space-between;
align-items: center; align-items: center;
.input {
display: flex;
flex-direction: column-reverse;
line-height: 1;
font-size: 9px;
font-weight: 400;
text-transform: uppercase;
color: #ababab;
padding: 0 20px;
label.name {
margin-top: 6px;
}
}
.button { .button {
font-size: 18px; font-size: 18px;
@ -780,7 +783,8 @@ div.create {
width: 100%; width: 100%;
h2 { h2 {
background: #f2f3f6; background: #f2f3f6;
padding: 18px 25px; padding: 2px 25px;
height: 60px;
margin-left: -15px; margin-left: -15px;
width: calc(100% + 30px); width: calc(100% + 30px);
/* margin-right: -30px; */ /* margin-right: -30px; */
@ -789,6 +793,9 @@ div.create {
font-size: 18px; font-size: 18px;
color: #5b5b5b; color: #5b5b5b;
font-weight: 500; font-weight: 500;
display: flex;
justify-content: space-between;
align-items: center;
} }
.items { .items {
display: flex; display: flex;

2
resources/views/item.blade.php

@ -7,7 +7,7 @@
@endif @endif
<div class="details"> <div class="details">
<div class="title{{ title_color($app->colour) }}">{{ $app->title }}</div> <div class="title{{ title_color($app->colour) }}">{{ $app->title }}</div>
@if($app->enhanced()) @if($app->enabled())
<div data-id="{{ $app->id }}" data-dataonly="{{ $app->getconfig()->dataonly ?? '0' }}" class="livestats-container"></div> <div data-id="{{ $app->id }}" data-dataonly="{{ $app->getconfig()->dataonly ?? '0' }}" class="livestats-container"></div>
@endif @endif
</div> </div>

12
resources/views/items/enable.blade.php

@ -0,0 +1,12 @@
<div class="toggleinput">
<label class="name">{{ __('app.apps.enable') }}</label>
{!! Form::hidden('config[enabled]', '0') !!}
<label class="switch">
<?php
$checked = $item->enabled();
$set_checked = ($checked) ? ' checked="checked"' : '';
?>
<input type="checkbox" name="config[enabled]" value="1"<?php echo $set_checked;?> />
<span class="slider round"></span>
</label>
</div>

2
resources/views/items/form.blade.php

@ -2,7 +2,7 @@
<header> <header>
<div class="section-title">{{ __('app.apps.add_application') }}</div> <div class="section-title">{{ __('app.apps.add_application') }}</div>
<div class="module-actions"> <div class="module-actions">
<div class="input"> <div class="toggleinput">
<label class="name">{{ __('app.apps.pinned') }}</label> <label class="name">{{ __('app.apps.pinned') }}</label>
{!! Form::hidden('pinned', '0') !!} {!! Form::hidden('pinned', '0') !!}
<label class="switch"> <label class="switch">

Loading…
Cancel
Save