Skip to content

Commit

Permalink
Ajout filtres mes articles/mes tutoriels
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-D committed Jul 27, 2014
1 parent 91562ca commit 603c761
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 11 deletions.
13 changes: 12 additions & 1 deletion templates/article/member/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
{% block breadcrumb %}
{% if request.GET.type == "public" %}
<li>Publiés</li>
{% elif request.GET.type == "validate" %}
<li>En validation</li>
{% elif request.GET.type == "draft" %}
<li>Brouillons</li>
{% else %}
Expand All @@ -30,6 +32,8 @@
Mes Articles
{% if request.GET.type == "public" %}
/ Publiés
{% elif request.GET.type == "validate" %}
/ En validation
{% elif request.GET.type == "draft" %}
/ Brouillons
{% endif %}
Expand All @@ -41,6 +45,8 @@
Mes Articles
{% if request.GET.type == "public" %}
/ Publiés
{% elif request.GET.type == "validate" %}
/ En validation
{% elif request.GET.type == "draft" %}
/ Brouillons
{% endif %}
Expand All @@ -63,7 +69,12 @@ <h3>Filtres</h3>
</a>
</li>
<li>
<a href="{% url "zds.member.views.articles" %}?type=draft" class="ico-after tick {% if request.GET.type == "draft" %}unread{% endif %}">
<a href="{% url "zds.member.views.articles" %}?type=validate" class="ico-after tick {% if request.GET.type == "validate" %}unread{% endif %}">
En validation
</a>
</li>
<li>
<a href="{% url "zds.member.views.articles" %}?type=draft" class="ico-after edit {% if request.GET.type == "draft" %}unread{% endif %}">
Brouillons
</a>
</li>
Expand Down
76 changes: 66 additions & 10 deletions templates/tutorial/member/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,37 @@

{% block title %}
Mes tutoriels
{% if request.GET.type == "public" %}
/ Publiés
{% elif request.GET.type == "validate" %}
/ En validation
{% elif request.GET.type == "beta" %}
/ En bêta
{% elif request.GET.type == "draft" %}
/ Brouillons
{% endif %}
{% endblock %}



{% block breadcrumb_base %}
<li><a href="{% url "zds.member.views.tutorials" %}">Mes tutoriels</a></li>
{% endblock %}



{% block breadcrumb %}
<li>Mes tutoriels</li>
{% if request.GET.type == "public" %}
<li>Publiés</li>
{% elif request.GET.type == "validate" %}
<li>En validation</li>
{% elif request.GET.type == "beta" %}
<li>En bêta</li>
{% elif request.GET.type == "draft" %}
<li>Brouillons</li>
{% else %}
<li>Tous mes tutoriels</li>
{% endif %}
{% endblock %}


Expand All @@ -20,6 +45,15 @@
<h2 class="ico-after ico-tutorials">
{% block headline %}
Mes tutoriels
{% if request.GET.type == "public" %}
/ Publiés
{% elif request.GET.type == "validate" %}
/ En validation
{% elif request.GET.type == "beta" %}
/ En bêta
{% elif request.GET.type == "draft" %}
/ Brouillons
{% endif %}
{% endblock %}
</h2>

Expand Down Expand Up @@ -67,12 +101,9 @@ <h3>{{ tutorial.title }}</h3>
<a href="{% url "zds.tutorial.views.add_tutorial" %}" class="new-btn ico-after more blue">
Nouveau tutoriel
</a>
{% endblock %}



{% block sidebar_actions %}
<li><a href="{% url "zds.tutorial.views.import_tuto" %}" class="ico-after import blue">Importer</a></li>
<a href="{% url "zds.tutorial.views.import_tuto" %}" class="new-btn ico-after import blue">
Importer
</a>
{% endblock %}


Expand All @@ -81,9 +112,34 @@ <h3>{{ tutorial.title }}</h3>
<div class="mobile-menu-bloc mobile-all-links mobile-show-ico" data-title="Actions">
<h3>Filtres</h3>
<ul>
<li><a href="{% url "zds.member.views.tutorials" %}">Tous</a></li>
<li><a href="{% url "zds.member.views.tutorials" %}?type=public">Publics</a></li>
<li><a href="{% url "zds.member.views.tutorials" %}?type=draft">Brouillons</a><li>
<li>
<a href="{% url "zds.member.views.tutorials" %}?type=public" class="ico-after tick green {% if request.GET.type == "public" %}unread{% endif %}">
Publiés
</a>
</li>
<li>
<a href="{% url "zds.member.views.tutorials" %}?type=validate" class="ico-after tick {% if request.GET.type == "validate" %}unread{% endif %}">
En validation
</a>
</li>
<li>
<a href="{% url "zds.member.views.tutorials" %}?type=beta" class="ico-after beta {% if request.GET.type == "beta" %}unread{% endif %}">
En bêta
</a>
</li>
<li>
<a href="{% url "zds.member.views.tutorials" %}?type=draft" class="ico-after edit {% if request.GET.type == "draft" %}unread{% endif %}">
Brouillons
</a>
</li>

{% if request.GET.type %}
<li>
<a href="{% url "zds.member.views.tutorials" %}" class="ico-after cross">
Annuler le filtre
</a>
</li>
{% endif %}
</ul>
</div>
{% endblock %}
6 changes: 6 additions & 0 deletions zds/member/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ def tutorials(request):
profile = request.user.profile
if type == "draft":
user_tutorials = profile.get_draft_tutos()
elif type == "beta":
user_tutorials = profile.get_beta_tutos()
elif type == "validate":
user_tutorials = profile.get_validate_tutos()
elif type == "public":
user_tutorials = profile.get_public_tutos()
else:
Expand Down Expand Up @@ -313,6 +317,8 @@ def articles(request):
profile = request.user.profile
if type == "draft":
user_articles = profile.get_draft_articles()
if type == "validate":
user_articles = profile.get_validate_articles()
elif type == "public":
user_articles = profile.get_public_articles()
else:
Expand Down

0 comments on commit 603c761

Please sign in to comment.