diff --git a/.project b/.project new file mode 100644 index 0000000000..cb4da071c5 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + decide + + + + + + + + diff --git a/.travis.yml b/.travis.yml index b72f88a6e0..b78b9d2d0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,27 @@ dist: xenial - services: - - postgresql +- postgresql addons: - postgresql: "9.4" + postgresql: '9.4' before_script: - - psql -U postgres -c "create user decide password 'decide'" - - psql -U postgres -c "create database test_decide owner decide" - - psql -U postgres -c "ALTER USER decide CREATEDB" +- psql -U postgres -c "create user decide password 'decide'" +- psql -U postgres -c "create database decidedb owner decide" +- psql -U postgres -c "ALTER USER decide CREATEDB" language: python python: - - "3.6" +- '3.6' install: - - pip install -r requirements.txt - - pip install codacy-coverage +- pip install -r requirements.txt +- pip install codacy-coverage script: - - cd decide - - coverage run --branch --source=. ./manage.py test --keepdb --with-xunit - - coverage xml - - python-codacy-coverage -r coverage.xml +- cd decide +- cp travis_local_settings.py local_settings.py +- coverage run --branch --source=. ./manage.py test mixnet --keepdb +- coverage xml +- python-codacy-coverage -r coverage.xml +deploy: + provider: heroku + app: picaro-decide + strategy: git + api_key: + secure: SDt7FSvAfUp9J0aA0vhQGKN7ZUfHvbyX/GMr/gVQmlkobFNWu9Wk8f5O2jzxEcHJfP9DKRPwzK5CF2d422bd/toKXEJldIoZL57YQnomlKElqetaLBoETyydhn/oZkkF+aTv/zZF92m2dQGetTlG6Zp1sqFSW9BwXFKBrMIh9XjqFton6AFDZ5DPCy6Gn9303OAkxtWmqG4EGTEzJ2VV9ambCEMs30ZSeAGn4eVbWC92CvSaef32aOBvKcHKSKIrBkN5Y0olYGHRj00s+tr0iBlVfxKyVb1lI6vwuuh85+8w2UGVXp+NCAEy+Dm1RLz3lhDi3hpIyXK1V9JCqw6arbuNgvB0vHvRuldAj8cw3lmpD9kLlmDfstyw5MJd8UAf22rwsI1nUA6Ga/qycAD1kOIOgPwF6oWLW16M+MOGE/+loZIj4NmQTs3wiYAemqwVqEHc9enViEAaSD2M2zUWPI7L2m9gd2iOll6UleKosqz9f8hQFBLKcaTuaoH5qRHAIPeSVIAZA+GmJhbj9lM++yVhZW5aJ0SVzx+RhGAXcgweVNtUIH8F2DU1Es001zNML90k+G47MpnGqfIHuZcxSVtttLS6raoJIHEQSNUzfwXsy4mBjnUzZvy4YeOf/DId8kb/Wrk0+8P/MOoaDVUEePae7rz4jRcHfHj1UXMPpd0= diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..18c002a3ca --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "C:\\Python3\\python.exe" +} \ No newline at end of file diff --git a/Procfile b/Procfile new file mode 100644 index 0000000000..818fef7fe3 --- /dev/null +++ b/Procfile @@ -0,0 +1,4 @@ +% prepara el repositorio para su despliegue. +release: sh -c 'cd decide && python manage.py migrate' +% especifica el comando para lanzar Decide +web: sh -c 'cd decide && gunicorn decide.wsgi --log-file -' diff --git a/README.md b/README.md index 83d0a57e27..56ed957699 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ [![Build Status](https://travis-ci.com/wadobo/decide.svg?branch=master)](https://travis-ci.com/wadobo/decide) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/94a85eaa0e974c71af6899ea3b0d27e0)](https://www.codacy.com/app/Wadobo/decide?utm_source=github.com&utm_medium=referral&utm_content=wadobo/decide&utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/94a85eaa0e974c71af6899ea3b0d27e0)](https://www.codacy.com/app/Wadobo/decide?utm_source=github.com&utm_medium=referral&utm_content=wadobo/decide&utm_campaign=Badge_Coverage) - +Prueba: +pabfrasan +abrgarvil Plataforma voto electrónico educativa ===================================== diff --git a/decide/base/templates/base.html b/decide/base/templates/base.html index fa9cf4aa8a..713d747efb 100644 --- a/decide/base/templates/base.html +++ b/decide/base/templates/base.html @@ -1,8 +1,10 @@ - +{% load i18n static %} + - {% block title %}Decide!{% endblock %} + Decide Pícaro{% block title %}{% endblock %} + {% block extrahead %}{% endblock %} diff --git a/decide/decide/settings.py b/decide/decide/settings.py index 1d22b67324..8bcb28e216 100644 --- a/decide/decide/settings.py +++ b/decide/decide/settings.py @@ -70,7 +70,19 @@ 'voting', ] -BASEURL = 'http://localhost:8000' +BASEURL = 'https://picaro-decide.herokuapp.com' + +APIS = { + 'authentication': BASEURL , + 'base': BASEURL , + 'booth': BASEURL , + 'census': BASEURL , + 'mixnet': BASEURL , + 'postproc': BASEURL , + 'store': BASEURL , + 'visualizer': BASEURL , + 'voting': BASEURL , + } MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', @@ -150,6 +162,10 @@ USE_TZ = True +LOCALE_PATHS = [ + os.path.join(BASE_DIR, 'locale') +] + TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' @@ -157,6 +173,21 @@ # https://docs.djangoproject.com/en/2.0/howto/static-files/ STATIC_URL = '/static/' +STATIC_ROOT = '' +STATIC_TMP = os.path.join(BASE_DIR, 'static') + +os.makedirs(STATIC_TMP, exist_ok=True) + +STATICFILES_DIRS = ( + 'static', +) + +MEDIA_URL = '/media/' +MEDIA_ROOT = '' + +MEDIAFILES_DIRS = ( + 'media', +) # number of bits for the key, all auths should use the same number of bits KEYBITS = 256 @@ -180,3 +211,6 @@ INSTALLED_APPS = INSTALLED_APPS + MODULES + +import django_heroku +django_heroku.settings(locals()) diff --git a/decide/postproc/views.py b/decide/postproc/views.py index f4c5de1e5f..47871478a6 100644 --- a/decide/postproc/views.py +++ b/decide/postproc/views.py @@ -11,7 +11,7 @@ def identity(self, options): out.append({ **opt, 'postproc': opt['votes'], - }); + }) out.sort(key=lambda x: -x['postproc']) return Response(out) diff --git a/decide/booth/static/booth/style.css b/decide/static/booth/style.css similarity index 100% rename from decide/booth/static/booth/style.css rename to decide/static/booth/style.css diff --git a/decide/booth/static/crypto/bigint.js b/decide/static/crypto/bigint.js similarity index 100% rename from decide/booth/static/crypto/bigint.js rename to decide/static/crypto/bigint.js diff --git a/decide/booth/static/crypto/elgamal.js b/decide/static/crypto/elgamal.js similarity index 100% rename from decide/booth/static/crypto/elgamal.js rename to decide/static/crypto/elgamal.js diff --git a/decide/booth/static/crypto/jsbn.js b/decide/static/crypto/jsbn.js similarity index 100% rename from decide/booth/static/crypto/jsbn.js rename to decide/static/crypto/jsbn.js diff --git a/decide/booth/static/crypto/jsbn2.js b/decide/static/crypto/jsbn2.js similarity index 100% rename from decide/booth/static/crypto/jsbn2.js rename to decide/static/crypto/jsbn2.js diff --git a/decide/booth/static/crypto/sjcl.js b/decide/static/crypto/sjcl.js similarity index 100% rename from decide/booth/static/crypto/sjcl.js rename to decide/static/crypto/sjcl.js diff --git a/decide/static/css/footer.css b/decide/static/css/footer.css new file mode 100644 index 0000000000..d27329bb10 --- /dev/null +++ b/decide/static/css/footer.css @@ -0,0 +1,9 @@ + +.footer { + position: absolute; + bottom: 0; + width: 100%; + + background-color: #f5f5f5; + } + diff --git a/decide/static/css/mfb.css b/decide/static/css/mfb.css new file mode 100644 index 0000000000..39063306c3 --- /dev/null +++ b/decide/static/css/mfb.css @@ -0,0 +1,671 @@ +/** + * CONTENTS + * + * #Introduction........Naming conventions used throughout the code. + * + * #SETTINGS + * Variables............Globally-available variables and config. + * + * #TOOLS + * Mixins...............Useful mixins. + * + * #GENERIC + * Demo styles..........Styles for demo only (consider removing these). + * + * #BASE + * Raw styles...........The very basic component wrapper. + * Modifiers............The basic styles dependant on component placement. + * Debuggers............The basic styles dependant on component placement. + * + * #BUTTONS + * Base..................Wrapping and constraining every button. + * Modifiers.............Styles that depends on state and settings. + * Animations............Main animations of the component. + * Debuggers.............Styles for development. + * + * #LABELS + * Base..................Wrapping and constraining every label. + * Modifiers.............Styles that depends on state and settings. + * Debuggers.............Styles for development. + * + * #DEVELOPMENT + * In development........These styles are in development and not yet finalised + * Debuggers.............Helper styles and flags for development. + */ +/*------------------------------------*\ + #Introduction +\*------------------------------------*/ +/** + * The code AND the comments use naming conventions to refer to each part of + * the UI put in place by this component. If you see that somewhere they are + * not followed please consider a Pull Request. The naming conventions are: + * + * "Component" : the widget itself as a whole. This is the last time it will be + * called anything different than "component". So, stay away from + * "widget", "button" or anything else when referring to the + * Component in general. + * + * "Main Button" : the button that is always in view. Hovering or clicking on it + * will reveal the child buttons. + * + * "Child buttons" : if you've read the previous point you know what they are. + * Did you read the previous point? :) + * + * "Label(s)" : the tooltip that fades in when hovering over a button. + +/*------------------------------------*\ + #SETTINGS | Variables +\*------------------------------------*/ +/** + * These variables are the default styles that serve as fallback and can be + * easily customised at compile time. + * Consider overriding them in your own style sheets rather than editing them + * here. Refer to the docs for more info. + */ +/* COLORS ----------------------------*/ +/* EFFECTS ---------------------------*/ +/* SPEEDS ----------------------------*/ +/* SIZES -----------------------------*/ +/* SPACING ---------------------------*/ +/* OTHER VARIABLES -------------------*/ +/*------------------------------------*\ + #BASE | Raw styles +\*------------------------------------*/ +/** + * The very core styling of the button. + * These styles are shared by every instance of the button. + * Styles placed here should NOT care about placement in the screen, + * options chosen by the user or state of the button. + */ +.mfb-component--tl, .mfb-component--tr, .mfb-component--bl, .mfb-component--br { + box-sizing: border-box; + margin: 25px; + position: fixed; + white-space: nowrap; + z-index: 30; + padding-left: 0; + list-style: none; } + .mfb-component--tl *, .mfb-component--tr *, .mfb-component--bl *, .mfb-component--br *, .mfb-component--tl *:before, .mfb-component--tr *:before, .mfb-component--bl *:before, .mfb-component--br *:before, .mfb-component--tl *:after, .mfb-component--tr *:after, .mfb-component--bl *:after, .mfb-component--br *:after { + box-sizing: inherit; } + +/*------------------------------------*\ + #BASE | Modifiers +\*------------------------------------*/ +/** + * These styles depends on the placement of the button. + * Styles can be: + * 1. Top-left: modified by the " --tl " suffix. + * 2. Top-right: modified by the " --tr " suffix. + * 3. Bottom-left: modified by the " --bl " suffix. + * 4. Bottom-right: modified by the " --br " suffix. + */ +.mfb-component--tl { + left: 0; + top: 0; } + +.mfb-component--tr { + right: 0; + top: 0; } + +.mfb-component--bl { + left: 0; + bottom: 0; } + +.mfb-component--br { + right: 0; + bottom: 0; } + +/*------------------------------------*\ + #BUTTONS | Base +\*------------------------------------*/ +.mfb-component__button--main, .mfb-component__button--child { + background-color: #E40A5D; + display: inline-block; + position: relative; + border: none; + border-radius: 50%; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.14), 0 4px 8px rgba(0, 0, 0, 0.28); + cursor: pointer; + outline: none; + padding: 0; + position: relative; + -webkit-user-drag: none; + color: #f1f1f1; } + +/** + * This is the unordered list for the list items that contain + * the child buttons. + * + */ +.mfb-component__list { + list-style: none; + margin: 0; + padding: 0; } + .mfb-component__list > li { + display: block; + position: absolute; + top: 0; + right: 1px; + padding: 10px 0; + margin: -10px 0; } + +/** + * These are the basic styles for all the icons inside the main button + */ +.mfb-component__icon, .mfb-component__main-icon--active, +.mfb-component__main-icon--resting, .mfb-component__child-icon { + position: absolute; + font-size: 18px; + text-align: center; + line-height: 56px; + width: 100%; } + +.mfb-component__wrap { + padding: 25px; + margin: -25px; } + +[data-mfb-toggle="hover"]:hover .mfb-component__icon, [data-mfb-toggle="hover"]:hover .mfb-component__main-icon--active, +[data-mfb-toggle="hover"]:hover .mfb-component__main-icon--resting, [data-mfb-toggle="hover"]:hover .mfb-component__child-icon, +[data-mfb-state="open"] .mfb-component__icon, +[data-mfb-state="open"] .mfb-component__main-icon--active, +[data-mfb-state="open"] .mfb-component__main-icon--resting, +[data-mfb-state="open"] .mfb-component__child-icon { + -webkit-transform: scale(1) rotate(0deg); + transform: scale(1) rotate(0deg); } + +/*------------------------------------*\ + #BUTTONS | Modifiers +\*------------------------------------*/ +.mfb-component__button--main { + height: 56px; + width: 56px; + z-index: 20; } + +.mfb-component__button--child { + height: 56px; + width: 56px; } + +.mfb-component__main-icon--active, +.mfb-component__main-icon--resting { + -webkit-transform: scale(1) rotate(360deg); + transform: scale(1) rotate(360deg); + -webkit-transition: -webkit-transform 150ms cubic-bezier(0.4, 0, 1, 1); + transition: transform 150ms cubic-bezier(0.4, 0, 1, 1); } + +.mfb-component__child-icon, +.mfb-component__child-icon { + line-height: 56px; + font-size: 18px; } + +.mfb-component__main-icon--active { + opacity: 0; } + +[data-mfb-toggle="hover"]:hover .mfb-component__main-icon, +[data-mfb-state="open"] .mfb-component__main-icon { + -webkit-transform: scale(1) rotate(0deg); + transform: scale(1) rotate(0deg); } +[data-mfb-toggle="hover"]:hover .mfb-component__main-icon--resting, +[data-mfb-state="open"] .mfb-component__main-icon--resting { + opacity: 0; + position: absolute !important; } +[data-mfb-toggle="hover"]:hover .mfb-component__main-icon--active, +[data-mfb-state="open"] .mfb-component__main-icon--active { + opacity: 1; } + +/*------------------------------------*\ + #BUTTONS | Animations +\*------------------------------------*/ +/** + * SLIDE IN + FADE + * When hovering the main button, the child buttons slide out from beneath + * the main button while transitioning from transparent to opaque. + * + */ +.mfb-component--tl.mfb-slidein .mfb-component__list li, +.mfb-component--tr.mfb-slidein .mfb-component__list li { + opacity: 0; + transition: all 0.5s; } +.mfb-component--tl.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li, .mfb-component--tl.mfb-slidein[data-mfb-state="open"] .mfb-component__list li, +.mfb-component--tr.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li, +.mfb-component--tr.mfb-slidein[data-mfb-state="open"] .mfb-component__list li { + opacity: 1; } +.mfb-component--tl.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), .mfb-component--tl.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(1) { + -webkit-transform: translateY(70px); + transform: translateY(70px); } +.mfb-component--tl.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), .mfb-component--tl.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(2) { + -webkit-transform: translateY(140px); + transform: translateY(140px); } +.mfb-component--tl.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), .mfb-component--tl.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(3) { + -webkit-transform: translateY(210px); + transform: translateY(210px); } +.mfb-component--tl.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), .mfb-component--tl.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(4) { + -webkit-transform: translateY(280px); + transform: translateY(280px); } + +.mfb-component--bl.mfb-slidein .mfb-component__list li, +.mfb-component--br.mfb-slidein .mfb-component__list li { + opacity: 0; + transition: all 0.5s; } +.mfb-component--bl.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li, .mfb-component--bl.mfb-slidein[data-mfb-state="open"] .mfb-component__list li, +.mfb-component--br.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li, +.mfb-component--br.mfb-slidein[data-mfb-state="open"] .mfb-component__list li { + opacity: 1; } +.mfb-component--bl.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), .mfb-component--bl.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(1) { + -webkit-transform: translateY(-70px); + transform: translateY(-70px); } +.mfb-component--bl.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), .mfb-component--bl.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(2) { + -webkit-transform: translateY(-140px); + transform: translateY(-140px); } +.mfb-component--bl.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), .mfb-component--bl.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(3) { + -webkit-transform: translateY(-210px); + transform: translateY(-210px); } +.mfb-component--bl.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), .mfb-component--bl.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-slidein[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-slidein[data-mfb-state="open"] .mfb-component__list li:nth-child(4) { + -webkit-transform: translateY(-280px); + transform: translateY(-280px); } + +/** + * SLIDE IN SPRING + * Same as slide-in but with a springy animation. + * + */ +.mfb-component--tl.mfb-slidein-spring .mfb-component__list li, +.mfb-component--tr.mfb-slidein-spring .mfb-component__list li { + opacity: 0; + transition: all 0.5s; + transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); } +.mfb-component--tl.mfb-slidein-spring .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-slidein-spring .mfb-component__list li:nth-child(1) { + transition-delay: 0.05s; } +.mfb-component--tl.mfb-slidein-spring .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-slidein-spring .mfb-component__list li:nth-child(2) { + transition-delay: 0.1s; } +.mfb-component--tl.mfb-slidein-spring .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-slidein-spring .mfb-component__list li:nth-child(3) { + transition-delay: 0.15s; } +.mfb-component--tl.mfb-slidein-spring .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-slidein-spring .mfb-component__list li:nth-child(4) { + transition-delay: 0.2s; } +.mfb-component--tl.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li, .mfb-component--tl.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li, +.mfb-component--tr.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li, +.mfb-component--tr.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li { + opacity: 1; } +.mfb-component--tl.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), .mfb-component--tl.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(1) { + transition-delay: 0.05s; + -webkit-transform: translateY(70px); + transform: translateY(70px); } +.mfb-component--tl.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), .mfb-component--tl.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(2) { + transition-delay: 0.1s; + -webkit-transform: translateY(140px); + transform: translateY(140px); } +.mfb-component--tl.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), .mfb-component--tl.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(3) { + transition-delay: 0.15s; + -webkit-transform: translateY(210px); + transform: translateY(210px); } +.mfb-component--tl.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), .mfb-component--tl.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(4) { + transition-delay: 0.2s; + -webkit-transform: translateY(280px); + transform: translateY(280px); } + +.mfb-component--bl.mfb-slidein-spring .mfb-component__list li, +.mfb-component--br.mfb-slidein-spring .mfb-component__list li { + opacity: 0; + transition: all 0.5s; + transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); } +.mfb-component--bl.mfb-slidein-spring .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-slidein-spring .mfb-component__list li:nth-child(1) { + transition-delay: 0.05s; } +.mfb-component--bl.mfb-slidein-spring .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-slidein-spring .mfb-component__list li:nth-child(2) { + transition-delay: 0.1s; } +.mfb-component--bl.mfb-slidein-spring .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-slidein-spring .mfb-component__list li:nth-child(3) { + transition-delay: 0.15s; } +.mfb-component--bl.mfb-slidein-spring .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-slidein-spring .mfb-component__list li:nth-child(4) { + transition-delay: 0.2s; } +.mfb-component--bl.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li, .mfb-component--bl.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li, +.mfb-component--br.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li, +.mfb-component--br.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li { + opacity: 1; } +.mfb-component--bl.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), .mfb-component--bl.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(1) { + transition-delay: 0.05s; + -webkit-transform: translateY(-70px); + transform: translateY(-70px); } +.mfb-component--bl.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), .mfb-component--bl.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(2) { + transition-delay: 0.1s; + -webkit-transform: translateY(-140px); + transform: translateY(-140px); } +.mfb-component--bl.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), .mfb-component--bl.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(3) { + transition-delay: 0.15s; + -webkit-transform: translateY(-210px); + transform: translateY(-210px); } +.mfb-component--bl.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), .mfb-component--bl.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-slidein-spring[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-slidein-spring[data-mfb-state="open"] .mfb-component__list li:nth-child(4) { + transition-delay: 0.2s; + -webkit-transform: translateY(-280px); + transform: translateY(-280px); } + +/** + * ZOOM-IN + * When hovering the main button, the child buttons grow + * from zero to normal size. + * + */ +.mfb-component--tl.mfb-zoomin .mfb-component__list li, +.mfb-component--tr.mfb-zoomin .mfb-component__list li { + -webkit-transform: scale(0); + transform: scale(0); } +.mfb-component--tl.mfb-zoomin .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-zoomin .mfb-component__list li:nth-child(1) { + -webkit-transform: translateY(70px) scale(0); + transform: translateY(70px) scale(0); + transition: all 0.5s; + transition-delay: 0.15s; } +.mfb-component--tl.mfb-zoomin .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-zoomin .mfb-component__list li:nth-child(2) { + -webkit-transform: translateY(140px) scale(0); + transform: translateY(140px) scale(0); + transition: all 0.5s; + transition-delay: 0.1s; } +.mfb-component--tl.mfb-zoomin .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-zoomin .mfb-component__list li:nth-child(3) { + -webkit-transform: translateY(210px) scale(0); + transform: translateY(210px) scale(0); + transition: all 0.5s; + transition-delay: 0.05s; } +.mfb-component--tl.mfb-zoomin .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-zoomin .mfb-component__list li:nth-child(4) { + -webkit-transform: translateY(280px) scale(0); + transform: translateY(280px) scale(0); + transition: all 0.5s; + transition-delay: 0s; } +.mfb-component--tl.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), .mfb-component--tl.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(1) { + -webkit-transform: translateY(70px) scale(1); + transform: translateY(70px) scale(1); + transition-delay: 0.05s; } +.mfb-component--tl.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), .mfb-component--tl.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(2) { + -webkit-transform: translateY(140px) scale(1); + transform: translateY(140px) scale(1); + transition-delay: 0.1s; } +.mfb-component--tl.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), .mfb-component--tl.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(3) { + -webkit-transform: translateY(210px) scale(1); + transform: translateY(210px) scale(1); + transition-delay: 0.15s; } +.mfb-component--tl.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), .mfb-component--tl.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(4) { + -webkit-transform: translateY(280px) scale(1); + transform: translateY(280px) scale(1); + transition-delay: 0.2s; } + +.mfb-component--bl.mfb-zoomin .mfb-component__list li, +.mfb-component--br.mfb-zoomin .mfb-component__list li { + -webkit-transform: scale(0); + transform: scale(0); } +.mfb-component--bl.mfb-zoomin .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-zoomin .mfb-component__list li:nth-child(1) { + -webkit-transform: translateY(-70px) scale(0); + transform: translateY(-70px) scale(0); + transition: all 0.5s; + transition-delay: 0.15s; } +.mfb-component--bl.mfb-zoomin .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-zoomin .mfb-component__list li:nth-child(2) { + -webkit-transform: translateY(-140px) scale(0); + transform: translateY(-140px) scale(0); + transition: all 0.5s; + transition-delay: 0.1s; } +.mfb-component--bl.mfb-zoomin .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-zoomin .mfb-component__list li:nth-child(3) { + -webkit-transform: translateY(-210px) scale(0); + transform: translateY(-210px) scale(0); + transition: all 0.5s; + transition-delay: 0.05s; } +.mfb-component--bl.mfb-zoomin .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-zoomin .mfb-component__list li:nth-child(4) { + -webkit-transform: translateY(-280px) scale(0); + transform: translateY(-280px) scale(0); + transition: all 0.5s; + transition-delay: 0s; } +.mfb-component--bl.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), .mfb-component--bl.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(1) { + -webkit-transform: translateY(-70px) scale(1); + transform: translateY(-70px) scale(1); + transition-delay: 0.05s; } +.mfb-component--bl.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), .mfb-component--bl.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(2) { + -webkit-transform: translateY(-140px) scale(1); + transform: translateY(-140px) scale(1); + transition-delay: 0.1s; } +.mfb-component--bl.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), .mfb-component--bl.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(3) { + -webkit-transform: translateY(-210px) scale(1); + transform: translateY(-210px) scale(1); + transition-delay: 0.15s; } +.mfb-component--bl.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), .mfb-component--bl.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-zoomin[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-zoomin[data-mfb-state="open"] .mfb-component__list li:nth-child(4) { + -webkit-transform: translateY(-280px) scale(1); + transform: translateY(-280px) scale(1); + transition-delay: 0.2s; } + +/** + * FOUNTAIN + * When hovering the main button the child buttons + * jump into view from outside the viewport + */ +.mfb-component--tl.mfb-fountain .mfb-component__list li, +.mfb-component--tr.mfb-fountain .mfb-component__list li { + -webkit-transform: scale(0); + transform: scale(0); } +.mfb-component--tl.mfb-fountain .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-fountain .mfb-component__list li:nth-child(1) { + -webkit-transform: translateY(-70px) scale(0); + transform: translateY(-70px) scale(0); + transition: all 0.5s; + transition-delay: 0.15s; } +.mfb-component--tl.mfb-fountain .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-fountain .mfb-component__list li:nth-child(2) { + -webkit-transform: translateY(-140px) scale(0); + transform: translateY(-140px) scale(0); + transition: all 0.5s; + transition-delay: 0.1s; } +.mfb-component--tl.mfb-fountain .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-fountain .mfb-component__list li:nth-child(3) { + -webkit-transform: translateY(-210px) scale(0); + transform: translateY(-210px) scale(0); + transition: all 0.5s; + transition-delay: 0.05s; } +.mfb-component--tl.mfb-fountain .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-fountain .mfb-component__list li:nth-child(4) { + -webkit-transform: translateY(-280px) scale(0); + transform: translateY(-280px) scale(0); + transition: all 0.5s; + transition-delay: 0s; } +.mfb-component--tl.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), .mfb-component--tl.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), +.mfb-component--tr.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(1) { + -webkit-transform: translateY(70px) scale(1); + transform: translateY(70px) scale(1); + transition-delay: 0.05s; } +.mfb-component--tl.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), .mfb-component--tl.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), +.mfb-component--tr.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(2) { + -webkit-transform: translateY(140px) scale(1); + transform: translateY(140px) scale(1); + transition-delay: 0.1s; } +.mfb-component--tl.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), .mfb-component--tl.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), +.mfb-component--tr.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(3) { + -webkit-transform: translateY(210px) scale(1); + transform: translateY(210px) scale(1); + transition-delay: 0.15s; } +.mfb-component--tl.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), .mfb-component--tl.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), +.mfb-component--tr.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(4) { + -webkit-transform: translateY(280px) scale(1); + transform: translateY(280px) scale(1); + transition-delay: 0.2s; } + +.mfb-component--bl.mfb-fountain .mfb-component__list li, +.mfb-component--br.mfb-fountain .mfb-component__list li { + -webkit-transform: scale(0); + transform: scale(0); } +.mfb-component--bl.mfb-fountain .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-fountain .mfb-component__list li:nth-child(1) { + -webkit-transform: translateY(70px) scale(0); + transform: translateY(70px) scale(0); + transition: all 0.5s; + transition-delay: 0.15s; } +.mfb-component--bl.mfb-fountain .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-fountain .mfb-component__list li:nth-child(2) { + -webkit-transform: translateY(140px) scale(0); + transform: translateY(140px) scale(0); + transition: all 0.5s; + transition-delay: 0.1s; } +.mfb-component--bl.mfb-fountain .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-fountain .mfb-component__list li:nth-child(3) { + -webkit-transform: translateY(210px) scale(0); + transform: translateY(210px) scale(0); + transition: all 0.5s; + transition-delay: 0.05s; } +.mfb-component--bl.mfb-fountain .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-fountain .mfb-component__list li:nth-child(4) { + -webkit-transform: translateY(280px) scale(0); + transform: translateY(280px) scale(0); + transition: all 0.5s; + transition-delay: 0s; } +.mfb-component--bl.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), .mfb-component--bl.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(1), +.mfb-component--br.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(1) { + -webkit-transform: translateY(-70px) scale(1); + transform: translateY(-70px) scale(1); + transition-delay: 0.05s; } +.mfb-component--bl.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), .mfb-component--bl.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(2), +.mfb-component--br.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(2) { + -webkit-transform: translateY(-140px) scale(1); + transform: translateY(-140px) scale(1); + transition-delay: 0.1s; } +.mfb-component--bl.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), .mfb-component--bl.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(3), +.mfb-component--br.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(3) { + -webkit-transform: translateY(-210px) scale(1); + transform: translateY(-210px) scale(1); + transition-delay: 0.15s; } +.mfb-component--bl.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), .mfb-component--bl.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-fountain[data-mfb-toggle="hover"]:hover .mfb-component__list li:nth-child(4), +.mfb-component--br.mfb-fountain[data-mfb-state="open"] .mfb-component__list li:nth-child(4) { + -webkit-transform: translateY(-280px) scale(1); + transform: translateY(-280px) scale(1); + transition-delay: 0.2s; } + +/*------------------------------------*\ + #LABELS | base +\*------------------------------------*/ +/** + * These are the labels associated to each button, + * exposed only when hovering the related button. + * They are called labels but are in fact data-attributes of + * each button (an anchor tag). + */ +[data-mfb-label]:after { + content: attr(data-mfb-label); + opacity: 0; + transition: all 0.5s; + background: rgba(0, 0, 0, 0.4); + padding: 4px 10px; + border-radius: 3px; + color: rgba(255, 255, 255, 0.8); + font-size: 14px; + font-weight: normal; + pointer-events: none; + line-height: normal; + position: absolute; + top: 50%; + margin-top: -11px; + transition: all 0.5s; } + +[data-mfb-toggle="hover"] [data-mfb-label]:hover:after, +[data-mfb-state="open"] [data-mfb-label]:after { + content: attr(data-mfb-label); + opacity: 1; + transition: all 0.3s; } + +/*------------------------------------*\ + #LABELS | Modifiers +\*------------------------------------*/ +.mfb-component--br [data-mfb-label]:after, .mfb-component--tr [data-mfb-label]:after { + content: attr(data-mfb-label); + right: 70px; } + +.mfb-component--br .mfb-component__list [data-mfb-label]:after, .mfb-component--tr .mfb-component__list [data-mfb-label]:after { + content: attr(data-mfb-label); + right: 70px; } + +.mfb-component--tl [data-mfb-label]:after, .mfb-component--bl [data-mfb-label]:after { + content: attr(data-mfb-label); + left: 70px; } + +.mfb-component--tl .mfb-component__list [data-mfb-label]:after, .mfb-component--bl .mfb-component__list [data-mfb-label]:after { + content: attr(data-mfb-label); + left: 70px; } + +/*------------------------------------*\ + #DEVELOPMENT | In development +\*------------------------------------*/ +/** + * This part is where unfinished code should stay. + * When a feature is ready(sh) move these styles to their proper place. + */ +/*------------------------------------*\ + #DEVELOPMENT | Debuggers +\*------------------------------------*/ +/** + * These are mainly helpers for development. They do not have to end up + * in production but it's handy to keep them when developing. + */ +/** + * Apply this class to the html tag when developing the slide-in button + */ + +/*# sourceMappingURL=mfb.css.map */ diff --git a/decide/static/favicon/picaro.png b/decide/static/favicon/picaro.png new file mode 100644 index 0000000000..19ac79cb3b Binary files /dev/null and b/decide/static/favicon/picaro.png differ diff --git a/decide/static/images/england.jpg b/decide/static/images/england.jpg new file mode 100644 index 0000000000..0aff82d230 Binary files /dev/null and b/decide/static/images/england.jpg differ diff --git a/decide/static/images/spain.jpg b/decide/static/images/spain.jpg new file mode 100644 index 0000000000..2170439f63 Binary files /dev/null and b/decide/static/images/spain.jpg differ diff --git a/decide/static/js/mfb.js b/decide/static/js/mfb.js new file mode 100644 index 0000000000..ea6ce731fe --- /dev/null +++ b/decide/static/js/mfb.js @@ -0,0 +1,98 @@ +/** + * Material floating button + * By: Nobita + * Repo and docs: https://github.com/nobitagit/material-floating-button + * + * License: MIT + */ + + // build script hook - don't remove + ;(function ( window, document, undefined ) { + + + 'use strict'; + + /** + * Some defaults + */ + var clickOpt = 'click', + hoverOpt = 'hover', + toggleMethod = 'data-mfb-toggle', + menuState = 'data-mfb-state', + isOpen = 'open', + isClosed = 'closed', + mainButtonClass = 'mfb-component__button--main'; + + /** + * Internal references + */ + var elemsToClick, + elemsToHover, + mainButton, + target, + currentState; + + /** + * For every menu we need to get the main button and attach the appropriate evt. + */ + function attachEvt( elems, evt ){ + for( var i = 0, len = elems.length; i < len; i++ ){ + mainButton = elems[i].querySelector('.' + mainButtonClass); + mainButton.addEventListener( evt , toggleButton, false); + } + } + + /** + * Remove the hover option, set a click toggle and a default, + * initial state of 'closed' to menu that's been targeted. + */ + function replaceAttrs( elems ){ + for( var i = 0, len = elems.length; i < len; i++ ){ + elems[i].setAttribute( toggleMethod, clickOpt ); + elems[i].setAttribute( menuState, isClosed ); + } + } + + function getElemsByToggleMethod( selector ){ + return document.querySelectorAll('[' + toggleMethod + '="' + selector + '"]'); + } + + /** + * The open/close action is performed by toggling an attribute + * on the menu main element. + * + * First, check if the target is the menu itself. If it's a child + * keep walking up the tree until we found the main element + * where we can toggle the state. + */ + function toggleButton( evt ){ + + target = evt.target; + while ( target && !target.getAttribute( toggleMethod ) ){ + target = target.parentNode; + if(!target) { return; } + } + + currentState = target.getAttribute( menuState ) === isOpen ? isClosed : isOpen; + + target.setAttribute(menuState, currentState); + + } + + /** + * On touch enabled devices we assume that no hover state is possible. + * So, we get the menu with hover action configured and we set it up + * in order to make it usable with tap/click. + **/ + if ( window.Modernizr && Modernizr.touch ){ + elemsToHover = getElemsByToggleMethod( hoverOpt ); + replaceAttrs( elemsToHover ); + } + + elemsToClick = getElemsByToggleMethod( clickOpt ); + + attachEvt( elemsToClick, 'click' ); + +// build script hook - don't remove +})( window, document ); + diff --git a/decide/travis_local_settings.py b/decide/travis_local_settings.py new file mode 100644 index 0000000000..d4162dae92 --- /dev/null +++ b/decide/travis_local_settings.py @@ -0,0 +1,41 @@ +ALLOWED_HOSTS = ["*"] + +# Modules in use, commented modules that you won't use +MODULES = [ + 'authentication', + 'base', + 'booth', + 'census', + 'mixnet', + 'postproc', + 'store', + 'visualizer', + 'voting', +] + +APIS = { + 'authentication': 'http://localhost:8000', + 'base': 'http://localhost:8000', + 'booth': 'http://localhost:8000', + 'census': 'http://localhost:8000', + 'mixnet': 'http://localhost:8000', + 'postproc': 'http://localhost:8000', + 'store': 'http://localhost:8000', + 'visualizer': 'http://localhost:8000', + 'voting': 'http://localhost:8000', +} + +BASEURL = 'http://localhost:8000' + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'postgres', + 'USER': 'postgres', + 'HOST': 'localhost', + 'PORT': '5432', + } +} + +# number of bits for the key, all auths should use the same number of bits +KEYBITS = 256 diff --git a/decide/visualizer/templates/visualizer/visualizer.html b/decide/visualizer/templates/visualizer/visualizer.html index 0faed6bac3..9f62902484 100644 --- a/decide/visualizer/templates/visualizer/visualizer.html +++ b/decide/visualizer/templates/visualizer/visualizer.html @@ -1,28 +1,35 @@ {% extends "base.html" %} {% load i18n static %} +{% block title %} - Visualización{% endblock %} {% block extrahead %} - - - + + + + + + + + {% endblock %} {% block content %}
- Decide + Decide Visualización + + + + + + -
-

[[ voting.id ]] - [[ voting.name ]]

+ -

Votación no comenzada

-

Votación en curso

-
-

Resultados:

@@ -40,9 +47,46 @@

Resultados:

+ + +
+ + + + + + +
{% endblock %} @@ -51,7 +95,7 @@

Resultados:

- + + + + + + + + + + {% endblock %} diff --git a/docker/Dockerfile b/docker/Dockerfile index 032eed28e2..3bb98458b2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -from python:alpine +from python:3.7-alpine RUN apk add --no-cache git postgresql-dev gcc libc-dev RUN apk add --no-cache gcc g++ make libffi-dev python3-dev build-base @@ -10,7 +10,7 @@ RUN pip install ipython WORKDIR /app -RUN git clone https://github.com/wadobo/decide.git . +RUN git clone https://github.com/pabfrasan/decide . RUN pip install -r requirements.txt WORKDIR /app/decide diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 095583eb02..4689c5ff98 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -4,11 +4,13 @@ services: db: restart: always container_name: decide_db - image: postgres:alpine + image: postgres:10.15-alpine volumes: - db:/var/lib/postgresql/data networks: - decide + environment: + - POSTGRES_PASSWORD=postgres web: restart: always container_name: decide_web diff --git a/docker/docker-settings.py b/docker/docker-settings.py index 01e643d936..49efb3d78f 100644 --- a/docker/docker-settings.py +++ b/docker/docker-settings.py @@ -5,6 +5,7 @@ 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'postgres', 'USER': 'postgres', + 'PASSWORD' : 'postgres', 'HOST': 'db', 'PORT': 5432, } diff --git a/requirements.txt b/requirements.txt index d5860a1eb4..61e80a1373 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,8 +4,10 @@ djangorestframework==3.7.7 django-cors-headers==2.1.0 requests==2.18.4 django-filter==1.1.0 -psycopg2==2.7.4 +psycopg2-binary==2.8.4 django-rest-swagger==2.2.0 coverage==4.5.2 django-nose==1.4.6 jsonnet==0.12.1 +django-heroku +gunicorn diff --git a/vagrant/.python.yml.swp b/vagrant/.python.yml.swp new file mode 100644 index 0000000000..9b9c508ee8 Binary files /dev/null and b/vagrant/.python.yml.swp differ diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile index 87c50e7375..54ed0beb3a 100644 --- a/vagrant/Vagrantfile +++ b/vagrant/Vagrantfile @@ -58,8 +58,8 @@ Vagrant.configure("2") do |config| # end config.vm.provider "virtualbox" do |v| - v.memory = 512 - v.cpus = 1 + v.memory = 1024 + v.cpus = 2 end # View the documentation for the provider you are using for more