Commit 16a9d6de authored by Dominik Hebeler's avatar Dominik Hebeler

Merge branch '967-make-quotes-optional-by-settings' into 'development'

Resolve "Make Quotes Optional by settings"

Closes #969 and #967

See merge request !1594
parents f34f983b 8fbd35d4
......@@ -22,7 +22,6 @@ class MailController extends Controller
*/
public function contactMail(Request $request)
{
# Nachricht, die wir an den Nutzer weiterleiten:
$messageType = ""; # [success|error]
$returnMessage = '';
......@@ -52,15 +51,19 @@ class MailController extends Controller
if (!$request->filled('message') || !$request->filled('subject')) {
$messageType = "error";
$returnMessage = "Tut uns leid, aber leider haben wir mit Ihrer Kontaktanfrage keine Daten erhalten. Die Nachricht wurde nicht versandt.";
$returnMessage = trans('kontakt.error.1');
} else {
# Wir versenden die Mail des Benutzers an uns:
$mailto = "support@metager.org";
if(LaravelLocalization::getCurrentLocale() === "de"){
$mailto = "support@suma-ev.de";
}
$message = $request->input('message');
$subject = $request->input('subject');
Mail::to("support@suma-ev.de")
Mail::to($mailto)
->send(new Kontakt($name, $replyTo, $subject, $message));
$returnMessage = 'Ihre Nachricht wurde uns erfolgreich zugestellt. Vielen Dank dafür! Wir werden diese schnellstmöglich bearbeiten und uns dann ggf. wieder bei Ihnen melden.';
$returnMessage = trans('kontakt.success.1');
$messageType = "success";
}
......
......@@ -289,11 +289,12 @@ class MetaGerSearch extends Controller
public function quicktips(Request $request)
{
$search = $request->input('search', '');
$quotes = $request->input('quotes', 'on');
if(empty($search)){
abort(404);
}
$quicktips = new \App\Models\Quicktips\Quicktips($search);
$quicktips = new \App\Models\Quicktips\Quicktips($search, $quotes);
return view('quicktips')
->with('quicktips', $quicktips->getResults())
->with('search', $search);
......
......@@ -192,6 +192,30 @@ class SettingsController extends Controller
}
public function enableSetting(Request $request) {
$fokus = $request->input('fokus', '');
$url = $request->input('url', '');
// Currently only the setting for quotes is supported
$quotes = $request->input('zitate', '');
if (empty($fokus) || empty($quotes)) {
abort(404);
}
if($quotes === "off"){
$path = \Request::path();
$cookiePath = "/" . substr($path, 0, strpos($path, "meta/") + 5);
Cookie::queue($fokus . "_setting_zitate", "off", 0, $cookiePath, null, false, false);
}elseif($quotes === "on") {
$path = \Request::path();
$cookiePath = "/" . substr($path, 0, strpos($path, "meta/") + 5);
Cookie::queue($fokus . "_setting_zitate", "", 0, $cookiePath, null, false, false);
}else{
abort(404);
}
return redirect(LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('settings', ["fokus" => $fokus, "url" => $url])));
}
public function deleteSettings(Request $request)
{
$fokus = $request->input('fokus', '');
......
......@@ -244,7 +244,7 @@ class MetaGer
->with('apiAuthorized', $this->apiAuthorized)
->with('metager', $this)
->with('browser', (new Agent())->browser())
->with('quicktips', action('MetaGerSearch@quicktips', ["search" => $this->eingabe]))
->with('quicktips', action('MetaGerSearch@quicktips', ["search" => $this->eingabe, "quotes" => $this->sprueche]))
->with('resultcount', count($this->results))
->with('focus', $this->fokus);
break;
......@@ -951,13 +951,15 @@ class MetaGer
$this->agent = new Agent();
$this->mobile = $this->agent->isMobile();
# Sprüche
$this->sprueche = $request->input('sprueche', 'on');
if ($this->sprueche === "on") {
$this->sprueche = true;
} else {
$this->sprueche = false;
if (!App::isLocale("de") || (\Cookie::has($this->getFokus() . '_setting_zitate') && \Cookie::get($this->getFokus() . '_setting_zitate') === "off")) {
$this->sprueche = "off";
}else{
$this->sprueche = "on";
}
if($request->filled("zitate") && $request->input('zitate') === "on" || $request->input('zitate') === "off"){
$this->sprueche = $request->input('quotes');
}
$this->newtab = $request->input('newtab', 'on');
if ($this->newtab === "on") {
$this->newtab = "_blank";
......@@ -982,9 +984,7 @@ class MetaGer
}
$request->replace($newInput);
}
if (App::isLocale("en")) {
$this->sprueche = "off";
}
if ($this->resultCount <= 0 || $this->resultCount > 200) {
$this->resultCount = 1000;
}
......
......@@ -16,7 +16,7 @@ class Quicktips
private $hash;
public function __construct($search/*, $locale, $max_time*/)
public function __construct($search, $quotes)
{
$locale = LaravelLocalization::getCurrentLocale();
if (env("APP_ENV") === "production") {
......@@ -24,12 +24,12 @@ class Quicktips
} else {
$this->quicktipUrl = "https://dev.quicktips.metager.de" . $this->quicktipUrl;
}
$this->startSearch($search, $locale);
$this->startSearch($search, $quotes, $locale);
}
public function startSearch($search, $locale)
public function startSearch($search, $quotes, $locale)
{
$url = $this->quicktipUrl . "?search=" . $this->normalize_search($search) . "&locale=" . $locale;
$url = $this->quicktipUrl . "?search=" . $this->normalize_search($search) . "&locale=" . $locale . "&quotes=" . $quotes;
$this->hash = md5($url);
if (!Cache::has($this->hash)) {
......
$(document).ready(function () {
$("#filter-form").find("button[type=submit]").css("display", "none");
$("#filter-form").find("select").on("change", function () {
$("#filter-form").submit();
$("#filter-form, #setting-form").find("button[type=submit]").css("display", "none");
$("#filter-form, #setting-form").find("select").on("change", function () {
$(this).closest('form').submit();
});
console.log("Test");
});
\ No newline at end of file
......@@ -12,7 +12,7 @@ Alternativ können Sie uns natürlich auch per <a href="mailto:support@suma-ev.d
'form.8' => 'Senden',
'mail.1' => 'Per E-Mail',
'mail.2' => 'Sie können uns auch direkt eine E-Mail an die folgende Adresse schicken: <a href="mailto:office@suma-ev.de">office@suma-ev.de</a>',
'mail.2' => 'Sie können uns auch direkt eine E-Mail an die folgende Adresse schicken: <a href="mailto::mail">:mail</a>',
'mail.3' => 'Falls Sie diese verschlüsseln wollen, finden Sie nachfolgend unseren öffentlichen OpenPGP-Schlüssel:',
'letter.1' => 'Per Brief-Post',
'letter.2' => 'Wir ziehen es vor, auf digitalem Wege kontaktiert zu werden.
......@@ -22,4 +22,6 @@ erreichen Sie uns unter der folgenden Adresse:',
Röselerstr. 3
30159 Hannover
Germany',
'error.1' => 'Tut uns leid, aber leider haben wir mit Ihrer Kontaktanfrage keine Daten erhalten. Die Nachricht wurde nicht versandt.',
'success.1' => 'Ihre Nachricht wurde uns erfolgreich zugestellt. Vielen Dank dafür! Wir werden diese schnellstmöglich bearbeiten und uns dann ggf. wieder bei Ihnen melden.'
];
......@@ -12,7 +12,7 @@ return [
'form.8' => 'Send',
'mail.1' => 'By Email',
'mail.2' => 'You can also email us directly at: <a href="mailto:office@suma-ev.de">office@suma-ev.de</a>',
'mail.2' => 'You can also email us directly at: <a href="mailto::mail">:mail</a>',
'mail.3' => 'If you want to encrypt your email you can use our following public OpenPGP-Key:',
'letter.1' => 'By Letter Mail',
'letter.2' => 'We prefer digital contact. However, if you consider it neccessary to contact us postally, you can mail us at:',
......@@ -20,4 +20,6 @@ return [
Röselerstr. 3
30159 Hannover
Germany',
'error.1' => 'We are sorry, but unfortunately we did not receive any data with your contact request. The message was not sent.',
'success.1' => 'Your message was successfully sent to us. Thanks a lot for this! We will process this as soon as possible and then contact you again if necessary.'
];
......@@ -11,10 +11,12 @@ return [
"form.8" => "Encriptar y enviar",
"mail.1" => "Por email",
"mail.2" => "Nos puede mandar un email directamente a la siguiente direccion: <a href=\"mailto:office@suma-ev.de\">office@suma-ev.de</a>",
"mail.2" => 'Nos puede mandar un email directamente a la siguiente direccion: <a href="mailto::mail">:mail</a>',
"mail.3" => "Si la quiere encriptar, puede ver nuestra llave pública de OpenPGP aquí:",
"letter.1" => "Por carta",
"letter.2" => "Preferimos que nos contacte por medios digitales. Si lo ve indispensable contactarnos vía correo fisico, nos puede escribir a la siguiente dirección:",
"letter.3" => "SUMA-EV Röselerstr. 3 30159 Hannover Germany",
'error.1' => "Lo sentimos, pero desafortunadamente no recibimos ningún dato con su solicitud de contacto. El mensaje no fue enviado.",
'success.1' => "Su mensaje nos fue enviado con éxito. ¡Muchas gracias por esto! Procesaremos esto lo antes posible y luego lo contactaremos nuevamente si es necesario."
];
......@@ -37,7 +37,11 @@
</div>
<div class="card-heavy">
<h2>{!! trans('kontakt.mail.1') !!}</h2>
<p>{!! trans('kontakt.mail.2') !!}</p>
@if(LaravelLocalization::getCurrentLocale() === "de")
<p>{!! trans('kontakt.mail.2', ["mail" => "support@suma-ev.de"]) !!}</p>
@else
<p>{!! trans('kontakt.mail.2', ["mail" => "support@metager.org"]) !!}</p>
@endif
<p>{!! trans('kontakt.mail.3') !!}</p>
<textarea id="pubkey" style="width:50%" rows="8" readonly>@include('kontakt/pgp')</textarea>
</div>
......
......@@ -84,6 +84,23 @@
</form>
</div>
@if(LaravelLocalization::getCurrentLocale() === "de")
<div class="card-light">
<h2>Weitere Einstellungen</h2>
<form id="setting-form" action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('enableSetting')) }}" method="post" class="form">
<input type="hidden" name="fokus" value="{{ $fokus }}">
<input type="hidden" name="url" value="{{ $url }}">
<div class="form-group">
<label for="zitate">Zitate</label>
<select name="zitate" id="zitate" class="form-control">
<option value="on" @if(Cookie::get($fokus . "_setting_zitate") === null)disabled selected @endif>Anzeigen</option>
<option value="off" {{ Cookie::get($fokus . "_setting_zitate") === "off" ? "disabled selected" : "" }}>Nicht Anzeigen</option>
</select>
</div>
<button type="submit" class="btn btn-default">@lang('settings.save')</button>
</form>
</div>
@endif
<div class="card-light" id="actions">
@if($settingActive)
<div id="reset">
......
......@@ -18,6 +18,7 @@ Route::group(
Route::post('de', 'SettingsController@disableSearchEngine')->name('disableEngine');
Route::post('ee', 'SettingsController@enableSearchEngine')->name('enableEngine');
Route::post('ef', 'SettingsController@enableFilter')->name('enableFilter');
Route::post('es', 'SettingsController@enableSetting')->name('enableSetting');
Route::post('ds', 'SettingsController@deleteSettings')->name('deleteSettings');
# Route to show and delete all settings
......
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