Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
dae0025b
Commit
dae0025b
authored
Dec 21, 2013
by
Jean Michel Rouly
Browse files
Extracted link preview box into a separate html file.
parent
589c13b3
Changes
5
Hide whitespace changes
Inline
Side-by-side
go/go/views.py
View file @
dae0025b
...
...
@@ -50,9 +50,7 @@ def index(request):
# Preview a link.
def
view
(
request
,
short
):
url
=
get_object_or_404
(
URL
,
short__iexact
=
short
)
return
render
(
request
,
'view.html'
,
{
'url'
:
url
,
},
...
...
@@ -61,10 +59,9 @@ def view(request, short):
# My-Links page.
@
login_required
def
my_links
(
request
):
links
=
URL
.
objects
.
filter
(
owner
=
request
.
user
)
urls
=
URL
.
objects
.
filter
(
owner
=
request
.
user
)
return
render
(
request
,
'my_links.html'
,
{
'
link
s'
:
link
s
,
'
url
s'
:
url
s
,
},
)
...
...
go/static/css/style.css
View file @
dae0025b
...
...
@@ -49,17 +49,13 @@ body { /* HTML body */
font-style
:
italic
;
}
#my
link
s
{
.
link
-box
{
width
:
inherit
;
margin
:
auto
;
table-layout
:
fixed
;
/*height: 500px;
border: 1px solid #000000;
overflow-y: auto;*/
}
#mylinks
p
{
/* border-left: 5px solid #464646; */
.link-box
p
{
border
:
1px
dashed
#000000
;
text-align
:
left
;
padding-bottom
:
5px
;
...
...
@@ -70,9 +66,8 @@ body { /* HTML body */
white-space
:
normal
;
}
#my
link
s
p
:hover
{
.
link
-box
:hover
{
background-color
:
#FDFDB8
;
/* border-left: 5px solid #898989; */
}
...
...
go/templates/link_box.html
0 → 100644
View file @
dae0025b
<div
class=
"link-box"
>
<p>
<strong>
Long:
</strong>
<a
href=
"{{url.target}}"
>
{{url.target}}
</a>
<br
/>
<strong>
Short:
</strong>
<a
href=
"/{{url.short}}"
>
{{url.short}}
</a>
<br
/>
{% if url.owner = request.user %}
<strong>
Clicks:
</strong>
{{url.clicks}}
<br
/>
<strong>
Expires:
</strong>
{{url.expires}}
<br
/>
<strong>
<a
href=
"{%url 'delete' url.short%}"
onclick=
"return confirm('Are you sure you want to delete this link?');"
>
Delete
</a>
</strong>
{% endif %}
</p>
</div>
go/templates/my_links.html
View file @
dae0025b
...
...
@@ -8,33 +8,12 @@ Go - A URL Shortener
{% block content %}
{% if links %}
<div
id=
"mylinks"
>
{% for link in links %}
<p>
<strong>
Long:
</strong>
<a
href=
"{{link.target}}"
>
{{link.target}}
</a>
<br
/>
<h3>
~My Links~
</h3>
<strong>
Short:
</strong>
<a
href=
"/{{link.short}}"
>
{{link.short}}
</a>
<br
/>
<strong>
Clicks:
</strong>
{{link.clicks}}
<br
/>
<strong>
Expires:
</strong>
{{link.expires}}
<br
/>
<strong>
<a
href=
"{%url 'delete' link.short%}"
onclick=
"return confirm('Are you sure you want to delete this link?');"
>
Delete
</a>
</strong>
</p>
{% endfor %}
</div>
{% else %}
{% for url in urls %}
{% include 'link_box.html' %}
{% empty %}
<p>
None found.
</p>
{% end
i
f %}
{% endf
or
%}
{% endblock %}
go/templates/view.html
View file @
dae0025b
...
...
@@ -9,30 +9,7 @@ Go - Success
{% block content %}
{% if url %}
<div
id=
"mylinks"
>
<p>
<strong>
Long:
</strong>
<a
href=
"{{url.target}}"
>
{{url.target}}
</a>
<br
/>
<strong>
Short:
</strong>
<a
href=
"/{{url.short}}"
>
{{url.short}}
</a>
<br
/>
{% if url.owner = request.user %}
<strong>
Clicks:
</strong>
{{url.clicks}}
<br
/>
<strong>
Expires:
</strong>
{{url.expires}}
<br
/>
<strong>
<a
href=
"{%url 'delete' url.short%}"
onclick=
"return confirm('Are you sure you want to delete this link?');"
>
Delete
</a>
</strong>
{% endif %}
</p>
</div>
{% include 'link_box.html' %}
{% else %}
<p>
Nothing here.
</p>
{% endif %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment