add enable button

This commit is contained in:
Kode 2018-10-29 19:01:25 +00:00
parent af04781830
commit 4fba596909
7 changed files with 73 additions and 38 deletions

View file

@ -143,16 +143,22 @@ class Item extends Model
if(isset($this->class) && !empty($this->class)) {
$app = new $this->class;
} else {
$details = $this->getconfig();
if($details === false) return false;
$class = $details->type;
$app = new $class;
return false;
}
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()
{
if(!isset($this->description) || empty($this->description)) return false;

40
public/css/app.css vendored
View file

@ -789,19 +789,7 @@ body {
height: 51px;
}
.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 .input {
.toggleinput {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
@ -817,10 +805,22 @@ body {
padding: 0 20px;
}
.module-actions .input label.name {
.toggleinput label.name {
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 {
font-size: 18px;
color: #515564;
@ -1174,7 +1174,8 @@ a.settinglink {
#sapconfig h2, .newblock h2 {
background: #f2f3f6;
padding: 18px 25px;
padding: 2px 25px;
height: 60px;
margin-left: -15px;
width: calc(100% + 30px);
/* margin-right: -30px; */
@ -1183,6 +1184,15 @@ a.settinglink {
font-size: 18px;
color: #5b5b5b;
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 {

View file

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

View file

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

View file

@ -7,7 +7,7 @@
@endif
<div class="details">
<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>
@endif
</div>

View file

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

View file

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