Verified Commit b99b7371 authored by David Haynes's avatar David Haynes 🙆
Browse files

Refactor link_box to make better use of bootstrap

- rework the css that I wrote a year ago to look nicer
- remove some of the "hacky" solutions that I wrote

Closes #114
parent 21564865
Pipeline #1310 passed with stage
in 1 minute and 43 seconds
......@@ -6,14 +6,33 @@
<!-- CSS for page -->
<style>
a.share:link {color:#000000;}
a.share:visited {color:#000000;}
a.share:hover {color:#000000;}
a.share {text-decoration:none;}
a.share:link {
color: #000000;
}
a.button:link {color:#FFF;}
a.button:visited {color:#FFF;}
a.button:hover {color:#FFF;}
a.share:visited {
color: #000000;
}
a.share:hover {
color: #000000;
}
a.share {
text-decoration: none;
}
a.button:link {
color: #FFF;
}
a.button:visited {
color: #FFF;
}
a.button:hover {
color: #FFF;
}
legend {
font-size: inherit;
......@@ -44,10 +63,6 @@
color: #006633;
}
#link-container-{{url.short}} {
width: 400px;
}
.tooltip-inner {
white-space: nowrap;
max-width: none;
......@@ -56,33 +71,25 @@
<!-- each link_box is a container of a bunch of elements -->
<div class="container">
<!-- essentially the left side of the link_box -->
<div class="col-md-8">
<div class="row">
<!-- left -->
<div class="col-md-6">
<!-- what is the address? -->
<h3>Go Address:</h3>
<div id="link-container-{{url.short}}" class="input-group">
<a id="link-{{url.short}}" class="form-control" href="{{domain}}{{url.short}}" target="_blank">
{{domain}}{{url.short}}
</a>
<div class="input-group">
<a id="link-{{url.short}}" class="form-control" href="{{domain}}{{url.short}}" target="_blank">{{domain}}{{url.short}}</a>
<div id="button-container" class="input-group-addon">
<button id="copy-button-{{url.short}}" type="button" class="button btn btn-default btn-xs fa" role="button"
data-clipboard-target="#link-{{url.short}}" title="Copy to Clipboard">
<button id="copy-button-{{url.short}}" type="button" class="button btn btn-default btn-xs fa" role="button" data-clipboard-target="#link-{{url.short}}" title="Copy to Clipboard">
<i id="clipboard-icon-{{url.short}}" class="fa fa-clipboard fa-1g" aria-hidden="true"></i>
</button>
</div>
</div>
<br></br>
<!-- what are some details about the address? -->
<h3>Address Details:</h3>
<strong>Target URL:</strong>
<br />
<a href="{{url.target}}" target="_blank">{{url.target}}</a>
<br />
{% if url.owner == request.user.registereduser and request.user.registereduser.approved == True %}
<strong>Clicks:</strong> {{url.clicks}}
<br />
......@@ -97,7 +104,8 @@
<br></br>
<!-- Delete Button -->
<a class="button btn btn-danger btn-sm" data-target="#deletionModal-{{url.short}}" data-toggle="modal">
<a class="button btn btn-danger btn-sm" data-target="#deletionModal-{{url.short}}"
data-toggle="modal">
<i class="fa fa-trash-o fa-lg"></i> Delete
</a>
......@@ -105,34 +113,13 @@
<a href="{{domain}}edit/{{url.short}}" class="button btn btn-info btn-sm">
<i class="fa fa-cog fa-lg"></i> Edit
</a>
<!--Define Delete Modal-->
<div id="deletionModal-{{url.short}}" class="modal fade" role="dialog" tabindex="-1">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="background-color:#f5f5f5; border-radius: 7px">
<div class="modal-header" style="text-align:center;">
<h4 class="modal-title text-center"
style="font-weight:bold; font-size: 21px !important;">
Are you sure you would like to delete this link?</h4>
<h6 style="font-weight:500; margin-top: 0px; margin-bottom: 0px;">
Deleting a link is permanent and can not be undone!</h6>
</div>
<div class="modal-body" style="padding-bottom: 80px">
<a type="button" class="btn btn-success btn-lg" style="border-width: 0px;float:left; width:49%; background-color: #A9B0AD; color: #ffffff; border-radius: 4px;" data-dismiss="modal">Cancel</a>
<a type="button" class="btn btn-danger btn-lg" href="{{domain}}delete/{{url.short}}" style="border-width: 0px; float:right; width:49%;background-color: #AC1D37; color: #ffffff; border-radius: 4px;">Delete</a>
</div>
</div>
</div>
</div>
{% endif %}
<br></br>
</div>
<!-- essentially the right side of the box -->
<div class="col-md-4">
<!-- some goofy code to use the qr lib and show the image -->
<!-- right -->
<div class="col-md-6">
<h3>Share Address:</h3>
<!-- define the Go URL as `the_url` -->
{% with domain|add:url.short as the_url %}
<!-- some goofy code to use the qr lib and show the image -->
{% with the_url|add:"?qr" as qr_url%}
{% qr_from_text qr_url 's' %}
{% endwith %}
......@@ -169,33 +156,56 @@
{% endwith %}
{% endwith %}
</div>
</div>
<!--Define Delete Modal-->
<div id="deletionModal-{{url.short}}" class="modal fade" role="dialog" tabindex="-1">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="background-color:#f5f5f5; border-radius: 7px">
<div class="modal-header" style="text-align:center;">
<h4 class="modal-title text-center" style="font-weight:bold; font-size: 21px !important;">
Are you sure you would like to delete this link?</h4>
<h6 style="font-weight:500; margin-top: 0px; margin-bottom: 0px;">
Deleting a link is permanent and can not be undone!</h6>
</div>
<div class="modal-body" style="padding-bottom: 80px">
<a type="button" class="btn btn-success btn-lg" style="border-width: 0px;float:left; width:49%; background-color: #A9B0AD; color: #ffffff; border-radius: 4px;"
data-dismiss="modal">Cancel</a>
<a type="button" class="btn btn-danger btn-lg" href="{{domain}}delete/{{url.short}}"
style="border-width: 0px; float:right; width:49%;background-color: #AC1D37; color: #ffffff; border-radius: 4px;">Delete</a>
</div>
</div>
</div>
</div>
{% else %}
{% endif %}
<br></br>
</div>
<!-- some inline js for the clipboard hoving text -->
<!-- script for copying text an displaying a tooltip -->
<script>
$(function() {
// <!-- some inline js for the clipboard hoving text -->
$(function () {
var option = {
'trigger': 'hover'
};
$('[data-toggle="popover"]').popover(option)
})
</script>
<!-- script for copying text an displaying a tooltip -->
<script>
var clipboard = new Clipboard('#copy-button-{{url.short}}');
var clipboard = new Clipboard('#copy-button-{{url.short}}');
$('#copy-button-{{url.short}}').tooltip({
$('#copy-button-{{url.short}}').tooltip({
trigger: 'hover',
placement: 'bottom'
});
});
$('#copy-button-{{url.short}}').on('hidden.bs.tooltip', function () {
$('#copy-button-{{url.short}}').on('hidden.bs.tooltip', function () {
$('#copy-button-{{url.short}}').attr('data-original-title', 'Copy to Clipboard');
});
});
clipboard.on('success', function(e) {
clipboard.on('success', function (e) {
e.clearSelection();
$('#copy-button-{{url.short}}').attr('data-original-title', 'Copied!').tooltip('show');
});
});
</script>
\ No newline at end of file
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