1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-11-09 11:42:28 +01:00

Add frontend elements of shorten result pagE

This commit is contained in:
Chaoyi Zha 2015-11-06 17:48:06 -05:00
parent 8006bdff78
commit a844d92ffa
5 changed files with 45 additions and 5 deletions

View File

@ -62,14 +62,15 @@ class LinkHelper {
->first();
if ($link == null) {
$latest_link_ending = "1";
$base10_val = 0;
}
else {
$latest_link_ending = $link->short_url;
$base10_val = BaseHelper::toBase10($latest_link_ending, $base);
$base10_val++;
}
$base10_val = BaseHelper::toBase10($latest_link_ending, $base);
$base10_val++;
$base_x_val = null;
while (LinkHelper::linkExists($base_x_val) || $base_x_val == null) {

View File

@ -65,6 +65,7 @@ class LinkController extends Controller {
$link->short_url = $link_ending;
$link->long_url = $long_url;
$link->ip = $request->ip();
$link->is_custom = isset($custom_ending);
if ($creator) {
// if user is logged in, save user as creator

View File

@ -0,0 +1,14 @@
.result-box {
width: 50%;
display: block;
margin : 0 auto;
}
.back-btn {
margin-top: 30px;
}
.content-div {
text-align: center;
}

View File

@ -0,0 +1,14 @@
var original_link;
function select_text() {
$('.result-box').focus().select();
}
$('.result-box').click(select_text);
$('.result-box').change(function () {
$(this).val(original_link);
});
$(function () {
original_link = $('.result-box').val();
select_text();
});

View File

@ -1,5 +1,15 @@
@extends('layouts.base')
@section('content')
<h1>{{$short_url}}</h1>
@section('css')
<link rel='stylesheet' href='/css/shorten_result.css' />
@endsection
@section('content')
<h3>Shortened URL</h3>
<input type='text' class='result-box form-control' value='{{$short_url}}' />
<a href='{{route('index')}}' class='btn btn-info back-btn'>Shorten another</a>
@endsection
@section('js')
<script src='/js/shorten_result.js'></script>
@endsection