Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Simon Daron
panikweb
Commits
a64b70e2
Commit
a64b70e2
authored
Sep 27, 2013
by
Simon Daron
Browse files
News view with navigation model
parent
f5a039b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
panikweb/views.py
View file @
a64b70e2
...
...
@@ -441,7 +441,8 @@ class News(TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
News
,
self
).
get_context_data
(
**
kwargs
)
context
[
'sectionName'
]
=
"News"
context
[
'news'
]
=
NewsItem
.
objects
.
all
().
exclude
(
image__isnull
=
True
).
exclude
(
image__exact
=
''
).
order_by
(
'-date'
)[:
14
]
context
[
'focus'
]
=
list
(
NewsItem
.
objects
.
select_related
(
'category'
).
filter
(
focus
=
True
).
exclude
(
image__isnull
=
True
).
exclude
(
image__exact
=
''
).
order_by
(
'-date'
)[
0
:
9
])
context
[
'news'
]
=
NewsItem
.
objects
.
all
().
exclude
(
image__isnull
=
True
).
exclude
(
image__exact
=
''
).
order_by
(
'-date'
)[:
30
]
return
context
news
=
News
.
as_view
()
...
...
panikweb_templates/templates/news.html
View file @
a64b70e2
...
...
@@ -5,29 +5,46 @@
{% news_nav %}
{% endblock %}
{% block main %}
<div
class=
"news"
>
{% with news|slice:"0:3" as news %}
<div
class=
"wrapper"
>
<ul
class=
"custom columns news newsSpecial cf by3"
>
{% for content in news %}
<li
class=
"item"
>
{% news_inline klass="special"%}
</li>
{% endfor %}
</ul>
</div>
{% endwith %}
{% with news|slice:"3:" as news %}
<div
class=
"wrapper"
>
<ul
class=
"custom columns list news cf"
>
{% for content in news %}
<li
class=
"item"
>
{% news_inline%}
</li>
{% endfor %}
</ul>
<div
class=
"detail marged news cf"
>
<div
class=
"wrapper navigation"
>
<div
class=
"leftPart"
>
<div
class=
"news"
>
<h5
class=
"sectionLabel"
>
Focus
</h5>
{% with focus as news %}
<ul
class=
"custom columns cf padded"
>
{% for content in news %}
<li
class=
""
>
{% news_inline klass="special"%}
</li>
{% endfor %}
</ul>
{% endwith %}
</div>
</div>
<div
class=
"rightPart"
>
<div
class=
"sub"
>
{% if newsitem.emission %}
<h5
class=
"sectionLabel"
>
proposé par
</h5>
{% with newsitem.emission as emission %}
<div
class=
""
>
{% emission_resume %}
</div>
{% endwith %}
{% endif %}
<h5
class=
"sectionLabel right"
>
<a
href=
"{% url 'newsArchives' %}"
>
<span
class=
"iconLabel"
>
Toutes
</span>
</a>
</h5>
<h5
class=
"sectionLabel"
>
<span
class=
"iconLabel"
>
Dernières actus
</span>
</h5>
<ul
class=
"custom list newsList"
>
{% for content in news %}
<li
class=
"{% if content == newsitem %}current{% endif %}"
>
{% news_inline %}
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endwith %}
</div>
{% endblock %}
{% block links %}
...
...
panikweb_templates/templates/news/inline.html
View file @
a64b70e2
...
...
@@ -4,7 +4,7 @@
<a
class=
"block cf"
href=
"{% url 'newsitem-view' slug=content.slug %}"
>
<div
class=
"logo"
>
{% if class == "special" and content.image %}
<img
class=
"nomal"
src=
"{{ content.image|thumbnail:'
320x24
0' }}"
/>
<img
class=
"no
r
mal"
src=
"{{ content.image|thumbnail:'
640x48
0' }}"
/>
{% elif content.image %}
<img
class=
"left"
src=
"{{ content.image|thumbnail:'60x60' }}"
/>
{% else %}
...
...
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