...
 
Commits (26)
......@@ -18,3 +18,9 @@
# Ignore local gems from bundler
vendor/bundle/*
# Ignore current schema
db/schema.rb
# Ignore Gemfile lock
Gemfile.lock
......@@ -32,6 +32,9 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use Fast CSV to parse CSV files
gem 'fastcsv'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
......@@ -45,3 +48,4 @@ group :development do
gem 'spring'
end
gem 'devise'
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
// Place all the styles related to the Registrations controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}
p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}
pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}
a {
color: #000;
&:visited {
color: #666;
}
&:hover {
color: #fff;
background-color: #000;
}
}
div {
&.field, &.actions {
margin-bottom: 10px;
}
}
#notice {
color: green;
}
.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}
#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}
ul li {
font-size: 12px;
list-style: square;
}
}
// Place all the styles related to the SchoolClasses controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
......@@ -2,4 +2,10 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << :full_name
devise_parameter_sanitizer.for(:sign_up) << :cpf
end
end
class SchoolClassesController < ApplicationController
before_action :authenticate_user!, :set_school_class, only: [:show, :edit, :update, :destroy, :new]
# GET /school_classes
# GET /school_classes.json
def index
if params[:search]
# filter relevant parameters
@search_params = school_class_params.symbolize_keys
@result = SchoolClass.search(@search_params)
end
end
# GET /school_classes/1
# GET /school_classes/1.json
def show
end
# GET /school_classes/new
def new
@school_class = SchoolClass.new
end
# GET /school_classes/1/edit
def edit
end
# POST /school_classes
# POST /school_classes.json
def create
@school_class = SchoolClass.new(school_class_params)
respond_to do |format|
if @school_class.save
format.html { redirect_to @school_class, notice: 'School class was successfully created.' }
format.json { render :show, status: :created, location: @school_class }
else
format.html { render :new }
format.json { render json: @school_class.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /school_classes/1
# PATCH/PUT /school_classes/1.json
def update
respond_to do |format|
if @school_class.update(school_class_params)
format.html { redirect_to @school_class, notice: 'School class was successfully updated.' }
format.json { render :show, status: :ok, location: @school_class }
else
format.html { render :edit }
format.json { render json: @school_class.errors, status: :unprocessable_entity }
end
end
end
# DELETE /school_classes/1
# DELETE /school_classes/1.json
def destroy
@school_class.destroy
respond_to do |format|
format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_school_class
@school_class = SchoolClass.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def school_class_params
params.require(:school_class)
.permit(:search, :state_id, :city_id, :region_id, :census_year_start, :census_year_end,
:administrative_level_id, :variable, :location_id, :school_class_type_id)
.keep_if { |k,v| !v.nil? and !v.empty? }
end
end
module RegistrationsHelper
end
module SchoolClassesHelper
end
class AdministrativeLevel < ActiveRecord::Base
# associations
has_many :school_classes
# validations
validates_presence_of :name
end
class City < ActiveRecord::Base
# associations
has_many :school_classes
# validations
validates_presence_of :city_code,
:name
validates_uniqueness_of :city_code
def self.ordered
self.order("name ASC")
end
end
class Location < ActiveRecord::Base
# associations
has_many :school_classes
# validations
validates_presence_of :name
end
class Region < ActiveRecord::Base
# associations
has_many :cities
# validations
validates_presence_of :name
def self.ordered
self.order("name ASC")
end
end
class SchoolClass < ActiveRecord::Base
# associations
belongs_to :administrative_level
belongs_to :school_class_type
belongs_to :city
belongs_to :state
belongs_to :location
# validations
validates_presence_of :census_year,
:num_enrollments,
:administrative_level,
:city,
:state,
:location,
:school_class_type
validates_numericality_of :census_year,
only_integer: true,
greater_than: 0
def self.start_year
minimum(:census_year)
end
def self.end_year
maximum(:census_year)
end
def self.search(filtered_params)
params = filtered_params
school_classes = self
if filtered_params.size > 1
school_classes = school_classes.where(state_id: params[:state_id]) if params[:state_id]
school_classes = school_classes.where(city_id: params[:city_id]) if params[:city_id]
school_classes = school_classes.where(school_type_id: params[:school_type_id]) if params[:school_type_id]
if params[:census_year_start]
school_classes = school_classes.where([ "census_year >= :census_year",
{ census_year: params[:census_year_start] } ])
end
if params[:census_year_end]
school_classes = school_classes.where([ "census_year <= :census_year",
{ census_year: params[:census_year_end] } ])
end
else
school_classes = school_classes.all
end
case params[:variable]
when "enrollments"
school_classes = school_classes.sum(:num_enrollments)
when "teachers"
school_classes = school_classes.sum(:num_enrollments)
when "schools"
school_classes = school_classes.sum(:num_enrollments)
end
end
end
class SchoolClassType < ActiveRecord::Base
# associations
has_many :school_classes
# validations
validates_presence_of :code,
:description
end
class State < ActiveRecord::Base
# associations
has_many :school_classes
belongs_to :region
# validations
validates_presence_of :name,
:region
def self.ordered
self.order("name ASC")
end
end
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
validates_length_of :full_name, minimum: 2, :too_short => "deve ter ao menos duas palavras", tokenizer: ->(full_name) { full_name.scan(/\w+/) }
validates :cpf, numericality: {only_integer: true}
validates :cpf, length: {is: 11}
end
<%= form_for(@school_class) do |f| %>
<% if @school_class.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@school_class.errors.count, "error") %> prohibited this school_class from being saved:</h2>
<ul>
<% @school_class.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :census_year %><br>
<%= f.number_field :census_year %>
</div>
<div class="field">
<%= f.label :num_enrollments %><br>
<%= f.number_field :num_enrollments %>
</div>
<div class="field">
<%= f.label :location_id %><br>
<%= f.number_field :location_id %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
<h1>Editing School Class</h1>
<%= render 'form' %>
<%= link_to 'Show', @school_class %> |
<%= link_to 'Back', school_classes_path %>
<p id="notice"><%= notice %></p>
<%= @search_params unless @search_params.nil? %>
<h1><%= SchoolClass.model_name.human.pluralize %></h1>
<%= form_tag(school_classes_path, :method => "get", id: "search-form") do %>
<fieldset>
<legend><%= t :location_filter %></legend>
<p</p>
<div class="field">
<%= State.model_name.human %>:<br />
<%= select :school_class, :state_id, State.all.ordered.collect { |p| [ p.name, p.id ] }, prompt: "Nenhum estado selecionado" %>
</div>
<div class="field">
<%= City.model_name.human %>:<br />
<%= select :school_class, :city_id, City.all.ordered.collect { |p| [ p.name, p.id ] }, prompt: "Nenhuma cidade selecionada" %>
</div>
<div class="field">
<%= Region.model_name.human %>:<br />
<%= select :school_class, :region_id, Region.all.ordered.collect { |p| [ p.name, p.id ] }, prompt: "Nenhuma região selecionada" %>
</div>
<div class="field">
<%= AdministrativeLevel.model_name.human %>:<br />
<%= select :school_class, :administrative_level_id, AdministrativeLevel.all.collect { |p| [ p.name, p.id ] }, prompt: "Nenhuma dependência administrativa selecionada" %>
</div>
</fieldset>
<fieldset>
<legend><%= t :time_filter %></legend>
Selecione o intervalo de tempo:<br />
<div class="field">
Início: <br />
<%= select :school_class, :census_year_start, Range.new(SchoolClass.start_year, SchoolClass.end_year).to_a, default: SchoolClass.end_year %>
</div>
<div class="field">
Fim: <br />
<%= select :school_class, :census_year_end, Range.new(SchoolClass.start_year, SchoolClass.end_year).to_a, default: SchoolClass.end_year %>
</div>
</fieldset>
<fieldset>
<legend>Variáveis</legend>
<div class="field">
Selecione uma variável: <br />
<%= select :school_class, :variable, options_for_select([["Número de Matrículas", "enrollments"], ["Nùmero de Escolas", "schools"], ["Número de Professores", "teachers"]], :selected => params[:variable]) %>
</div>
</fieldset>
<fieldset>
<legend>Filtros Adicionais</legend>
<div class="field">
<%= Location.model_name.human %>:<br />
<%= select :school_class, :location_id, Location.all.collect { |p| [ p.name, p.id ] }, prompt: "Nenhuma localização selecionada" %>
</div>
<div class="field">
<%= SchoolClassType.model_name.human %>: <br />
<%= select :school_class, :school_class_type_id, SchoolClassType.all.collect { |p| [ p.description, p.id ] },
:default => SchoolClassType.find_by_description("Não se aplica").id %>
</div>
</fieldset>
<fieldset>
<legend>Opções</legend>
<%= submit_tag t(:search), name: "search" %>
</fieldset>
<% end %>
<% unless @result.nil? %>
<fieldset>
<legend>Resultado</legend>
Número de <%= (@search_params[:variable] == "enrollments") ? "matrículas" : "outros" %>: <%= @result %><br>
<br />
Você também pode baixar o conjunto de dados nos seguintes formatos: <br>
<fieldset>
<legend>Parametros da Consulta</legend>
</fieldset>
</fieldset>
<% end %>
json.array!(@school_classes) do |school_class|
json.extract! school_class, :id, :census_year, :class_code, :num_enrollments, :location_id
json.url school_class_url(school_class, format: :json)
end
<h1>New School Class</h1>
<%= render 'form' %>
<%= link_to 'Back', school_classes_path %>
<p id="notice"><%= notice %></p>
<p>
<strong>Census year:</strong>
<%= @school_class.census_year %>
</p>
<p>
<strong>Num enrollments:</strong>
<%= @school_class.num_enrollments %>
</p>
<p>
<strong>Location:</strong>
<%= @school_class.location_id %>
</p>
<%= link_to 'Edit', edit_school_class_path(@school_class) %> |
<%= link_to 'Back', school_classes_path %>
json.extract! @school_class, :id, :census_year, :class_code, :num_enrollments, :location_id, :created_at, :updated_at
<h2>Resend confirmation instructions</h2>
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
<%= devise_error_messages! %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
</div>
<div class="actions">
<%= f.submit "Resend confirmation instructions" %>
</div>
<% end %>
<%= render "users/shared/links" %>
<p>Welcome <%= @email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
<p>Hello <%= @resource.email %>!</p>
<p>We're contacting you to notify you that your password has been changed.</p>
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
<h2>Change your password</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %>
<%= f.hidden_field :reset_password_token %>
<div class="field">
<%= f.label :password, "New password" %><br />
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
<% end %>
<%= f.password_field :password, autofocus: true, autocomplete: "off" %>
</div>
<div class="field">
<%= f.label :password_confirmation, "Confirm new password" %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>
<div class="actions">
<%= f.submit "Change my password" %>
</div>
<% end %>
<%= render "users/shared/links" %>
<h2>Forgot your password?</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= devise_error_messages! %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
</div>
<div class="actions">
<%= f.submit "Send me reset password instructions" %>
</div>
<% end %>
<%= render "users/shared/links" %>
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %>
<div class="field">
<%= f.label :full_name %><br />
<%= f.text_field :full_name, autofocus: true %>
</div>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
</div>
<div class="field">
<%= f.label :cpf %><br />
<%= f.text_field :cpf%>
</div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
<div class="field">
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password, autocomplete: "off" %>
</div>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>
<div class="field">
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
<%= f.password_field :current_password, autocomplete: "off" %>
</div>
<div class="actions">
<%= f.submit "Update" %>
</div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
<%= link_to "Back", :back %>
<h2>Sign up</h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div class="field">
<%= f.label :full_name %><br />
<%= f.text_field :full_name, autofocus: true %>
</div>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email%>
</div>
<div class="field">
<%= f.label :cpf %><br />
<%= f.text_field :cpf%>
</div>
<div class="field">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %><br />
<%= f.password_field :password, autocomplete: "off" %>
</div>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>
<div class="actions">
<%= f.submit "Sign up" %>
</div>
<% end %>
<%= render "users/shared/links" %>
<h2>Log in</h2>
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
</div>
<div class="field">
<%= f.label :password %><br />
<%= f.password_field :password, autocomplete: "off" %>
</div>
<% if devise_mapping.rememberable? -%>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<% end -%>
<div class="actions">
<%= f.submit "Log in" %>
</div>
<% end %>
<%= render "users/shared/links" %>
<%- if controller_name != 'sessions' %>
<%= link_to "Log in", new_session_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
<% end -%>
<% end -%>
<h2>Resend unlock instructions</h2>
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
<%= devise_error_messages! %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
</div>
<div class="actions">
<%= f.submit "Resend unlock instructions" %>
</div>
<% end %>
<%= render "users/shared/links" %>
......@@ -14,11 +14,11 @@ module Simcaq
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
config.time_zone = 'America/Sao_Paulo'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :pt_BR
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
......
This diff is collapsed.
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
en:
devise:
confirmations:
confirmed: "Your email address has been successfully confirmed."
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
failure:
already_authenticated: "You are already signed in."
inactive: "Your account is not activated yet."
invalid: "Invalid %{authentication_keys} or password."
locked: "Your account is locked."
last_attempt: "You have one more attempt before your account is locked."
not_found_in_database: "Invalid %{authentication_keys} or password."
timeout: "Your session expired. Please sign in again to continue."
unauthenticated: "You need to sign in or sign up before continuing."
unconfirmed: "You have to confirm your email address before continuing."
mailer:
confirmation_instructions:
subject: "Confirmation instructions"
reset_password_instructions:
subject: "Reset password instructions"
unlock_instructions:
subject: "Unlock instructions"
password_change:
subject: "Password Changed"
omniauth_callbacks:
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
success: "Successfully authenticated from %{kind} account."
passwords:
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
updated: "Your password has been changed successfully. You are now signed in."
updated_not_active: "Your password has been changed successfully."
registrations:
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
signed_up: "Welcome! You have signed up successfully."
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
updated: "Your account has been updated successfully."
sessions:
signed_in: "Signed in successfully."
signed_out: "Signed out successfully."
already_signed_out: "Signed out successfully."
unlocks:
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
errors:
messages:
already_confirmed: "was already confirmed, please try signing in"
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
expired: "has expired, please request a new one"
not_found: "not found"
not_locked: "was not locked"
not_saved:
one: "1 error prohibited this %{resource} from being saved:"
other: "%{count} errors prohibited this %{resource} from being saved:"
---
pt_BR:
activerecord:
models:
school_class: "Turma"
school_class_type: "Tipo de Atendimento/Turma"
location: "Localização"
state: "Estado"
city: "Cidade"
region: "Região"
administrative_level: "Dependência Administrativa"
attributes:
city:
name: "Nome"
school_class:
census_year: "Ano do Censo"
city_id: "Nome da cidade"
location_id: "Localização"
num_enrollments: "Número de Matriculas"
location:
name: "Nome do Local"
errors:
messages:
record_invalid: 'A validação falhou: %{errors}'
restrict_dependent_destroy:
has_one: Não é possível excluir o registro pois existe um %{record} dependente
has_many: Não é possível excluir o registro pois existem %{record} dependentes
date:
abbr_day_names:
- Dom
- Seg
- Ter
- Qua
- Qui
- Sex
- Sáb
abbr_month_names:
-
- Jan
- Fev
- Mar
- Abr
- Mai
- Jun
- Jul
- Ago
- Set
- Out
- Nov
- Dez
day_names:
- Domingo
- Segunda-feira
- Terça-feira
- Quarta-feira
- Quinta-feira
- Sexta-feira
- Sábado
formats:
default: "%d/%m/%Y"
long: "%d de %B de %Y"
short: "%d de %B"
month_names:
-
- Janeiro
- Fevereiro
- Março
- Abril
- Maio
- Junho
- Julho
- Agosto
- Setembro
- Outubro
- Novembro
- Dezembro
order:
- :day
- :month
- :year
datetime:
distance_in_words:
about_x_hours:
one: aproximadamente 1 hora
other: aproximadamente %{count} horas
about_x_months:
one: aproximadamente 1 mês
other: aproximadamente %{count} meses
about_x_years:
one: aproximadamente 1 ano
other: aproximadamente %{count} anos
almost_x_years:
one: quase 1 ano
other: quase %{count} anos
half_a_minute: meio minuto
less_than_x_minutes:
one: menos de um minuto
other: menos de %{count} minutos
less_than_x_seconds:
one: menos de 1 segundo
other: menos de %{count} segundos
over_x_years:
one: mais de 1 ano
other: mais de %{count} anos
x_days:
one: 1 dia
other: "%{count} dias"
x_minutes:
one: 1 minuto
other: "%{count} minutos"
x_months:
one: 1 mês
other: "%{count} meses"
x_seconds:
one: 1 segundo
other: "%{count} segundos"
prompts:
day: Dia
hour: Hora
minute: Minuto
month: Mês
second: Segundo
year: Ano
errors:
format: "%{attribute} %{message}"
messages:
accepted: deve ser aceito
blank: não pode ficar em branco
present: deve ficar em branco
confirmation: não é igual a %{attribute}
empty: não pode ficar vazio
equal_to: deve ser igual a %{count}
even: deve ser par
exclusion: não está disponível
greater_than: deve ser maior que %{count}
greater_than_or_equal_to: deve ser maior ou igual a %{count}
inclusion: não está incluído na lista
invalid: não é válido
less_than: deve ser menor que %{count}
less_than_or_equal_to: deve ser menor ou igual a %{count}
model_invalid: 'A validação falhou: %{errors}'
not_a_number: não é um número
not_an_integer: não é um número inteiro
odd: deve ser ímpar
required: deve existir
taken: já está em uso
too_long:
one: 'é muito longo (máximo: 1 caracter)'
other: 'é muito longo (máximo: %{count} caracteres)'
too_short:
one: 'é muito curto (mínimo: 1 caracter)'
other: 'é muito curto (mínimo: %{count} caracteres)'
wrong_length:
one: não possui o tamanho esperado (1 caracter)
other: não possui o tamanho esperado (%{count} caracteres)
other_than: deve ser diferente de %{count}
template:
body: 'Por favor, verifique o(s) seguinte(s) campo(s):'
header:
one: 'Não foi possível gravar %{model}: 1 erro'
other: 'Não foi possível gravar %{model}: %{count} erros'
helpers:
select:
prompt: Por favor selecione
submit:
create: Criar %{model}
submit: Salvar %{model}
update: Atualizar %{model}
number:
currency:
format:
delimiter: "."
format: "%u %n"
precision: 2
separator: ","
significant: false
strip_insignificant_zeros: false
unit: R$
format:
delimiter: "."
precision: 3
separator: ","
significant: false
strip_insignificant_zeros: false
human:
decimal_units:
format: "%n %u"
units:
billion:
one: bilhão
other: bilhões
million:
one: milhão
other: milhões
quadrillion:
one: quatrilhão
other: quatrilhões
thousand: mil
trillion:
one: trilhão
other: trilhões
unit: ''
format:
delimiter: "."
precision: 2
significant: true
strip_insignificant_zeros: true
storage_units:
format: "%n %u"
units:
byte:
one: Byte
other: Bytes
gb: GB
kb: KB
mb: MB
tb: TB
percentage:
format:
delimiter: "."
format: "%n%"
precision:
format:
delimiter: "."
support:
array:
last_word_connector: " e "
two_words_connector: " e "
words_connector: ", "
time:
am: ''
formats:
default: "%a, %d de %B de %Y, %H:%M:%S %z"
long: "%d de %B de %Y, %H:%M"
short: "%d de %B, %H:%M"
pm: ''
search: "Filtrar"
new: "Adicionar"
show: "Mostrar"
edit: "Editar"
delete: "Apagar"
back: "Voltar"
delete_confirm: "Tem certeza que deseja apagar?"
location_filter: "Recorte Espacial"
time_filter: "Recorte Temporal"
Rails.application.routes.draw do
devise_for :users
resources :school_classes
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
root 'school_classes#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
......@@ -38,9 +40,7 @@ Rails.application.routes.draw do
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# ende with concerns:
# concern :toggleable do
# post 'toggle'
# end
......
class CreateStates < ActiveRecord::Migration
def change
create_table :states do |t|
t.string :name
t.belongs_to :region, index: true
t.timestamps null: false
end
end
end
class CreateCities < ActiveRecord::Migration
def change
create_table :cities do |t|
t.string :city_code
t.string :name
t.timestamps null: false
end
end
end
class CreateRegions < ActiveRecord::Migration
def change
create_table :regions do |t|
t.string :name
t.timestamps null: false
end
end
end
class CreateAdministrativeLevels < ActiveRecord::Migration
def change
create_table :administrative_levels do |t|
t.string :name
t.timestamps null: false
end
end
end
class CreateLocations < ActiveRecord::Migration
def change
create_table :locations do |t|
t.string :name
t.timestamps null: false
end
end
end
class CreateSchoolClasses < ActiveRecord::Migration
def change
create_table :school_classes do |t|
t.integer :census_year
t.integer :num_enrollments
t.belongs_to :administrative_level, index: true
t.belongs_to :school_class_type, index: true
t.belongs_to :city, index: true
t.belongs_to :state, index: true
t.belongs_to :location, index: true
t.timestamps null: false
end
end
end
class CreateSchoolClassTypes < ActiveRecord::Migration
def change
create_table :school_class_types do |t|
t.integer :code
t.string :description
t.timestamps null: false
end
end
end
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps null: false
end
add_index :users, :email, unique: true
add_index :users, :reset_password_token, unique: true
# add_index :users, :confirmation_token, unique: true
# add_index :users, :unlock_token, unique: true
end
end
class AddUserCustomFields < ActiveRecord::Migration
def change
add_column :users, :full_name, :string
add_column :users, :cpf, :string
add_column :users, :institution_name, :string
end
end
id;name
1;Federal
2;Estadual
3;Municipal
4;Privada
This diff is collapsed.
id;name
1;Urbana
2;Rural
id;name
1;Norte
2;Nordeste
3;Sudeste
4;Sul
5;Centro-Oeste
codigo;descricao
0;Não se aplica
1;Classe hospitalar
2;Unidade de atendimento socioeducativo
3;Unidade prisional
4;Atendimento complementar
5;Atendimento Educacional Especializado (AEE)
id;nome;fk_regiao_id
11;Rondônia;1
12;Acre;1
13;Amazonas;1
14;Roraima;1
15;Pará;1
16;Amapá;1
17;Tocantins;1
21;Maranhão;2
22;Piauí;2
23;Ceará;2
24;Rio Grande do Norte;2
25;Paraíba;2
26;Pernambuco;2
27;Alagoas;2
28;Sergipe;2
29;Bahia;2
31;Minas Gerais;3
32;Espírito Santo;3
33;Rio de Janeiro;3
35;São Paulo;3
41;Paraná;4
42;Santa Catarina;4
43;Rio Grande do Sul;4
50;Mato Grosso do Sul;5
51;Mato Grosso;5
52;Goiás;5
53;Distrito Federal;5
This diff is collapsed.
require 'test_helper'
class RegistrationsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class SchoolClassesControllerTest < ActionController::TestCase
setup do
@school_class = school_classes(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:school_classes)
end
test "should get new" do
get :new
assert_response :success
end
test "should create school_class" do
assert_difference('SchoolClass.count') do
post :create, school_class: { census_year: @school_class.census_year, class_code: @school_class.class_code, location_id: @school_class.location_id, num_enrollments: @school_class.num_enrollments }
end
assert_redirected_to school_class_path(assigns(:school_class))
end
test "should show school_class" do
get :show, id: @school_class
assert_response :success
end
test "should get edit" do
get :edit, id: @school_class
assert_response :success
end
test "should update school_class" do
patch :update, id: @school_class, school_class: { census_year: @school_class.census_year, class_code: @school_class.class_code, location_id: @school_class.location_id, num_enrollments: @school_class.num_enrollments }
assert_redirected_to school_class_path(assigns(:school_class))
end
test "should destroy school_class" do
assert_difference('SchoolClass.count', -1) do
delete :destroy, id: @school_class
end
assert_redirected_to school_classes_path
end
end
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html