Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
url_shorter_docker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
url_shorter_docker
Commits
d7075cf0
Commit
d7075cf0
authored
Nov 10, 2019
by
Jonas Leder
Browse files
Options
Downloads
Patches
Plain Diff
added QR code
parent
7397d9ae
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+6
-1
6 additions, 1 deletion
main.py
templates/editEntries.html
+32
-0
32 additions, 0 deletions
templates/editEntries.html
with
38 additions
and
1 deletion
main.py
+
6
−
1
View file @
d7075cf0
...
...
@@ -250,7 +250,7 @@ def ownLinks():
try
:
entriesList
=
res
.
fetchall
()
for
entries
in
entriesList
:
#for every entrie in the database add a line to the table
response
=
response
+
"
<tr>
\n
<td>
"
+
entries
[
0
]
+
"
</td>
\n
<td>
"
+
entries
[
1
]
+
'
</td>
\n
<td><a id=
"
red
"
href=
"
/user/delete?link=
'
+
escape
(
entries
[
1
])
+
'"
>delete</a></tr>
\n
'
response
=
response
+
"
<tr>
\n
<td>
"
+
entries
[
0
]
+
"
</td>
\n
<td>
"
+
entries
[
1
]
+
'
</td>
\n
<td><a id=
"
red
"
href=
"
/user/delete?link=
'
+
escape
(
entries
[
1
])
+
'"
>delete</a>
<a href=
"
#
"
id=
"
dialog-link
"
onclick=
"
buttonListener(
\'
'
+
entries
[
1
]
+
'
\'
, this)
"
>QR</a>
</tr>
\n
'
response
=
response
+
"
</table>
"
#Close the table
if
(
len
(
entriesList
)
==
0
):
response
=
'
you have no shorten links. <a href=
"
/
"
>back</a>
'
#If user has no shorten links make this message with a back button
except
:
...
...
@@ -275,6 +275,11 @@ def delete():
except
:
abort
(
500
)
@app.route
(
'
/user/makeqr
'
)
def
makeQrCode
():
link
=
request
.
args
.
get
(
'
link
'
)
return
"
data:image/jpeg;base64,
"
+
makeQR
(
"
http://
"
+
link
)
if
__name__
==
'
__main__
'
:
table_check
()
# This code checks whether database table is created or not
...
...
...
...
This diff is collapsed.
Click to expand it.
templates/editEntries.html
+
32
−
0
View file @
d7075cf0
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<link
href=
"/static/jquery-ui.css"
rel=
"stylesheet"
>
<link
href=
"{{ url_for('static', filename='style.css') }}"
rel=
"stylesheet"
>
<title>
URL shorter
</title>
</head>
...
...
@@ -12,5 +13,36 @@
{{content | safe}}
</div>
</div>
<!-- ui-dialog -->
<div
id=
"dialog"
title=
"QRCODE"
>
<img
id=
"dialogContent"
src=
""
>
</div>
<script
src=
"/static/external/jquery/jquery.js"
></script>
<script
src=
"/static/jquery-ui.js"
></script>
<script>
$
(
"
#dialog
"
).
dialog
({
autoOpen
:
false
});
// Link to open the dialog
/*$( "#dialog-link" ).click(function( event ) {
document.getElementById("dialogContent").innerText = "xxx"
$( "#dialog" ).dialog( "open" );
event.preventDefault();
});*/
function
buttonListener
(
value
){
value
=
"
/user/makeqr?link=
"
+
value
$
.
get
(
value
,
function
(
data
,
status
){
document
.
getElementById
(
"
dialogContent
"
).
src
=
data
;
$
(
"
#dialog
"
).
dialog
(
"
open
"
);
setTimeout
(
function
(){
$
(
'
#dialog
'
).
dialog
({
width
:
document
.
getElementById
(
"
dialogContent
"
).
width
+
35
});
},
1
);
});
}
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment