diff --git a/requirements/requirements.txt b/requirements/requirements.txt index d5004fd7d..b94266581 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,8 +1,10 @@ +crispy-forms-foundation Django django-admin-bootstrapped django-bootstrap3 django-braces django-crispy-forms +django-zurb-foundation psycopg2 pytz PyYAML diff --git a/sapl/layout.py b/sapl/layout.py index 920db7089..c2998a255 100644 --- a/sapl/layout.py +++ b/sapl/layout.py @@ -1,5 +1,5 @@ -from crispy_forms.bootstrap import FormActions -from crispy_forms.layout import Submit, Reset, Layout, Div, Fieldset +from crispy_forms_foundation.layout import ( + Layout, Fieldset, Row, Column, ButtonGroup, Button, Submit) from django.utils.translation import ugettext as _ @@ -9,11 +9,11 @@ def to_column(name_span): except: return name_span else: - return Div(fieldname, css_class='col-xs-%d' % span) + return Column(fieldname, css_class='large-%d' % span) def to_row(names_spans): - return Div(*list(map(to_column, names_spans)), css_class='row-fluid') + return Row(*list(map(to_column, names_spans))) def to_fieldsets(fields): @@ -29,9 +29,21 @@ def to_fieldsets(fields): class SaplFormLayout(Layout): def __init__(self, *fields): - _fields = list(to_fieldsets(fields)) + [ - FormActions( - Submit('save', _('Save'), css_class='btn btn-primary '), - Reset('reset', _('Cancel'), css_class='btn')) - ] + _fields = list(to_fieldsets(fields)) + buttons_crispies() super(SaplFormLayout, self).__init__(*_fields) + + +def buttons_crispies(): + return [ + Row( + Column( + ButtonGroup( + Submit('submit', _('Submit'), css_class='success'), + Button('cancel', _('Cancel')), + Button('dummy', _('Delete'), css_class='alert'), + css_class='radius right' + ), + css_class='clearfix' + ), + ), + ] diff --git a/sapl/settings.py b/sapl/settings.py index 465048fbd..08b6d6a49 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -54,6 +54,10 @@ INSTALLED_APPS = ( 'django_extensions', 'bootstrap3', 'crispy_forms', + + # zurb foundation + 'foundation', + 'crispy_forms_foundation', ) MIDDLEWARE_CLASSES = ( @@ -118,9 +122,12 @@ LOCALE_PATHS = ( # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/' +STATICFILES_DIRS = ( + os.path.join(BASE_DIR, "static"), +) DAB_FIELD_RENDERER = \ 'django_admin_bootstrapped.renderers.BootstrapFieldRenderer' -CRISPY_TEMPLATE_PACK = 'bootstrap3' +CRISPY_TEMPLATE_PACK = 'foundation-5' CRISPY_FAIL_SILENTLY = not DEBUG diff --git a/templates/base.html b/templates/base.html index 89a701bc3..eebfc7be4 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,67 +1,48 @@ -{% load bootstrap3 %} {% load i18n %} -{% load static from staticfiles %} - - +{% load staticfiles %} + + + - {% block title %}{% trans 'SAPL - Sistema de Apoio ao Processo Legislativo' %}{% endblock %} - - - - - - - - {# TODO review these js dependencies #} - - - - - - - {% block extrahead %}{% endblock %} + + {% block head_title %}{% trans 'SAPL - Sistema de Apoio ao Processo Legislativo' %}{% endblock %} + + {% block header_content %} + + + + + + {% endblock %} - - -
-
... header ...
-
- - {% block content_title %}{% if title %}

{{ title }}

{% endif %}{% endblock %} - - {% bootstrap_messages %} - + {% block content_container %} + {# FIXME: row class is not for that: replace it keeping the layout (notice width) #} +
{% block content %}{% endblock %}
+ {% endblock %}

... footer...
-
- + {% block foot_more_js %}{% endblock %} + + {# Init Foundation #} + {% block foundation_js_init %} + + {% endblock foundation_js_init %}