@@ -1,9 +1,10 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_ENV=production
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
APP_LOCALE=de
|
||||
APP_HTTPS=true
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_LEVEL=debug
|
||||
@@ -54,3 +55,4 @@ SERVERCOW_API_URL=https://api.servercow.de/dns/v1/domains/
|
||||
SERVERCOW_API_USER=
|
||||
SERVERCOW_API_PASS=
|
||||
RECORD_FETCH_LIMIT_MINUTES=20
|
||||
FETCH_RECORDS_AFTER_CHANGE=true
|
||||
|
||||
@@ -97,8 +97,6 @@ class RecordController extends Controller
|
||||
|
||||
$aReturn = $request->json();
|
||||
|
||||
dd($aReturn);
|
||||
|
||||
if (array_key_exists("error", $aReturn)) {
|
||||
return ReturnController::returnWithError(__("messages.error_saving_record", ["error" => $aReturn["error"]]));
|
||||
}
|
||||
@@ -106,7 +104,9 @@ class RecordController extends Controller
|
||||
return ReturnController::returnWithError(__("messages.error_saving_record", ["error" => $e->getMessage()]));
|
||||
}
|
||||
|
||||
if (env('FETCH_RECORDS_AFTER_CHANGE')) {
|
||||
$this->getNewRecordsForDomain($sDomainName, $aData["domain"]);
|
||||
}
|
||||
|
||||
return ReturnController::returnWithSuccess(__("messages.suc_saving_record"));
|
||||
}
|
||||
@@ -140,7 +140,9 @@ class RecordController extends Controller
|
||||
return ReturnController::returnWithError(__("messages.error_deleting_record", ["error" => $e->getMessage()]));
|
||||
}
|
||||
|
||||
if (env('FETCH_RECORDS_AFTER_CHANGE')) {
|
||||
$this->getNewRecordsForDomain($aData["domain_name"], $aData["domain_id"]);
|
||||
}
|
||||
|
||||
return ReturnController::returnWithSuccess(__("messages.suc_deleting_record", ["record" => $aData["name"]]));
|
||||
}
|
||||
@@ -176,7 +178,9 @@ class RecordController extends Controller
|
||||
return ReturnController::returnWithError(__("messages.error_editing_record", ["error" => $e->getMessage()]));
|
||||
}
|
||||
|
||||
if (env('FETCH_RECORDS_AFTER_CHANGE')) {
|
||||
$this->getNewRecordsForDomain($oRecord->domain->name, $oRecord->domain->id);
|
||||
}
|
||||
|
||||
return ReturnController::returnWithSuccess(__("messages.suc_editing_record"));
|
||||
}
|
||||
@@ -186,10 +190,10 @@ class RecordController extends Controller
|
||||
try {
|
||||
$this->getNewRecordsForDomain($sDomainName, $iDomainId);
|
||||
} catch (\Exception $e) {
|
||||
return ReturnController::returnWithError(__("messages.error_fetching_records", ["error" => $e->getMessage()]));
|
||||
return ReturnController::returnWithError(__("messages.error_fetching_records", ["error" => $e->getMessage()]), "", false, $iDomainId);
|
||||
}
|
||||
|
||||
return ReturnController::returnWithSuccess(__("messages.suc_fetching_records", ["domain" => $sDomainName]));
|
||||
return ReturnController::returnWithSuccess(__("messages.suc_fetching_records", ["domain" => $sDomainName]), "", false, $iDomainId);
|
||||
}
|
||||
|
||||
public function getNewRecordsForDomain($sDomainName, $iDomainId)
|
||||
|
||||
@@ -6,7 +6,7 @@ use Illuminate\Support\Facades\Session;
|
||||
|
||||
class ReturnController extends Controller
|
||||
{
|
||||
public static function returnWithSuccess($message, $target = "", $to_route = false)
|
||||
public static function returnWithSuccess($message, $target = "", $to_route = false, $iHashId = null)
|
||||
{
|
||||
Session::flash('Success_Message', $message);
|
||||
|
||||
@@ -14,6 +14,10 @@ class ReturnController extends Controller
|
||||
return redirect("/" . $_POST["hash"]);
|
||||
}
|
||||
|
||||
if ($iHashId) {
|
||||
return redirect("/" . "#domain-" . $iHashId);
|
||||
}
|
||||
|
||||
if ($target == "") {
|
||||
return redirect()->back();
|
||||
} else {
|
||||
@@ -28,7 +32,7 @@ class ReturnController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public static function returnWithError($error, $target = "", $with_input = false)
|
||||
public static function returnWithError($error, $target = "", $with_input = false, $iHashId = null)
|
||||
{
|
||||
Session::flash('Error_Message', $error);
|
||||
|
||||
@@ -36,6 +40,10 @@ class ReturnController extends Controller
|
||||
return redirect("/" . $_POST["hash"]);
|
||||
}
|
||||
|
||||
if ($iHashId) {
|
||||
return redirect("/" . "#domain-" . $iHashId);
|
||||
}
|
||||
|
||||
if ($target == "") {
|
||||
switch ($with_input) {
|
||||
case false:
|
||||
|
||||
@@ -23,6 +23,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
if (env('APP_HTTPS') == "true") {
|
||||
\URL::forceScheme('https');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
21
public/js/main.js
vendored
21
public/js/main.js
vendored
@@ -6,6 +6,26 @@ $(() => {
|
||||
langName = "german";
|
||||
}
|
||||
|
||||
let hash = document.location.hash;
|
||||
let prefix = "#domain-";
|
||||
let panelPrefix = "#domain-panel-";
|
||||
let hashID = hash.replace(prefix, "");
|
||||
|
||||
if (hash) {
|
||||
$("#select_domain").val(hashID);
|
||||
$("[id^=record-hash]").val(prefix + hashID);
|
||||
|
||||
$(".domain-panel").each(function () {
|
||||
$(this).removeClass("is-active");
|
||||
$(this).addClass("is-hidden");
|
||||
});
|
||||
|
||||
$(panelPrefix + hashID).addClass("is-active");
|
||||
$(panelPrefix + hashID).removeClass("is-hidden");
|
||||
|
||||
$("#form-add-record #domain").val(hashID);
|
||||
}
|
||||
|
||||
$("#mainBurger").on("click", function () {
|
||||
let burgerIcon = $(this);
|
||||
let menu = $("#mainNavbar");
|
||||
@@ -83,6 +103,7 @@ $(() => {
|
||||
|
||||
$("#select_domain").on("change", function () {
|
||||
let domainId = $(this).val();
|
||||
window.location.hash = prefix + domainId;
|
||||
|
||||
$(".domain-panel").each(function () {
|
||||
if ($(this).hasClass("domain-panel-" + domainId)) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<hr>
|
||||
|
||||
@foreach($domains as $domain)
|
||||
<nav class="panel domain-panel domain-panel-{{ $domain->id }} {{ $loop->first ? 'is-active' : 'is-hidden' }}">
|
||||
<nav class="panel domain-panel domain-panel-{{ $domain->id }} {{ $loop->first ? 'is-active' : 'is-hidden' }}" id="domain-panel-{{ $domain->id }}">
|
||||
<p class="panel-heading">{{ __("views.domain") }}: {{ $domain->name }}</p>
|
||||
<!-- TODO: Check for Domain specific records -->
|
||||
@if($records->isEmpty())
|
||||
@@ -87,6 +87,7 @@
|
||||
<input type="hidden" name="name" value="{{ $record->name }}">
|
||||
<input type="hidden" name="domain_name" value="{{ $domain->name }}">
|
||||
<input type="hidden" name="domain_id" value="{{ $domain->id }}">
|
||||
<input type="hidden" name="hash" id="record-hash_{{ $domain->id }}_{{ $record->id }}">
|
||||
{{ csrf_field() }}
|
||||
<span class="delete-btn" aria-label="{{ __("views.delete_record") }}" data-microtip-position="top" data-name="{{ $record->name }}" data-delete="record" role="tooltip"><i class="fas fa-trash-alt"></i></span>
|
||||
</form>
|
||||
@@ -98,6 +99,9 @@
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
<div class="panel-block">
|
||||
<a href="{{ Route("records.add") }}/#domain-{{ $domain->id }}" class="button is-dark is-small"><i class="far fa-plus-square"></i> {{ __("views.add_record") }}</a>
|
||||
</div>
|
||||
@if(!empty($update[$domain->id]))
|
||||
<div class="panel-block">
|
||||
<p>{{ $update[$domain->id]["text"] }}</p>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<section class="modal-card-body">
|
||||
<form action="{{ Route("records.edit") }}" method="post">
|
||||
<input type="hidden" name="record_id" id="edit_record_id">
|
||||
<input type="hidden" name="hash" id="record-hash">
|
||||
|
||||
<div class="field">
|
||||
<label for="edit_name">{{ __("views.name") }}</label>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@section('title', $title)
|
||||
|
||||
@section('content')
|
||||
<form action="{{ Route("records.add") }}" method="post">
|
||||
<form action="{{ Route("records.add") }}" method="post" id="form-add-record">
|
||||
<div class="field">
|
||||
<label for="domain" class="label">{{ __("views.domain") }}</label>
|
||||
<div class="control">
|
||||
@@ -17,6 +17,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="hash" id="record-hash">
|
||||
|
||||
<div class="field">
|
||||
<label for="type" class="label">{{ __("views.type") }}</label>
|
||||
<div class="control">
|
||||
|
||||
Reference in New Issue
Block a user