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):
...
@@ -50,9 +50,7 @@ def index(request):
# Preview a link.
# Preview a link.
def
view
(
request
,
short
):
def
view
(
request
,
short
):
url
=
get_object_or_404
(
URL
,
short__iexact
=
short
)
url
=
get_object_or_404
(
URL
,
short__iexact
=
short
)
return
render
(
request
,
'view.html'
,
{
return
render
(
request
,
'view.html'
,
{
'url'
:
url
,
'url'
:
url
,
},
},
...
@@ -61,10 +59,9 @@ def view(request, short):
...
@@ -61,10 +59,9 @@ def view(request, short):
# My-Links page.
# My-Links page.
@
login_required
@
login_required
def
my_links
(
request
):
def
my_links
(
request
):
links
=
URL
.
objects
.
filter
(
owner
=
request
.
user
)
urls
=
URL
.
objects
.
filter
(
owner
=
request
.
user
)
return
render
(
request
,
'my_links.html'
,
{
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 */
...
@@ -49,17 +49,13 @@ body { /* HTML body */
font-style
:
italic
;
font-style
:
italic
;
}
}
#my
link
s
{
.
link
-box
{
width
:
inherit
;
width
:
inherit
;
margin
:
auto
;
margin
:
auto
;
table-layout
:
fixed
;
table-layout
:
fixed
;
/*height: 500px;
border: 1px solid #000000;
overflow-y: auto;*/
}
}
#mylinks
p
{
.link-box
p
{
/* border-left: 5px solid #464646; */
border
:
1px
dashed
#000000
;
border
:
1px
dashed
#000000
;
text-align
:
left
;
text-align
:
left
;
padding-bottom
:
5px
;
padding-bottom
:
5px
;
...
@@ -70,9 +66,8 @@ body { /* HTML body */
...
@@ -70,9 +66,8 @@ body { /* HTML body */
white-space
:
normal
;
white-space
:
normal
;
}
}
#my
link
s
p
:hover
{
.
link
-box
:hover
{
background-color
:
#FDFDB8
;
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
...
@@ -8,33 +8,12 @@ Go - A URL Shortener
{% block content %}
{% block content %}
{% if links %}
<h3>
~My Links~
</h3>
<div
id=
"mylinks"
>
{% for link in links %}
<p>
<strong>
Long:
</strong>
<a
href=
"{{link.target}}"
>
{{link.target}}
</a>
<br
/>
<strong>
Short:
</strong>
<a
href=
"/{{link.short}}"
>
{{link.short}}
</a>
{% for url in urls %}
<br
/>
{% include 'link_box.html' %}
{% empty %}
<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 %}
<p>
None found.
</p>
<p>
None found.
</p>
{% end
i
f %}
{% endf
or
%}
{% endblock %}
{% endblock %}
go/templates/view.html
View file @
dae0025b
...
@@ -9,30 +9,7 @@ Go - Success
...
@@ -9,30 +9,7 @@ Go - Success
{% block content %}
{% block content %}
{% if url %}
{% if url %}
<div
id=
"mylinks"
>
{% include 'link_box.html' %}
<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>
{% else %}
{% else %}
<p>
Nothing here.
</p>
<p>
Nothing here.
</p>
{% endif %}
{% 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