Merge pull request #187 from GrahamForks/banner-disable

Banner can now be removed
This commit is contained in:
Graham Campbell
2015-01-01 11:25:46 +00:00
3 changed files with 20 additions and 2 deletions

View File

@@ -87,4 +87,11 @@ $(function() {
}
});
});
// Banner removal JS
$('#remove-banner').click(function(){
$('#banner-view').remove();
$('input[name=remove_banner]').val('1');
$('#settings-form').submit();
});
});

View File

@@ -108,6 +108,13 @@ class DashSettingsController extends Controller
// Fetch all of the settings we've been POSTed.
$settings = Input::all();
if ($settings['remove_banner'] == "1") {
$setting = Setting::where('name', 'app_banner');
$setting->delete();
}
unset($settings['remove-banner']);
if (Input::hasFile('app_banner')) {
$file = Input::file('app_banner');

View File

@@ -13,7 +13,7 @@
<div class="content-wrapper">
<div class="row">
<div class="col-sm-12">
<form name='SettingsForm' class='form-vertical' role='form' action='/dashboard/settings' method='POST' enctype="multipart/form-data">
<form id="settings-form" name='SettingsForm' class='form-vertical' role='form' action='/dashboard/settings' method='POST' enctype="multipart/form-data">
<h4 class="sub-header" id='application-setup'>Application Setup</h4>
@if(($saved = Session::get('saved')))
@@ -52,8 +52,10 @@
<div class='form-group'>
<label>Banner Image</label>
@if($banner = Setting::get('app_banner'))
<div class='well'>
<div id="banner-view" class='well'>
<img src='data:{{ Setting::get("app_banner_type") }};base64,{{ $banner }}' style='max-width: 100%' />
<br /><br />
<button id="remove-banner" class="btn btn-danger">Remove</button>
</div>
@endif
<input type='file' name='app_banner' class='form-control' />
@@ -70,6 +72,8 @@
</div>
</div>
</div>
<input type="hidden" name="remove_banner" value="" />
</form>
</div>
</div>