Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #590 from ejplatform/develop
Browse files Browse the repository at this point in the history
Release minor 1.1 da Ada Lovelace
  • Loading branch information
ricardopoppi authored Oct 26, 2018
2 parents ca0c46f + 4b76da5 commit 5422bc5
Show file tree
Hide file tree
Showing 83 changed files with 5,503 additions and 1,826 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
django = ">=2"
django = ">=2.1.2"
numpy = "*"
pandas = "*"
django-rest-framework = "*"
Expand Down
424 changes: 227 additions & 197 deletions Pipfile.lock

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ the dev server::

$ inv run

Before runing, make sure you regenerate the PO files and compile. It's necessary to compile sass either:

$ inv i18n

$ inv i18n -c

$ inv sass run

To run on brazilian portuguese:

$ export COUNTRY=brasil

Tests are executed with Pytest_::

$ pytest
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:
command: clean db -m db-assets sass collect gunicorn

postgres:
image: postgres:alpine
image: postgres:10-alpine
restart: always
env_file:
- ./env/deploy.env
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.rocket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
- "mongo:mongo"
build:
context: .
dockerfile: ./Dockerfile-wait
dockerfile: ./Dockerfile.waitmongo
depends_on:
- mongo
volumes:
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
command: sass db -m run

postgres:
image: postgres:alpine
image: postgres:10-alpine
restart: always
ports:
- 5432:5432
Expand Down
63 changes: 63 additions & 0 deletions etc/conf/nginx-vm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Nginx configuration to use in a VM-based deploy
upstream django {
server 127.0.0.1:8000;
}


# configuration of the server
server {
# the port your site will be served on
listen 80;
server_name 35.199.67.151;
charset utf-8;

# max upload size
client_max_body_size 5M; # adjust to taste

# Django media
location /media {
alias /var/www/media; # your Django project's media files - amend as required
}

location /static {
alias /var/www/static; # your Django project's static files - amend as required
}

location / {
# an HTTP header important enough to have its own Wikipedia entry:
# http://en.wikipedia.org/wiki/X-Forwarded-For
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# enable this if and only if you use HTTPS, this helps Rack
# set the proper protocol for doing redirects:
# proxy_set_header X-Forwarded-Proto https;

# pass the Host: header from the client right along so redirects
# can be set properly within the Rack application
proxy_set_header Host $http_host;

# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;

# set "proxy_buffering off" *only* for Rainbows! when doing
# Comet/long-poll stuff. It's also safe to set if you're
# using only serving fast clients with Unicorn + nginx.
# Otherwise you _want_ nginx to buffer responses to slow
# clients, really.
# proxy_buffering off;

# Try to serve static files from nginx, no point in making an
# *application* server like Unicorn/Rainbows! serve static files.
if (!-f $request_filename) {
proxy_pass http://django;
break;
}
}

# Error pages
error_page 500 502 503 504 /500.html;
location = /500.html {
root /var/share/www/static/;
}
}
8 changes: 8 additions & 0 deletions etc/conf/supervisor.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[program:ej-server]
command=inv db -m sass -t cpa collect gunicorn
autostart=true
autorestart=true
user=django
env=DJANGO_DEBUG=false,EJ_THEME=default,EJ_ROCKETCHAT_INTEGRATION=false
stderr_logfile=/var/log/ej-server.err.log
stdout_logfile=/var/log/ej-server.out.log
26 changes: 15 additions & 11 deletions etc/gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ variables:
POSTGRES_USER: ej
POSTGRES_PASSWORD: ej


# -----------------------------------------------------------------------------
# Test: test in different environments by changing the database or running
# different linters.
Expand Down Expand Up @@ -73,13 +72,12 @@ rebuild base docker images:
- docker:dind
before_script:
- *login
- echo "$CI_COMMIT_SHA; $CI_COMMIT_TITLE"
- echo "$CI_COMMIT_SHA; $CI_COMMIT_TITLE; $CI_COMMIT_TAG;"
script:
- "docker build . -f docker/Dockerfile.deploy -t ejplatform/web:$DOCKER_TAG
--cache-from ejplatform/web:$DOCKER_TAG
--build-arg COMMIT_TITLE=\"$CI_COMMIT_TITLE\"
--build-arg COMMIT_HASH=\"$CI_COMMIT_SHA\""
after_script:
- docker push ejplatform/web:$DOCKER_TAG
tags:
- docker
Expand All @@ -92,7 +90,6 @@ rebuild base docker images:
--build-arg THEME=cpa
--build-arg COMMIT_TITLE=\"$CI_COMMIT_TITLE\"
--build-arg COMMIT_HASH=\"$CI_COMMIT_SHA\""
after_script:
- docker push mdhcpa/web:$DOCKER_TAG

publish web develop:
Expand All @@ -106,7 +103,9 @@ publish web staging:
environment: staging
only:
- master

except:
- tags

publish web cpa develop:
extends: .publish web cpa
environment: develop
Expand All @@ -118,39 +117,41 @@ publish web cpa staging:
environment: staging
only:
- master

except:
- tags

publish ejplatform/web tagged:
extends: .publish web generic
environment: production
script:
- "docker build . -f docker/Dockerfile.deploy
-t ejplatform/web:$CI_COMMIT_TAG
-t ejplatform/web:$DOCKER_TAG
-t ejplatform/web:latest
--cache-from ejplatform/web:$CI_COMMIT_TAG
--build-arg COMMIT_TITLE=\"$CI_COMMIT_TITLE\"
--build-arg COMMIT_HASH=\"$CI_COMMIT_SHA\""
after_script:
- docker push ejplatform/web:$CI_COMMIT_TAG
- docker push ejplatform/web:$DOCKER_TAG
- docker push ejplatform/web:latest
only:
- master
- tags


