v0.5.17a - Made darkmode
This commit is contained in:
parent
89f8b2be44
commit
511b4a288b
|
@ -513,4 +513,20 @@ class UserController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setDarkMode(Request $request){
|
||||||
|
if($request->ajax()){
|
||||||
|
if($request->darkmode === "dark"){
|
||||||
|
$response = new Response('dark');
|
||||||
|
$response->withCookie(cookie('mode', $request->darkmode, 5259488));
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}elseif($request->darkmode === "light"){
|
||||||
|
$response = new Response('light');
|
||||||
|
$response->withCookie(cookie('mode', $request->darkmode, 5259488));
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,23 @@
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<label for="dark">Sprog / Languages:</label>
|
||||||
|
<select name="light" id="darkmode">
|
||||||
|
@if(request()->cookie('mode') == "light")
|
||||||
|
<option selected name="ligthmode" value="Light">Light</option>
|
||||||
|
@else
|
||||||
|
<option name="light" value="light">Light</option>
|
||||||
|
@endif
|
||||||
|
@if(request()->cookie('mode') == "light")
|
||||||
|
<option selected name="darkmode" value="dark">Dark</option>
|
||||||
|
@else
|
||||||
|
<option name="dark" value="dark">Dark</option>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -48,7 +65,26 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
$('#darkmode').change(function () {
|
||||||
|
$darkmodeON = $('#darkmode').find(":selected").val();
|
||||||
|
$.ajax({
|
||||||
|
type: 'get',
|
||||||
|
url: '{{route('users.setDarkMode')}}',
|
||||||
|
data: {'darkmode':$darkmodeON},
|
||||||
|
success:function (data) {
|
||||||
|
console.log($darkmodeON);
|
||||||
|
//location.reload();
|
||||||
|
},
|
||||||
|
error:function (data) {
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -40,8 +40,9 @@ Route::get("/userapi", "UserController@search")->name("users.search");
|
||||||
Route::get("/vaskeapi", "WashingReservationController@search")->name("washing-reservations.search");
|
Route::get("/vaskeapi", "WashingReservationController@search")->name("washing-reservations.search");
|
||||||
Route::get("/risrosapi", "FeedbackController@search")->name("feedbacks.search");
|
Route::get("/risrosapi", "FeedbackController@search")->name("feedbacks.search");
|
||||||
|
|
||||||
//languages
|
//Cookies
|
||||||
Route::get("/languages", "UserController@setLanguages")->name("users.setLanguages");
|
Route::get("/languages", "UserController@setLanguages")->name("users.setLanguages");
|
||||||
|
Route::get("/darkmode", "UserController@setDarkMode")->name("users.setDarkMode");
|
||||||
|
|
||||||
|
|
||||||
Route::resource("contacts", "ContactController");
|
Route::resource("contacts", "ContactController");
|
||||||
|
|
Loading…
Reference in New Issue