Beautify code

This commit is contained in:
Supan Adit Pratama 2021-02-14 01:07:46 +07:00
parent bc6e86d717
commit f5318a6942
7 changed files with 274 additions and 279 deletions

View File

@ -100,7 +100,7 @@ class UrlShortenerController extends Controller
$url = $urlAddress->url_destination; $url = $urlAddress->url_destination;
if ($httpPath == substr($url, 0, strlen($httpPath))) { if ($httpPath == substr($url, 0, strlen($httpPath))) {
$hasHttpOrHttps = true; $hasHttpOrHttps = true;
} else if ($httpsPath == substr($url, 0, strlen($httpsPath))) { } elseif ($httpsPath == substr($url, 0, strlen($httpsPath))) {
$hasHttpOrHttps = true; $hasHttpOrHttps = true;
} }
@ -145,7 +145,7 @@ class UrlShortenerController extends Controller
$url = $urlAddress->url_destination; $url = $urlAddress->url_destination;
if ($httpPath == substr($url, 0, strlen($httpPath))) { if ($httpPath == substr($url, 0, strlen($httpPath))) {
$hasHttpOrHttps = true; $hasHttpOrHttps = true;
} else if ($httpsPath == substr($url, 0, strlen($httpsPath))) { } elseif ($httpsPath == substr($url, 0, strlen($httpsPath))) {
$hasHttpOrHttps = true; $hasHttpOrHttps = true;
} }

View File

@ -1,11 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="csrf_token" content="{{ csrf_token() }}"/> <meta name="csrf_token" content="{{ csrf_token() }}" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Short URL</title> <title>Short URL</title>
<link rel="shortcut icon" href="{{asset('favicon.png')}}"/> <link rel="shortcut icon" href="{{asset('favicon.png')}}" />
<!-- Tell the browser to be responsive to screen width --> <!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.7 --> <!-- Bootstrap 3.3.7 -->
@ -32,8 +33,9 @@
<link rel="stylesheet" <link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic"> href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head> </head>
<body class="hold-transition login-page"> <body class="hold-transition login-page">
<div class="login-box"> <div class="login-box">
<div class="login-logo"> <div class="login-logo">
<a href="/"><b>Short</b>&nbsp;URL</a> <a href="/"><b>Short</b>&nbsp;URL</a>
</div> </div>
@ -41,40 +43,36 @@
<div class="login-box-body"> <div class="login-box-body">
<p class="login-box-msg">Expired</p> <p class="login-box-msg">Expired</p>
<p> <p>
I am sorry, the link is expired, so please just back to the homepage, or if you own the link just regenerate I am sorry, the link is expired, so please just back to the homepage, or if you own the link just
regenerate
the link, but if you get the link from somebody just ask to the person who share this link. the link, but if you get the link from somebody just ask to the person who share this link.
</p> </p>
<div class="input-group"> <div class="input-group">
<input type="text" <input type="text" class="form-control" placeholder="Generated URL" id="generated-url-field"
class="form-control" value="{{$url}}" readonly>
placeholder="Generated URL"
id="generated-url-field"
value="{{$url}}"
readonly>
<span class="input-group-btn"> <span class="input-group-btn">
<button type="button" class="btn btn-danger btn-flat" <button type="button" class="btn btn-danger btn-flat" data-clipboard-target="#generated-url-field">
data-clipboard-target="#generated-url-field">
<i class="fa fa-clipboard"></i> <i class="fa fa-clipboard"></i>
</button> </button>
</span> </span>
</div> </div>
</div> </div>
<!-- /.login-box-body --> <!-- /.login-box-body -->
</div> </div>
<!-- /.login-box --> <!-- /.login-box -->
<!-- jQuery 3 --> <!-- jQuery 3 -->
<script src="{{asset('vendor/jquery/dist/jquery.min.js')}}"></script> <script src="{{asset('vendor/jquery/dist/jquery.min.js')}}"></script>
<!-- Bootstrap 3.3.7 --> <!-- Bootstrap 3.3.7 -->
<script src="{{asset('vendor/bootstrap/dist/js/bootstrap.min.js')}}"></script> <script src="{{asset('vendor/bootstrap/dist/js/bootstrap.min.js')}}"></script>
<!-- Toastr --> <!-- Toastr -->
<script src="{{asset('vendor/toastr/toastr.min.js')}}"></script> <script src="{{asset('vendor/toastr/toastr.min.js')}}"></script>
<!-- Clipboard --> <!-- Clipboard -->
<script src="{{asset('vendor/clipboard.js/dist/clipboard.min.js')}}"></script> <script src="{{asset('vendor/clipboard.js/dist/clipboard.min.js')}}"></script>
<!-- iCheck --> <!-- iCheck -->
<script src="{{asset('plugin/iCheck/icheck.min.js')}}"></script> <script src="{{asset('plugin/iCheck/icheck.min.js')}}"></script>
<script type="application/javascript"> <script type="application/javascript">
const clipboard = new ClipboardJS('.btn'); const clipboard = new ClipboardJS('.btn');
clipboard.on('success', function (e) { clipboard.on('success', function (e) {
toastr.success("URL Copied"); toastr.success("URL Copied");
@ -84,6 +82,7 @@
clipboard.on('error', function (e) { clipboard.on('error', function (e) {
toastr.failed("Cannot Copy URL"); toastr.failed("Cannot Copy URL");
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@ -1,29 +1,27 @@
@extends('layout.default') @extends('layout.default')
@section('title') @section('title')
Welcome Welcome
@endsection @endsection
@section('subtitle') @section('subtitle')
The Simple URL Shortener The Simple URL Shortener
@endsection @endsection
@section('content') @section('content')
<div class="box box-default"> <div class="box box-default">
<div class="box-body"> <div class="box-body">
<form action="/" id="shorten-url-form"> <form action="/" id="shorten-url-form">
<input type="text" class="form-control" placeholder="Enter your URL" id="shorten-url-form-field-url"/> <input type="text" class="form-control" placeholder="Enter your URL" id="shorten-url-form-field-url" />
<br/> <br />
<div class="form-group"> <div class="form-group">
<label>Expired Date</label> <label>Expired Date</label>
<div class="input-group date"> <div class="input-group date">
<div class="input-group-addon"> <div class="input-group-addon">
<input type="checkbox" id="shorten-url-form-field-expiration-date-checkbox"/> <input type="checkbox" id="shorten-url-form-field-expiration-date-checkbox" />
</div> </div>
<input type="text" <input type="text" class="form-control pull-right" id="shorten-url-form-field-expiration-date"
class="form-control pull-right"
id="shorten-url-form-field-expiration-date"
placeholder="Set expired date" readonly> placeholder="Set expired date" readonly>
</div> </div>
<!-- /.input group --> <!-- /.input group -->
@ -34,16 +32,14 @@
<div class="input-group date"> <div class="input-group date">
<div class="input-group-addon"> <div class="input-group-addon">
<input type="checkbox" id="shorten-url-form-field-password-checkbox"/> <input type="checkbox" id="shorten-url-form-field-password-checkbox" />
</div> </div>
<input type="password" <input type="password" class="form-control pull-right" placeholder="Insert password"
class="form-control pull-right"
placeholder="Insert password"
id="shorten-url-form-field-password"> id="shorten-url-form-field-password">
</div> </div>
<!-- /.input group --> <!-- /.input group -->
</div> </div>
<br/> <br />
<div class="row"> <div class="row">
<div class="col-md-2 col-sm-4"> <div class="col-md-2 col-sm-4">
<button type="submit" class="btn btn-info btn-flat btn-block"> <button type="submit" class="btn btn-info btn-flat btn-block">
@ -51,13 +47,10 @@
</button> </button>
</div> </div>
<div class="col-md-10 col-sm-8"> <div class="col-md-10 col-sm-8">
<br class="visible-xs"/> <br class="visible-xs" />
<div class="input-group" id="shorten-url-form-field-url-generated-group" style="display: none;"> <div class="input-group" id="shorten-url-form-field-url-generated-group" style="display: none;">
<input type="text" <input type="text" class="form-control" placeholder="Generated URL"
class="form-control" id="shorten-url-form-field-url-generated" readonly>
placeholder="Generated URL"
id="shorten-url-form-field-url-generated"
readonly>
<span class="input-group-btn"> <span class="input-group-btn">
<button type="button" class="btn btn-danger btn-flat" <button type="button" class="btn btn-danger btn-flat"
data-clipboard-target="#shorten-url-form-field-url-generated"> data-clipboard-target="#shorten-url-form-field-url-generated">
@ -70,12 +63,12 @@
</form> </form>
</div> </div>
<!-- /.box-body --> <!-- /.box-body -->
</div> </div>
<!-- /.box --> <!-- /.box -->
@endsection @endsection
@section('js') @section('js')
<script type="application/javascript"> <script type="application/javascript">
const clipboard = new ClipboardJS('.btn'); const clipboard = new ClipboardJS('.btn');
$('#shorten-url-form-field-expiration-date').datepicker({ $('#shorten-url-form-field-expiration-date').datepicker({
@ -129,5 +122,5 @@
}); });
}); });
}); });
</script> </script>
@endsection @endsection

View File

@ -1,10 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Short URL</title> <title>Short URL</title>
<link rel="shortcut icon" href="{{asset('favicon.png')}}"/> <link rel="shortcut icon" href="{{asset('favicon.png')}}" />
<!-- Tell the browser to be responsive to screen width --> <!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.7 --> <!-- Bootstrap 3.3.7 -->
@ -21,8 +22,7 @@
<link rel="stylesheet" href="{{asset('vendor/toastr/toastr.min.css')}}"> <link rel="stylesheet" href="{{asset('vendor/toastr/toastr.min.css')}}">
<!-- Theme style --> <!-- Theme style -->
<link rel="stylesheet" href="{{asset('dist/css/AdminLTE.min.css')}}"> <link rel="stylesheet" href="{{asset('dist/css/AdminLTE.min.css')}}">
<!-- AdminLTE Skins. Choose a skin from the css/skins <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. -->
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="{{asset('dist/css/skins/_all-skins.min.css')}}"> <link rel="stylesheet" href="{{asset('dist/css/skins/_all-skins.min.css')}}">
<style type="text/css"> <style type="text/css">
@ -45,16 +45,15 @@
@yield('css') @yield('css')
</head> </head>
<!-- ADD THE CLASS layout-top-nav TO REMOVE THE SIDEBAR. --> <!-- ADD THE CLASS layout-top-nav TO REMOVE THE SIDEBAR. -->
<body class="hold-transition skin-blue layout-top-nav"> <body class="hold-transition skin-blue layout-top-nav">
<div class="wrapper"> <div class="wrapper">
<header class="main-header"> <header class="main-header">
<nav class="navbar navbar-static-top"> <nav class="navbar navbar-static-top">
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">
<a href="/" class="navbar-brand"><b>Short</b>&nbsp;URL</a> <a href="/" class="navbar-brand"><b>Short</b>&nbsp;URL</a>
<button type="button" <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
class="navbar-toggle collapsed"
data-toggle="collapse"
data-target="#navbar-collapse"> data-target="#navbar-collapse">
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
</button> </button>
@ -137,10 +136,10 @@
</div> </div>
<!-- /.container --> <!-- /.container -->
</footer> </footer>
</div> </div>
<!-- ./wrapper --> <!-- ./wrapper -->
@if(Session::get('user') == null) @if(Session::get('user') == null)
{{-- Forgot Password Modal --}} {{-- Forgot Password Modal --}}
<div class="modal fade" id="forgot-password-modal"> <div class="modal fade" id="forgot-password-modal">
<div class="modal-dialog"> <div class="modal-dialog">
@ -250,7 +249,7 @@
</div> </div>
<!-- /.modal-dialog --> <!-- /.modal-dialog -->
</div> </div>
@else @else
{{-- Change Password Modal --}} {{-- Change Password Modal --}}
<div class="modal fade" id="change-password-modal"> <div class="modal fade" id="change-password-modal">
<div class="modal-dialog"> <div class="modal-dialog">
@ -284,32 +283,32 @@
</div> </div>
<!-- /.modal-dialog --> <!-- /.modal-dialog -->
</div> </div>
@endif @endif
<!-- jQuery 3 --> <!-- jQuery 3 -->
<script src="{{asset('vendor/jquery/dist/jquery.min.js')}}"></script> <script src="{{asset('vendor/jquery/dist/jquery.min.js')}}"></script>
<!-- Bootstrap 3.3.7 --> <!-- Bootstrap 3.3.7 -->
<script src="{{asset('vendor/bootstrap/dist/js/bootstrap.min.js')}}"></script> <script src="{{asset('vendor/bootstrap/dist/js/bootstrap.min.js')}}"></script>
<!-- SlimScroll --> <!-- SlimScroll -->
<script src="{{asset('vendor/jquery-slimscroll/jquery.slimscroll.min.js')}}"></script> <script src="{{asset('vendor/jquery-slimscroll/jquery.slimscroll.min.js')}}"></script>
<!-- FastClick --> <!-- FastClick -->
<script src="{{asset('vendor/fastclick/lib/fastclick.js')}}"></script> <script src="{{asset('vendor/fastclick/lib/fastclick.js')}}"></script>
<!-- Sweet Alert --> <!-- Sweet Alert -->
<script src="{{asset('vendor/sweetalert/sweetalert.min.js')}}"></script> <script src="{{asset('vendor/sweetalert/sweetalert.min.js')}}"></script>
<!-- Toastr --> <!-- Toastr -->
<script src="{{asset('vendor/toastr/toastr.min.js')}}"></script> <script src="{{asset('vendor/toastr/toastr.min.js')}}"></script>
<!-- Bootstrap Datepicker --> <!-- Bootstrap Datepicker -->
<script src="{{asset('vendor/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js')}}"></script> <script src="{{asset('vendor/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js')}}"></script>
<!-- iCheck 1.0.1 --> <!-- iCheck 1.0.1 -->
<script src="{{asset('plugin/iCheck/icheck.min.js')}}"></script> <script src="{{asset('plugin/iCheck/icheck.min.js')}}"></script>
<!-- Clipboard --> <!-- Clipboard -->
<script src="{{asset('vendor/clipboard.js/dist/clipboard.min.js')}}"></script> <script src="{{asset('vendor/clipboard.js/dist/clipboard.min.js')}}"></script>
<!-- AdminLTE App --> <!-- AdminLTE App -->
<script src="{{asset('dist/js/adminlte.min.js')}}"></script> <script src="{{asset('dist/js/adminlte.min.js')}}"></script>
<!-- AdminLTE for demo purposes --> <!-- AdminLTE for demo purposes -->
<script src="{{asset('dist/js/demo.js')}}"></script> <script src="{{asset('dist/js/demo.js')}}"></script>
<script type="application/javascript"> <script type="application/javascript">
$(document).ready(function () { $(document).ready(function () {
@if(Session::get('user') == null) @if(Session::get('user') == null)
$("#forgot-password-modal-save-loading-indicator").hide(); $("#forgot-password-modal-save-loading-indicator").hide();
@ -478,9 +477,10 @@
}); });
@endif @endif
}); });
</script> </script>
@yield('js') @yield('js')
</body> </body>
</html> </html>

View File

@ -1,15 +1,15 @@
@extends('layout.default') @extends('layout.default')
@section('title') @section('title')
My URL Shortener My URL Shortener
@endsection @endsection
@section('subtitle') @section('subtitle')
List all of your own URL Shortener List all of your own URL Shortener
@endsection @endsection
@section('content') @section('content')
<div class="box box-info"> <div class="box box-info">
<div class="box-header"> <div class="box-header">
<h3 class="box-title"></h3> <h3 class="box-title"></h3>
@ -45,12 +45,12 @@
of <span id="total-entries">0</span> entries of <span id="total-entries">0</span> entries
<ul class="pagination pagination-sm no-margin pull-right" id="pagination-button"></ul> <ul class="pagination pagination-sm no-margin pull-right" id="pagination-button"></ul>
</div> </div>
</div> </div>
<!-- /.box --> <!-- /.box -->
@endsection @endsection
@section('js') @section('js')
<script type="application/javascript"> <script type="application/javascript">
const clipboard = new ClipboardJS('.btn'); const clipboard = new ClipboardJS('.btn');
let page = 1; let page = 1;
@ -186,5 +186,5 @@
// Initialize // Initialize
loadURLAddress(); loadURLAddress();
}); });
</script> </script>
@endsection @endsection

View File

@ -1,11 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="csrf_token" content="{{ csrf_token() }}"/> <meta name="csrf_token" content="{{ csrf_token() }}" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Short URL</title> <title>Short URL</title>
<link rel="shortcut icon" href="{{asset('favicon.png')}}"/> <link rel="shortcut icon" href="{{asset('favicon.png')}}" />
<!-- Tell the browser to be responsive to screen width --> <!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.7 --> <!-- Bootstrap 3.3.7 -->
@ -32,8 +33,9 @@
<link rel="stylesheet" <link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic"> href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head> </head>
<body class="hold-transition login-page"> <body class="hold-transition login-page">
<div class="login-box"> <div class="login-box">
<div class="login-logo"> <div class="login-logo">
<a href="/"><b>Short</b>&nbsp;URL</a> <a href="/"><b>Short</b>&nbsp;URL</a>
</div> </div>
@ -59,18 +61,18 @@
</form> </form>
</div> </div>
<!-- /.login-box-body --> <!-- /.login-box-body -->
</div> </div>
<!-- /.login-box --> <!-- /.login-box -->
<!-- jQuery 3 --> <!-- jQuery 3 -->
<script src="{{asset('vendor/jquery/dist/jquery.min.js')}}"></script> <script src="{{asset('vendor/jquery/dist/jquery.min.js')}}"></script>
<!-- Bootstrap 3.3.7 --> <!-- Bootstrap 3.3.7 -->
<script src="{{asset('vendor/bootstrap/dist/js/bootstrap.min.js')}}"></script> <script src="{{asset('vendor/bootstrap/dist/js/bootstrap.min.js')}}"></script>
<!-- Toastr --> <!-- Toastr -->
<script src="{{asset('vendor/toastr/toastr.min.js')}}"></script> <script src="{{asset('vendor/toastr/toastr.min.js')}}"></script>
<!-- iCheck --> <!-- iCheck -->
<script src="{{asset('plugin/iCheck/icheck.min.js')}}"></script> <script src="{{asset('plugin/iCheck/icheck.min.js')}}"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$("#protection-form").on("submit", function (e) { $("#protection-form").on("submit", function (e) {
e.preventDefault(); e.preventDefault();
@ -96,6 +98,7 @@
}); });
}); });
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@ -1,5 +1,5 @@
<div> <div>
Hi, {{ $name }}<br/> Hi, {{ $name }}<br />
This is your new password : {{ $password }}<br/> This is your new password : {{ $password }}<br />
<p>You can change it after login back</p> <p>You can change it after login back</p>
</div> </div>