Commit b1a09786 authored by Dominik Hebeler's avatar Dominik Hebeler

settings can now be deleted one by one or all at once

parent 15697a02
......@@ -218,4 +218,26 @@ class SettingsController extends Controller
->with('url', $request->input('url', ''))
->with('sumaFile', $sumaFile);
}
public function removeOneSetting(Request $request)
{
$key = $request->input('key', '');
$path = \Request::path();
$cookiePath = "/" . substr($path, 0, strpos($path, "meta/") + 5);
Cookie::queue($key, "", 0, $cookiePath, null, false, false);
return redirect($request->input('url', 'https://metager.de'));
}
public function removeAllSettings(Request $request)
{
$path = \Request::path();
$cookiePath = "/" . substr($path, 0, strpos($path, "meta/") + 5);
foreach (Cookie::get() as $key => $value) {
Cookie::queue($key, "", 0, $cookiePath, null, false, false);
}
return redirect($request->input('url', 'https://metager.de'));
}
}
......@@ -524,6 +524,7 @@ class MetaGer
}
}
# Implements Yahoo Ads if Yahoo is not enabled as a searchengine
if (!$this->apiAuthorized && empty($this->enabledSearchengines["yahoo"]) && $this->fokus != "bilder" && !empty($this->sumaFile->sumas->{"yahoo-ads"})) {
$this->enabledSearchengines["yahoo-ads"] = $this->sumaFile->sumas->{"yahoo-ads"};
......
......@@ -34,12 +34,39 @@
Ihr Schlüssel für die werbefreie Suche
@endif
</td>
<td></td>
<td>
<form action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('removeOneSetting')) }}" method="post">
<input type="hidden" name="key" value="{{ $key }}">
<input type="hidden" name="url" value="{{ url()->full() }}">
<button type="submit" title="Diesen Cookie entfernen">
<i class="fas fa-trash-alt"></i>
</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
<div id="actions">
<a href="{{ $url }}" class="btn btn-sm btn-default">Zurück zur letzten Seite</a>
<form action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('removeAllSettings'))}}" method="post">
<input type="hidden" name="url" value="{{ url()->full() }}">
<button type="submit" class="btn btn-sm btn-danger">Alle Einstellungen entfernen</button>
</form>
</div>
</div>
</div>
</div>
<style>
#actions {
display: flex;
margin-left: -8px;
align-items: center;
justify-content: center;
}
#actions > a, #actions > form {
margin-left: 8px;
}
</style>
@endsection
......@@ -22,6 +22,9 @@ Route::group(
# Route to show and delete all settings
Route::get('all-settings', 'SettingsController@allSettingsIndex')->name('showAllSettings');
Route::post('all-settings/removeOne', 'SettingsController@removeOneSetting')->name('removeOneSetting');
Route::post('all-settings/removeAll', 'SettingsController@removeAllSettings')->name('removeAllSettings');
});
}
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment