Commit c537825b authored by Karl Hasselbring's avatar Karl Hasselbring
Browse files

Merge branch '612' into 'MetaGer-Redesign'

612

See merge request !1081
parents ea1b69bb 717c2039
......@@ -22,8 +22,23 @@ class StartpageController extends Controller
$focusPages = [];
$theme = "default";
$optionParams = ['param_sprueche', 'param_newtab', 'param_maps', 'param_autocomplete', 'param_lang', 'param_key'];
$option_values = [];
foreach ($optionParams as $param) {
$value = $request->input($param);
if ($value) {
$option_values[$param] = $value;
}
}
$autocomplete = 'on';
if(in_array('autocomplete', array_keys($option_values))) {
$autocomplete = $option_values['autocomplete'];
}
foreach ($request->all() as $key => $value) {
if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_newtab' && $key !== 'param_maps' && $key !== 'param_autocomplete' && $key !== 'param_lang') {
if ($value === 'on' && !in_array($key, $optionParams)) {
$focusPages[] = str_replace('param_', '', $key);
}
if ($key === 'param_theme') {
......@@ -43,16 +58,12 @@ class StartpageController extends Controller
->with('browser', (new Agent())->browser())
->with('navbarFocus', 'suche')
->with('theme', $theme)
->with('autocomplete', $request->input('param_autocomplete', 'on'))
->with('foki', $this->loadFoki())
->with('focus', $request->input('focus', 'web'))
->with('lang', $request->input('param_lang', $lang))
->with('resultCount', $request->input('param_resultCount', '20'))
->with('time', $request->input('param_time', '1500'))
->with('sprueche', $request->input('param_sprueche', 'on'))
->with('newtab', $request->input('param_newtab', 'on'))
->with('maps', $maps = $request->input('param_maps', 'off'))
->with('key', $request->input('param_key', ''));
->with('request', $request->input('request', 'GET'))
->with('option_values', $option_values)
->with('autocomplete', $autocomplete);
}
public function loadPage($subpage)
......
......@@ -28,9 +28,7 @@ function loadLocalStorage () {
$('#theme').attr('href', '/css/theme.css.php?r=' + theme[0] + '&g=' + theme[1] + '&b=' + theme[2] + '&a=' + theme[3]);
}
}
if (localStorage.getItem('pers') && !isUseOnce()) {
setSettings();
}
setSettings();
}
}
......@@ -79,9 +77,9 @@ function setActionListeners () {
* Loads stored settings from local storage
*/
function setSettings () {
var acceptedParams = ['autocomplete', 'key', 'lang', 'newtab', 'sprueche'];
for (var key in localStorage) {
var value = localStorage.getItem(key);
var acceptedParams = ['autocomplete', 'key', 'lang', 'maps', 'newtab', 'sprueche', 'autocomplete'];
var accepted = false;
for (var i in acceptedParams) {
if (key === 'param_' + acceptedParams[i]) {
......@@ -90,19 +88,13 @@ function setSettings () {
}
if (accepted) {
key = key.substring(6);
$('#searchForm').append('<input type="hidden" name="' + key + '" value="' + value + '">');
// Check for existing hidden fields for this key
var existing = $('.search-hidden input[name="' + key + '"]');
if (existing.length === 0) {
// if none exist, create a new one
$('.search-hidden').append('<input type="hidden" name="' + key + '" value="' + value + '">');
}
}
$('#foki input[type=radio]#angepasst').attr('checked', true);
}
// Change the value of the lang input field to the given parameter
var lang = localStorage.getItem('param_lang');
if (lang !== null) {
$('input[name=lang]').val(lang);
}
// Change the value of the lang input field to the given parameter
var autocomplete = localStorage.getItem('param_autocomplete');
if (autocomplete !== null) {
$('input[name=eingabe]').attr('autocomplete', autocomplete);
}
// Change the request method to the given parameter
var requestMethod = localStorage.getItem('request');
......
#searchForm {
select {
font-size: 15px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-color: white;
padding-right: 35px;
.mg-panel {
@media(max-width: @screen-sm) {
width: 100%;
}
input {
height: 40px;
font-size: 16px;
@media(min-width: @screen-sm) {
width: @screen-sm;
}
button {
font-size: 16px;
}
.search-bar {
display: flex;
align-items: stretch;
font-size: 16px;
.search-focus-selector {
background-color: transparent;
border: 1px solid #aaa;
border-radius: 5px 0px 0px 5px;
select {
width: 100%;
color: #777;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-color: transparent;
padding-right: 35px;
}
}
.search-input-submit {
flex-grow: 1;
border-left: none;
border: 1px solid #aaa;
border-left: none;
border-radius: 0px 5px 5px 0px;
display: flex;
}
.search-input {
flex-grow: 1;
input {
border: none;
height: 40px;
&:focus {
outline-color: rgb(255, 128, 0);
-webkit-box-shadow: 0px 0px 2px 2px rgba(255, 128, 0, 1);
-moz-box-shadow: 0px 0px 2px 2px rgba(255, 128, 0, 1);
box-shadow: 0px 0px 2px 2px rgba(255, 128, 0, 1);
border-color: rgba(255, 128, 0, 1);
}
}
}
.search-submit {
border-left: 1px solid #aaa;
button {
width: 50px;
line-height: 100%;
border: 0;
background-color: transparent;
padding: 0;
height: 100%;
}
}
.search-hidden {
display: none;
}
@media (max-width: @screen-xs-max) {
flex-direction: column-reverse;
.search-focus-selector {
border: 1px solid #aaa;
border-top: none;
border-radius: 5px;
}
.search-input-submit {
border: 1px solid #aaa;
border-radius: 5px;
}
}
}
.focus-selector {
.search-focus-selector {
background-color: white;
position: relative;
text-overflow: ellipsis;
&:after {
content: "\f078";
font: 15px "FontAwesome", sans-serif;
//text-align: center;
font: 15px "FontAwesome", sans-serif; //text-align: center;
line-height: 30px;
color: #aaa;
background-color: transparent;
......
......@@ -206,15 +206,6 @@ nav {
}
}
#searchForm button {
width: 50px;
line-height: 100%;
height: 28px;
border: 0;
background-color: transparent;
padding: 0;
}
li#info {
white-space: pre-line;
}
......@@ -553,12 +544,6 @@ label a {
}
}
#submit-inputgroup {
background-color: inherit;
border-left: 0;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
input[name=eingabe] {
border-right: 0;
box-shadow: inset 0 1px 0px rgba(0, 0, 0, 0.075);
......
......@@ -263,34 +263,37 @@
</div>
</div>-->
<fieldset>
<form id="searchForm" @if(Request::has('request') && Request::input('request') === "POST") method="POST" @elseif(Request::has('request') && Request::input('request') === "GET") method="GET" @else method="GET" @endif action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/meta/meta.ger3") }}" accept-charset="UTF-8">
<div class="input-group">
<div class="focus-selector input-group-addon">
<select name="focus" style="font-family: FontAwesome, sans-serif;">
<option value="web" style="font-family: FontAwesome, sans-serif;" selected >&#xf0ac; Websuche</option>
<option value="nachrichten" style="font-family: FontAwesome, sans-serif;" >&#xf0a1; Nachrichtensuche</option>
<option value="wissenschaft" style="font-family: FontAwesome, sans-serif;" >&#xf15c; Wissenschaftssuche</option>
<option value="produktsuche" style="font-family: FontAwesome, sans-serif;" >&#xf07a; Produktsuche</option>
<option value="maps" style="font-family: FontAwesome, sans-serif;" >&#xf279; Kartensuche</option>
</select>
<form id="searchForm" method={{ $request }} action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/meta/meta.ger3") }}" accept-charset="UTF-8">
<div class="search-bar">
<div class="search-focus-selector">
<select name="focus" style="font-family: FontAwesome, sans-serif;">
<option value="web" style="font-family: FontAwesome, sans-serif;" selected >&#xf0ac; Websuche</option>
<option value="nachrichten" style="font-family: FontAwesome, sans-serif;" >&#xf0a1; Nachrichtensuche</option>
<option value="wissenschaft" style="font-family: FontAwesome, sans-serif;" >&#xf15c; Wissenschaftssuche</option>
<option value="produktsuche" style="font-family: FontAwesome, sans-serif;" >&#xf07a; Produktsuche</option>
<option value="maps" style="font-family: FontAwesome, sans-serif;" >&#xf279; Kartensuche</option>
</select>
</div>
<input type="text" name="eingabe" required="" autofocus="" autocomplete="{{$autocomplete}}" class="form-control" placeholder="{{ trans('index.placeholder') }}">
<input type="hidden" name="encoding" value="utf8">
<input type="hidden" name="lang" value={{ $lang }} >
<input type="hidden" name="resultCount" value={{ $resultCount }} >
<input type="hidden" name="time" value={{ $time }} >
<input type="hidden" name="sprueche" value={{ $sprueche }} >
<input type="hidden" name="newtab" value={{ $newtab }} >
<input type="hidden" name="maps" value={{ $maps }} >
<input type="hidden" name="key" value={{ $key }} >
@foreach ($focusPages as $fp)
<input type="hidden" name={{ $fp }} value="on">
@endforeach
<input type="hidden" name="theme" value={{ $theme }}>
<div class="input-group-addon" id="submit-inputgroup">
<button type="submit">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
<div class="search-input-submit">
<div class="search-input">
<input type="text" name="eingabe" required="" autofocus="" autocomplete="{{$autocomplete}}" class="form-control" placeholder="{{ trans('index.placeholder') }}">
</div>
<div class="search-submit" id="submit-inputgroup">
<button type="submit">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
</div>
</div>
<div class="search-hidden">
<input type="hidden" name="encoding" value="utf8">
@foreach($option_values as $option => $value)
<input type="hidden" name={{ $option }} value={{ $value }}>
@endforeach
<input type="hidden" name="time" value={{ $time }}>
@foreach ($focusPages as $fp)
<input type="hidden" name={{ $fp }} value="on">
@endforeach
<input type="hidden" name="theme" value={{ $theme }}>
</div>
</div>
</form>
......
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