Skip to content

Commit

Permalink
últimas movidas para que ciertas acciones no se puedan realizar desde…
Browse files Browse the repository at this point in the history
… la versión embedded por que queda la cagada
  • Loading branch information
Felipe Álvarez committed Aug 18, 2016
1 parent f23c974 commit b09e571
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 27 deletions.
2 changes: 1 addition & 1 deletion popular_proposal/urls.py
Expand Up @@ -18,7 +18,7 @@
HomeView.as_view(),
name='home'),
url(r'^embedded/?$',
HomeView.as_view(is_embedded=True),
xframe_options_exempt(HomeView.as_view(is_embedded=True)),
name='embedded_home'),
url(r'^area_embedded/(?P<slug>[-\w]+)/?$',
xframe_options_exempt(ProposalsPerArea.as_view(is_embedded=True)),
Expand Down
46 changes: 24 additions & 22 deletions votai_general_theme/templates/popular_proposal/_likers.html
Expand Up @@ -29,31 +29,33 @@
</script>
<div class="apoyo">
<div class="apoyo-btn pull-left">
{% if user.is_authenticated %}
{% if not is_embedded %}
{% if user.is_authenticated %}

{% if not user|likes:proposal %}

<a class="btn-apoyo" data-toggle="modal" data-target="#supportProposal"
data-url="{% url 'popular_proposals:like_a_proposal' pk=proposal.id %}{%if next_url%}?next={{next_url}}{% endif %}">
{% blocktrans %}
<span class="fa-stack fa-2x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-heart fa-stack-1x fa-inverse"></i>
</span>
{% endblocktrans %}
</a>
{% include 'modal.html' with modalId='supportProposal' title='Apoya una propuesta' %}
{% if not user|likes:proposal %}

<a class="btn-apoyo" data-toggle="modal" data-target="#supportProposal"
data-url="{% url 'popular_proposals:like_a_proposal' pk=proposal.id %}{%if next_url%}?next={{next_url}}{% endif %}">
{% blocktrans %}
<span class="fa-stack fa-2x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-heart fa-stack-1x fa-inverse"></i>
</span>
{% endblocktrans %}
</a>
{% include 'modal.html' with modalId='supportProposal' title='Apoya una propuesta' %}
{% else %}
{% with user|support:proposal as support %}
<a class="unlike_proposal" href="{% url 'popular_proposals:unlike_proposal' pk=support.id %}"><img src="{% static 'img/adherido.svg' %}"></a>
{% endwith %}
{% endif %}
{% else %}
{% with user|support:proposal as support %}
<a class="unlike_proposal" href="{% url 'popular_proposals:unlike_proposal' pk=support.id %}"><img src="{% static 'img/adherido.svg' %}"></a>
{% endwith %}
{% endif %}
{% else %}
<a class="btn btn-md btn-success full-width" href="{% url 'auth_login' %}">
{% blocktrans %}<i class="fa fa-heart" aria-hidden="true"></i>{% endblocktrans %}
</a>
<a class="btn btn-md btn-success full-width" href="{% url 'auth_login' %}">
{% blocktrans %}<i class="fa fa-heart" aria-hidden="true"></i>{% endblocktrans %}
</a>

{% endif%}
{% endif %}
{% endif %}
</div>
<div class="apoyo-contador">
{% blocktrans with count=proposal.likers.count %}
Expand Down
Expand Up @@ -27,7 +27,7 @@
<div id="grid">
<div id="posts">
{% for proposal in popular_proposals %}
{% include 'popular_proposal/popular_proposal_card.html' with proposal=proposal %}
{% include 'popular_proposal/popular_proposal_card.html' with proposal=proposal is_embedded=is_embedded %}
{% empty %}
{% blocktrans %}
Aún no hay propuestas acá.
Expand Down
5 changes: 3 additions & 2 deletions votai_general_theme/templates/popular_proposal/home.html
Expand Up @@ -17,15 +17,16 @@
¡Incrusta esto en tu página!
</button>
<div class="collapse" id="incrustaEnTuPagina">
<textarea style="width:700px;" readonly><iframe src="{% if request.is_secure %}https://{% else %}http://{% endif %}{{ request.get_host }}{% url 'popular_proposals:embedded_home' %}" width="600px" height="500px"></iframe></textarea>
<textarea style="width:700px;" readonly>
<iframe src="//{{ request.get_host }}{% url 'popular_proposals:embedded_home' %}" width="600px" height="500px"></iframe></textarea>
</div>
</div>
</div>
{% endif %}
<div>
<h1 class="text-center">{% trans "Propuestas en VotaInteligente" %}</h1>
<div>
{% include 'popular_proposal/_lista_propuestas.html' with popular_proposals=popular_proposals form=form %}
{% include 'popular_proposal/_lista_propuestas.html' with popular_proposals=popular_proposals form=form is_embedded=is_embedded %}
</div>
</div>
</div>
Expand Down
Expand Up @@ -4,7 +4,13 @@
{% load thumbnail %}
<div class="post propuesta">
<span class="label label-default">{{proposal.data.clasification}}</span>
<div class="small text-light">Propuesta para <a href="{% url 'area' slug=proposal.area.id %}">{{proposal.area}}</a></div>
<div class="small text-light">Propuesta para
{% if not is_embedded %}
<a href="{% url 'area' slug=proposal.area.id %}">
{% endif %}
{{proposal.area}}
{% if not is_embedded %}</a>{% endif %}
</div>
{% if proposal.title %}
<h3><a href="{% url 'popular_proposals:detail' slug=proposal.slug %}">{{proposal.title}}</a></h3>
{% endif %}
Expand Down
15 changes: 15 additions & 0 deletions votainteligente/view_mixins.py
@@ -0,0 +1,15 @@
from django.views.generic import View


class EmbeddedViewBase(View):
layout = 'base.html'
embedded_layout = 'embedded_base.html'
is_embedded = False

def get_context_data(self, * args, **kwargs):
context = super(EmbeddedViewBase, self).get_context_data(* args, **kwargs)
if self.is_embedded:
self.layout = self.embedded_layout
context['layout'] = self.layout
context['is_embedded'] = self.is_embedded
return context

0 comments on commit b09e571

Please sign in to comment.