aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Summers <matthew.summers@liquidustech.com>2010-08-25 14:53:27 -0500
committerMatthew Summers <matthew.summers@liquidustech.com>2010-08-25 14:53:27 -0500
commitfab3b3b571f90ba3385513978a2700ff32309012 (patch)
tree4022dadac1095932a0c637d71e748523fb65c879
parentadded target="_parent" to <a> tag in template (diff)
downloadgentoo-ads-fab3b3b571f90ba3385513978a2700ff32309012.tar.gz
gentoo-ads-fab3b3b571f90ba3385513978a2700ff32309012.tar.bz2
gentoo-ads-fab3b3b571f90ba3385513978a2700ff32309012.zip
New plain text ad type is available
Change to template to accomodate the new type conditionally. New css styles in template for text ads. Change to example_ads.py that will show you how to use new type. that is all.
-rw-r--r--example_ads.py14
-rw-r--r--gentoo_ads/ads/templates/ads.html21
2 files changed, 32 insertions, 3 deletions
diff --git a/example_ads.py b/example_ads.py
index 10c925b..9c52421 100644
--- a/example_ads.py
+++ b/example_ads.py
@@ -12,26 +12,29 @@
ads = [
{
+ 'type':'txt',
'name': 'internal_name_1',
'title': 'human title 1',
'tier': 1,
'weight': 15, #bogomips
'url': 'http://www1.example.com',
- 'img': 'path/to/img1.png',
+ 'text': 'On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain.',
'height': 120,
'width': 125,
},
{
+ 'type':'txt',
'name': 'internal_name_2',
'title': 'human title 2',
'tier': 1,
'weight': 25,
'url': 'http://www2.example.com',
- 'img': 'path/to/img2.gif',
+ 'text': 'On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain.',
'height': 120,
'width': 125,
},
{
+ 'type':'img',
'name': 'internal_name_3',
'title': 'human title 3',
'tier': 1,
@@ -42,6 +45,7 @@ ads = [
'width': 125,
},
{
+ 'type':'img',
'name': 'internal_name_4',
'title': 'human title 4',
'tier': 2,
@@ -52,6 +56,7 @@ ads = [
'width': 125,
},
{
+ 'type':'img',
'name': 'internal_name_5',
'title': 'human title 5',
'tier': 2,
@@ -62,6 +67,7 @@ ads = [
'width': 125,
},
{
+ 'type':'img',
'name': 'internal_name_6',
'title': 'human title 6',
'tier': 3,
@@ -72,6 +78,7 @@ ads = [
'width': 125,
},
{
+ 'type':'img',
'name': 'internal_name_7',
'title': 'human title 7',
'tier': 3,
@@ -82,6 +89,7 @@ ads = [
'width': 125,
},
{
+ 'type':'img',
'name': 'internal_name_8',
'title': 'human title 8',
'tier': 3,
@@ -102,6 +110,7 @@ ads = [
'width': 125,
},
{
+ 'type':'img',
'name': 'internal_name_10',
'title': 'human title 10',
'tier': 3,
@@ -112,6 +121,7 @@ ads = [
'width': 125,
},
{
+ 'type':'img',
'name': 'internal_name_11',
'title': 'human title 11',
'tier': 3,
diff --git a/gentoo_ads/ads/templates/ads.html b/gentoo_ads/ads/templates/ads.html
index 67f5860..0af4e69 100644
--- a/gentoo_ads/ads/templates/ads.html
+++ b/gentoo_ads/ads/templates/ads.html
@@ -27,13 +27,32 @@
text-align: center;
clear: both;
}
+ div.ads a h2 {
+ font-size: 100%;
+ text-align: center;
+ text-decoration: none;
+ }
+ div.ads a p {
+ font-size: 80%;
+ text-align: justify;
+ text-decoration: none;
+ }
</style>
</head>
<body>
<div class="ads">
{% for ad in ads %}
<hr />
- <a href="{{ad.url}}" target="_parent"><img src="{{ MEDIA_URL }}{{ ad.img }}" alt="{{ ad.title|slice:":50" }}" title="{{ ad.title|slice:":50" }}" height="{{ ad.height }}" width="{{ ad.width }}" /></a>
+ {% ifequal ad.type 'txt' %}
+ <a href="{{ad.url}}" target="_parent">
+ <h2>{{ ad.title }}</h2>
+ <p>
+ {{ ad.text }}
+ </p>
+ </a>
+ {% else %}
+ <a href="{{ad.url}}" target="_parent"><img src="{{ MEDIA_URL }}{{ ad.img }}" alt="{{ ad.title|slice:":50" }}" title="{{ ad.title|slice:":50" }}" height="{{ ad.height }}" width="{{ ad.width }}" /></a>
+ {% endifequal %}
{% endfor %}
<hr />
</div>