Skip to content

Commit

Permalink
Merge pull request #112 from labhackercd/develop
Browse files Browse the repository at this point in the history
v2.1.0
  • Loading branch information
erivanio authored May 18, 2018
2 parents f0ccb2a + b2a93e2 commit 79118ce
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 17 deletions.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ django-debug-toolbar>=1.6
dj-database-url>=0.4.2
django-compressor>=2.1
django-compressor-toolkit>=0.6.0
django-constance>=2.2.0
django-picklefield>=1.0.0
django-bower>=5.2.0
django-cors-headers>=2.0.0
python3-openid>=3.0.10
Expand Down
3 changes: 2 additions & 1 deletion wikilegis/accounts/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def authenticate(self, remote_user, request=None):
)

if created:
user.first_name = remote_user_data['name']
user.first_name = remote_user_data['first_name']
user.last_name = remote_user_data['last_name']

return user
2 changes: 1 addition & 1 deletion wikilegis/core/templates/amendments/_comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</form>
{% elif amendment.bill_is_closed %}
<div class="comments__form">
<p>{% trans "This project is closed for participations." %}</p>
<p>{{ config.CLOSED_TEXT }}</p>
</div>
{% else %}
<div class="comments__form">
Expand Down
2 changes: 1 addition & 1 deletion wikilegis/core/templates/amendments/_content.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</a>
{% elif segment.bill.status == 'closed' %}
<div class="amendments__closed-message">
<p class="amendments__closed-text">{% trans "This project is closed for participations." %}</p>
<p class="amendments__closed-text">{{ config.CLOSED_TEXT }}</p>
</div>
{% endif %}

Expand Down
3 changes: 2 additions & 1 deletion wikilegis/core/templates/bill/_content.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<section id="segment-list-search" class="bill__content" data-content="bill" data-bill="{{bill.id}}" data-remove-content>
<div class="content__header">
<div class="header__section-top">
<img class="header__logo" src="{% static 'images/brasao.svg' %}" alt="{% trans 'Coat of arms of the republic' %}" />
{% get_media_prefix as MEDIA_URL %}
<img class="header__logo" src="{{ MEDIA_URL }}{{ config.COAT_OF_ARMS_IMAGE }}" alt="{% trans 'Coat of arms of the republic' %}" />

<div class="header__title">
<h1 class="title__name">{{bill.title}}</h1>
Expand Down
4 changes: 2 additions & 2 deletions wikilegis/core/templates/bill/_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h2 class="info__title">{{bill.title}}</h2>
<span class="extra-infos__text">
<i class="stats__icon icon icon-lightbulb-o"></i>
<span class="extra-infos__highlight">{{bill.amendments_count}}</span>
{% trans "Amendments suggestions" %}
{{ config.SUGGESTION_TEXT }}
</span>
</div>
<div class="extra-infos__item">
Expand All @@ -67,7 +67,7 @@ <h2 class="info__title">{{bill.title}}</h2>
</div>

<div class="info__actions--votes">
<h4 class="actions__title">{% trans "Do you support this bill?" %}</h4>
<h4 class="actions__title">{{ config.VOTE_TEXT }}</h4>
<div class="votes-wrapper" data-votes-wrapper data-object-type="bill" data-object-id="{{bill.id}}">
{% include "segment/_votes.html" with segment=bill %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion wikilegis/core/templates/bill/_newsletter.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</button>
{% else %}
<div>
<span class="header-text valign">{% trans 'Subscribe to this bill' %}</span>
<span class="header-text valign">{{ config.NEWSLETTER_TEXT }}</span>
</div>

<div>
Expand Down
6 changes: 3 additions & 3 deletions wikilegis/core/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<img class="logo__text" src="{% static 'images/logo-wikilegis-text.svg' %}">
</div>
<div class="banner__info">
<h1 class="banner__header">{% trans "Your legislative editing tool" %}</h1>
<h1 class="banner__header">{{ config.SUBTITLE }}</h1>
<p class="banner__text">
{% trans "Check the bills and contribute suggestions of new wordings to articles or paragraphs. The rapporteurs of the bills track the participation and can take up your idea!" %}
{{ config.DESCRIPTION_P1 }}
</p>
<p class="banner__text">
{% trans "With this interaction, society profits by participating more actively in the legislative process, and the Parliament profits by approving improved laws that are better attuned to citizens needs." %}
{{ config.DESCRIPTION_P2 }}
</p>
<input class="banner__search" placeholder="{% trans 'Search' %}" />
</div>
Expand Down
4 changes: 2 additions & 2 deletions wikilegis/core/templates/report/bill_report.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ <h2 class="bill-title">{{ object.title }}</h2>
</div>
</div>
<div class="bill-summary">
<span class="bill-stats"><i class="material-icons">thumbs_up_down</i><span class="bill-stats-number"> {{object.votes_count}} </span><span class="bill-stats-text">Votos do Projeto</span></span>
<span class="bill-stats"><i class="material-icons">thumbs_up_down</i><span class="bill-stats-number"> {{votes}} </span><span class="bill-stats-text">Votos em Dispositivos</span></span>
<span class="bill-stats"><i class="material-icons">thumbs_up_down</i><span class="bill-stats-number"> {{object.votes_count}} </span><span class="bill-stats-text">{{ config.BILL_VOTES }}</span></span>
<span class="bill-stats"><i class="material-icons">thumbs_up_down</i><span class="bill-stats-number"> {{votes}} </span><span class="bill-stats-text">{{ config.SEGMENT_VOTES }}</span></span>
<span class="bill-stats"><i class="material-icons">forum</i><span class="bill-stats-number">{{comments}} </span><span class="bill-stats-text">Comentários</span></span>
<span class="bill-stats"><i class="material-icons">people</i><span class="bill-stats-number">{{ attendees }}</span><span class="bill-stats-text">Participantes</span></span>
<span class="bill-stats"><i class="material-icons">note_add</i><span class="bill-stats-number">{{object.amendments_count}}</span><span class="bill-stats-text">Propostas</span></span>
Expand Down
2 changes: 1 addition & 1 deletion wikilegis/core/templates/segment/_comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</form>
{% elif segment.bill.status == 'closed' %}
<div class="comments__form">
<p>{% trans "This project is closed for participations." %}</p>
<p>{{ config.CLOSED_TEXT }}</p>
</div>
{% else %}
<div class="comments__form">
Expand Down
12 changes: 8 additions & 4 deletions wikilegis/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from distutils.util import strtobool
from django.contrib.sites.models import Site
from django.db.models import Q
from constance import config

from core import models, model_mixins

Expand Down Expand Up @@ -92,7 +93,8 @@ def render_bill_info(request, bill_id):
return error

html = render_to_string('bill/_info.html', {'request': request,
'bill': bill})
'bill': bill,
'config': config})
return JsonResponse({'html': html})
except ObjectDoesNotExist:
message = _('The following URL has returned no known bill: '
Expand All @@ -111,7 +113,8 @@ def render_bill_content(request, bill_id):
return error

html = render_to_string('bill/_content.html', {'request': request,
'bill': bill})
'bill': bill,
'config': config})
return JsonResponse({'html': html})
except ObjectDoesNotExist:
message = _('The following URL has returned no known bill: '
Expand All @@ -130,7 +133,8 @@ def render_bill_amendments(request, segment_id):
return error

html = render_to_string('amendments/_index.html', {'request': request,
'segment': segment})
'segment': segment,
'config': config})
return JsonResponse({'html': html})
except ObjectDoesNotExist:
message = _('The following URL has returned no known segment.')
Expand Down Expand Up @@ -212,7 +216,7 @@ def create_vote(model, segment_id, request):
else:
return JsonResponse(
{'title': _('Oops'),
'message': _('This bill is closed for participation :(')},
'message': config.CLOSED_TEXT},
status=403
)