publish mdhcpa/web tagged:
extends: publish ejplatform/web tagged
environment: production
script:
- "docker build . -f docker/Dockerfile.deploy
-t mdhcpa/web:$CI_COMMIT_TAG
-t mdhcpa/web:$DOCKER_TAG
-t mdhcpa/web:latest
--cache-from mdhcpa/web:$CI_COMMIT_TAG
--build-arg THEME=cpa
--build-arg COMMIT_TITLE=\"$CI_COMMIT_TITLE\"
--build-arg COMMIT_HASH=\"$CI_COMMIT_SHA\""
after_script:
- docker push mdhcpa/web:$CI_COMMIT_TAG
- docker push mdhcpa/web:$DOCKER_TAG
- docker push mdhcpa/web:latest
only:
- master
- tags
Expand Down Expand Up @@ -179,7 +180,6 @@ publish mdhcpa/web tagged:
--stack $RANCHER_STACK_CPA
--rancher-key $RANCHER_ACCESS_KEY
--rancher-secret $RANCHER_SECRET_KEY"
after_script:
- "upgrade
--service nginx
--environment $RANCHER_ENVIRONMENT
Expand All @@ -197,6 +197,8 @@ deploy generic dev:
# deploy generic staging:
# extends: .deploy
# environment: staging
# except:
# - tags
# only:
# - master

Expand All @@ -216,6 +218,8 @@ deploy generic dev:
# deploy cpa staging:
# extends: .deploy-cpa
# environment: staging
# except:
# - tags
# only:
# - master

Expand Down
5 changes: 5 additions & 0 deletions etc/requirements/apt-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
python3
python3-pip
supervisor
nginx
sass
7 changes: 7 additions & 0 deletions lib/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"presets": [
"flow",
["env", { "modules": false }]
],
"plugins": ['transform-class-properties']
}
2 changes: 2 additions & 0 deletions lib/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[options]
esproposal.decorators=ignore
17 changes: 17 additions & 0 deletions lib/assets/img/icons/arrow-up-blue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions lib/assets/js/headerScroll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
function headerScroll($elem) {

// Hide Header on on scroll down
var didScroll;
var lastScrollTop = 0;
var delta = 5;
var navbarHeight = $elem.outerHeight();

$(window).scroll(function (event) {
didScroll = true;
});

setInterval(function () {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 250);

function hasScrolled() {
var st = $(this).scrollTop();

// Make sure they scroll more than delta
if (Math.abs(lastScrollTop - st) <= delta) return;

// If they scrolled down and are past the navbar, add class .nav-up.
// This is necessary so you never see what is "behind" the navbar.
if (st > lastScrollTop && st > navbarHeight) {
// Scroll Down
$('header').removeClass('nav-down').addClass('nav-up');
} else {
// Scroll Up
if (st + $(window).height() < $(document).height()) {
$('header').removeClass('nav-up').addClass('nav-down');
}
}

lastScrollTop = st;
}
}
53 changes: 27 additions & 26 deletions lib/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,31 @@ console.log('[EJ] hydrating HTML.');
* Move arrow in the profile page under the active tab.
*/
up.compiler('.Profile-tabs', function ($elem) {
let active = $elem.find('.Profile-tabActive');
let arrow = $('.Profile-arrow');
let x = arrow.offset().left;
let leftMargin = active.offset().left - x + (active.width() / 2) - 28;
arrow.css('visibility', 'inherit');
arrow.css('margin-left', leftMargin);
$elem.ready(function () {
let $active = $elem.find('.Profile-tabActive');
let $arrow = $elem.find('.Profile-arrow');
let arrowOffset = $arrow.offset();
let activeOffset = $active.offset();

if (arrowOffset !== undefined && activeOffset !== undefined) {
let x = arrowOffset.left;
let leftMargin = activeOffset.left - x + ($active.width() / 2) - 28;
$arrow.css('visibility', 'inherit');
$arrow.css('margin-left', leftMargin);
}
}
);
});

up.compiler('.CollapsibleList', function ($elem) {
$elem.toggleClass('CollapsibleList--hidden');
$elem.find('.CollapsibleList-data').hide();

$elem.click(function () {
$elem.find('> h2 > i').css('transition', '500ms');
$elem.toggleClass('CollapsibleList--hidden');
$elem.find('.CollapsibleList-data').toggle(250);
});
});


Expand Down Expand Up @@ -69,33 +88,15 @@ up.compiler('.HowItWorksCard', function ($card) {
});


// PROFILE
// -----------------------------------------------------------------------------
// Profile comments
up.compiler('.Profile-comments', function ($profile_comments) {
$profile_comments.find('h2').click(function ($out) {
$profile_comments.find('h2').toggleClass('expanded');
$profile_comments.find('.comments').toggle();
})
});


// Profile conversations
up.compiler('.Profile-conversations', function ($profile_comments) {
$profile_comments.find('h2').click(function ($out) {
$profile_comments.find('h2').toggleClass('expanded');
$profile_comments.find('.conversations').toggle();
})
});

// Profile edit
up.compiler('#id_image', function($fileInput){
up.compiler('#id_image', function ($fileInput) {
$fileInput.change(function () {
let $displayedFileName = $('#image-filename');
let filename = $fileInput.prop('files')[0].name;
$displayedFileName.text(filename);
})
});


console.log('[EJ] finished.');

2 changes: 2 additions & 0 deletions lib/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// @flow
import './unpoly-compilers.js';
Loading

0 comments on commit 5422bc5

Please sign in to comment.