- Notifications
You must be signed in to change notification settings - Fork4
Plataforma de disponibilização de programas eleitorais para eleições
License
Politica-Para-Todos/ppt-website
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Platform that allows you to comment and annotate political manifestos.
comentAR comes with a docker compose configuration files that boots the necessary PostgreSQL dependency for you, as well as building a container with all the dependencies such as the required gems and the yarn packages.
After booting the environment withdocker-compose up -d
a container nameddev
is waiting to run everything necessary.
# Shell into the dev containerdocker-composeexec dev bash# Run database migrationsbundleexec rake db:createbundleexec rake db:migrate# Populate databasebundleexec rake data:populate# Boot up a rails server on port 3000bundleexec rails server
If you have a webpacker error try to run this commandbundle exec rails webpacker:install -s
.
Others commands you can run inside the docker container:
# Shell into the dev containerdocker-composeexec dev bash# Install missing dependenciesbundle install# Boot up a rails consolebundleexec rails console# Create yarn.lockbundleexec rails webpacker:install -s
The repository directory is mounted as a volume inside the container so changes you do are reflected inside.
The following instructions are for the mac OS, so translate to your own environment if need be.
# Clone the repositorygit clone git@github.com:Politica-Para-Todos/comentARcd comentAR# Ruby 2.7# Just use rbenv (https://github.com/rbenv/rbenv) or similar to install itrbenvlocal 2.7.1# PostgreSQLbrew install postgresqlbrew services start postgresql# Yarnbrew install yarn# Install all ruby dependenciesgem install bundlerbundle install# Install all yarn dependenciesyarn install# Run database migrationsbundleexec rake db:createbundleexec rake db:migrate# Boot up a rails consolebundleexec rails console# Boot up a rails server on port 3000bundleexec rails server# And so on...
There is an admin console available athttp://localhost:3000/admin to aid in the management of data and/or the application.
The application implements the following data model.
The entity that represents a political party. Has many Manifestos.
This is the entity that represents a political manifesto. Just holds a title attribute. It is composed by Manifesto Sections.
As manifestos are quite large, they are usually divided into sections. Each section may have sub sections ad nauseam. A section has a content attribute that generally represents its title, and a markdown document with all its textual content.
The markdown document in each section is automatically converted into Manifesto Items when the section is created or updated.
A paragraph, header or list item in a manifesto. Each one is individually commentable and annotateable. Each has a numeric unique private key, as well as a hash that identifies them uniquely in the system.
When its Manifesto Section is updated using a slightly different document, only the items that are different are replaced, the others are just updated in order not to mitigate the loss of comments or annotations.
A regular comment by a regular user. Not to be confused with the current Comments tab on the admin console, which is a feature of the library that implements it.
A user that signs up in the platform. May have email credentials or authenticate via oauth from twitter, facebook or google.
A user that manages the platform.This is not a User, nor has anything to do with the User entity.
There is a handy rake task that populates the database from a JSON file with a given format. You can run it by evoking:
bundleexec rake data:populate
By default it will use the file available atdb/seeds.json
as input, but you can point it to any URL. For example, if you want it to populate the database from a JSON you uploaded to GitHub Gists, just give it its URL. Make sure to point to theraw link.
bundleexec rake'data:populate[https://gist.githubusercontent.com/punnie/a119b9138ceed7a1d63a22a5fb3c0bab/raw/e9f8735950423a690f190789023e558c71c045a5/candidates.json]'
Observe the single quotes around the rake task specification and the URL. You must use it or else your shell will complain.
If you want to run it in the context of an environment, such as staging or production, you must haveheroku
tools installed and configured, and run it as such:
heroku run bundleexec rake data:populate --app politica-para-todos
If the database already has data do:
Go to Heroku and
Resources -> Heroku Postgresql -> Settings -> Reset Database
Run:
heroku run bundleexec rake db:migrate --app politica-para-todosheroku run bundleexec rake data:populate --app politica-para-todos
The rake task will match existing Parties by theiracronym, which means that if there is an acronym change, a new Party will be created.
Likewise, it will match existing Candidates by their Party ID, district and position. The name might be a good candidate, but with so many corrections at boot I wasn't sure it would be a good idea.
About
Plataforma de disponibilização de programas eleitorais para eleições
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors12
Uh oh!
There was an error while loading.Please reload this page.