Expand Down
2 changes: 2 additions & 0 deletions wikilegis/wikilegis/settings/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
]

THIRD_PARTY = [
'constance',
'constance.backends.database',
'compressor',
'compressor_toolkit',
'debug_toolbar',
Expand Down
40 changes: 40 additions & 0 deletions wikilegis/wikilegis/settings/constance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# EDITABLE SETTINGS
CONSTANCE_ADDITIONAL_FIELDS = {
'image_field': ['django.forms.ImageField', {}]
}

CONSTANCE_CONFIG = {
'SUBTITLE': ('Sua ferramenta de edição legislativa', 'Subtítulo da página '
'inicial', str),
'DESCRIPTION_P1': ('Analise os projetos de lei e contribua com sugestões '
'de nova redação a artigos ou parágrafos. Os deputados '
'relatores das proposições acompanham as participações '
'e podem adotar a sua ideia!', 'Primeiro parágrafo da '
'descrição na página inicial', str),
'DESCRIPTION_P2': ('Nessa interação, ganha a sociedade, que participa mais '
'ativamente do processo legislativo, e ganha o '
'Parlamento, que aprova leis mais aprimoradas e '
'conectadas às necessidades dos cidadãos.', 'Segundo '
'parágrafo da descrição na página inicial', str),
'VOTE_TEXT': ('Você apoia esse projeto de lei?', 'Descrição dos botões para'
' apoiar o texto', str),
'NEWSLETTER_TEXT': ('Assinar este projeto de lei', 'Texto para assinar a '
'newsletter', str),
'SUGGESTION_TEXT': ('Sugestões de emendas', 'Texto para a quantidade de '
'sugestões', str),
'CLOSED_TEXT': ('Este projeto está fechado para participação.', 'Texto '
'para exibir quando o texto estiver encerrado.', str),
'COAT_OF_ARMS_IMAGE': ('brasao.png', 'Brasão do texto', 'image_field'),
'BILL_VOTES': ('Votos do Projeto', 'Descrição dos votos no texto', str),
'SEGMENT_VOTES': ('Votos em Dispositivos', 'Descrição dos votos em '
'segmentos de texto', str),
}

CONSTANCE_CONFIG_FIELDSETS = {
'Página inicial': ('SUBTITLE', 'DESCRIPTION_P1', 'DESCRIPTION_P2'),
'Página do texto': ('VOTE_TEXT', 'NEWSLETTER_TEXT', 'SUGGESTION_TEXT',
'CLOSED_TEXT', 'COAT_OF_ARMS_IMAGE'),
'Relatório': ('BILL_VOTES', 'SEGMENT_VOTES'),
}

CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
1 change: 1 addition & 0 deletions wikilegis/wikilegis/settings/staticfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
]

THIRD_PARTY_CONTEXT_PROCESSORS = [
'constance.context_processors.config',
'social_django.context_processors.backends',
'social_django.context_processors.login_redirect',
]
Expand Down
2 changes: 2 additions & 0 deletions wikilegis/wikilegis/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@
url(r'^', include('accounts.urls')),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

if settings.FORCE_SCRIPT_NAME and settings.DEBUG:
urlpatterns += static('/static/', document_root=settings.STATIC_ROOT)

0 comments on commit 79118ce

Please sign in to comment.