fixes conflicts
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -51,6 +51,7 @@ group :development, :test do
|
||||
gem 'launchy'
|
||||
gem 'quiet_assets'
|
||||
gem 'letter_opener_web', '~> 1.2.0'
|
||||
gem 'i18n-tasks'
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
||||
18
Gemfile.lock
18
Gemfile.lock
@@ -94,6 +94,10 @@ GEM
|
||||
docile (1.1.5)
|
||||
domain_name (0.5.24)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
easy_translate (0.5.0)
|
||||
json
|
||||
thread
|
||||
thread_safe
|
||||
erubis (2.7.0)
|
||||
execjs (2.5.2)
|
||||
factory_girl (4.5.0)
|
||||
@@ -106,9 +110,18 @@ GEM
|
||||
sass (>= 3.3.0, < 3.5)
|
||||
globalid (0.3.5)
|
||||
activesupport (>= 4.1.0)
|
||||
highline (1.7.3)
|
||||
http-cookie (1.0.2)
|
||||
domain_name (~> 0.5)
|
||||
i18n (0.7.0)
|
||||
i18n-tasks (0.8.6)
|
||||
activesupport
|
||||
easy_translate (>= 0.5.0)
|
||||
erubis
|
||||
highline
|
||||
i18n
|
||||
term-ansicolor
|
||||
terminal-table (>= 1.5.1)
|
||||
jbuilder (2.3.1)
|
||||
activesupport (>= 3.0.0, < 5)
|
||||
multi_json (~> 1.2)
|
||||
@@ -221,7 +234,9 @@ GEM
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
term-ansicolor (1.3.2)
|
||||
tins (~> 1.0)
|
||||
terminal-table (1.5.2)
|
||||
thor (0.19.1)
|
||||
thread (0.2.2)
|
||||
thread_safe (0.3.5)
|
||||
tilt (1.4.1)
|
||||
tins (1.5.4)
|
||||
@@ -264,6 +279,7 @@ DEPENDENCIES
|
||||
devise
|
||||
factory_girl_rails
|
||||
foundation-rails
|
||||
i18n-tasks
|
||||
jbuilder (~> 2.0)
|
||||
jquery-rails
|
||||
launchy
|
||||
@@ -283,4 +299,4 @@ DEPENDENCIES
|
||||
web-console (~> 2.0)
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.5
|
||||
1.10.6
|
||||
|
||||
BIN
app/assets/images/auth_bg.jpg
Normal file
BIN
app/assets/images/auth_bg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
BIN
app/assets/images/logo_madrid_white.png
Normal file
BIN
app/assets/images/logo_madrid_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
@@ -673,14 +673,45 @@ header {
|
||||
// 08.1. Login
|
||||
// - - - - - - - - - - - -
|
||||
|
||||
.auth-page {
|
||||
background: url('auth_bg.jpg');
|
||||
margin-top: $line-height;
|
||||
|
||||
@media (min-width: 480px) {
|
||||
margin-top: $line-height*2;
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
||||
a {
|
||||
color: white;
|
||||
font-family: 'Lato';
|
||||
font-size: rem-calc(20);
|
||||
font-weight: lighter;
|
||||
line-height: $line-height*4;
|
||||
padding-left: rem-calc(6);
|
||||
|
||||
span {
|
||||
font-size: rem-calc(16);
|
||||
font-weight: lighter;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
@media (min-width: 480px) {
|
||||
font-size: rem-calc(30);
|
||||
span {
|
||||
font-size: rem-calc(20);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.auth {
|
||||
background: $background;
|
||||
box-shadow: 0px -4px 5px $background;
|
||||
min-height: $line-height*20;
|
||||
|
||||
.panel {
|
||||
background: white;
|
||||
margin-top: $line-height*2;
|
||||
|
||||
h1 {
|
||||
font-size: rem-calc(30);
|
||||
@@ -725,7 +756,6 @@ form {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 10. Alerts
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -755,5 +785,3 @@ form {
|
||||
color: $alert-color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class AccountController < ApplicationController
|
||||
end
|
||||
|
||||
def account_params
|
||||
params.require(:account).permit(:first_name, :last_name)
|
||||
params.require(:account).permit(:first_name, :last_name, :nickname, :use_nickname)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -5,6 +5,7 @@ class ApplicationController < ActionController::Base
|
||||
respond_to :html
|
||||
|
||||
before_action :set_locale
|
||||
layout :set_layout
|
||||
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
@@ -22,8 +23,17 @@ class ApplicationController < ActionController::Base
|
||||
I18n.locale = session[:locale]
|
||||
end
|
||||
|
||||
def set_layout
|
||||
if devise_controller?
|
||||
"devise"
|
||||
else
|
||||
"application"
|
||||
end
|
||||
end
|
||||
|
||||
def verify_captcha?(resource)
|
||||
return true unless recaptcha_keys?
|
||||
verify_recaptcha(model: resource)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ class RegistrationsController < Devise::RegistrationsController
|
||||
private
|
||||
|
||||
def sign_up_params
|
||||
params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)
|
||||
params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :use_nickname, :nickname)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,8 +4,12 @@ class User < ActiveRecord::Base
|
||||
|
||||
acts_as_voter
|
||||
|
||||
validates :first_name, presence: true, unless: :use_nickname?
|
||||
validates :last_name, presence: true, unless: :use_nickname?
|
||||
validates :nickname, presence: true, if: :use_nickname?
|
||||
|
||||
def name
|
||||
"#{first_name} #{last_name}"
|
||||
use_nickname? ? nickname : "#{first_name} #{last_name}"
|
||||
end
|
||||
|
||||
def votes_on_debates(debates_ids = [])
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
<h1><%= t("account.show.title") %></h1>
|
||||
|
||||
<%= form_for @account, as: :account, url: account_path do |f| %>
|
||||
|
||||
<%= f.label :first_name, t("account.show.first_name_label") %>
|
||||
<%= f.text_field :first_name %>
|
||||
<%= f.label :last_name, t("account.show.last_name_label") %>
|
||||
<%= f.text_field :last_name %>
|
||||
|
||||
<div>
|
||||
<%= f.check_box :use_nickname %>
|
||||
<%= t("account.show.use_nickname_label") %>
|
||||
</div>
|
||||
|
||||
<%= f.label :nickname, t("account.show.nickname_label") %>
|
||||
<%= f.text_field :nickname %>
|
||||
|
||||
<%= f.submit t("account.show.save_changes_submit"), class: "button radius" %>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
<h2><%= t("devise_views.confirmations.title") %></h2>
|
||||
<div class="auth row">
|
||||
<div class="small-12 medium-8 large-5 column small-centered">
|
||||
<div class="panel">
|
||||
<h1 class="text-center"><%= t("devise_views.confirmations.title") %></h1>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= 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, t("devise_views.confirmations.email_label") %><br />
|
||||
<%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
||||
<div class="row">
|
||||
<div class="small-12 columns">
|
||||
<%= f.label :email, t("devise_views.confirmations.email_label") %>
|
||||
<%= f.email_field :email, autofocus: true, placeholder: t("devise_views.confirmations.email_label"), value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 columns">
|
||||
<%= f.submit(t("devise_views.confirmations.submit"), class: "button radius expand") %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit(t("devise_views.confirmations.submit"), class: "button radius") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
</div>
|
||||
@@ -1,28 +1,22 @@
|
||||
<div class="row-full auth">
|
||||
<div class="row">
|
||||
<div class="small-12 medium-8 large-8 column small-centered">
|
||||
<div class="panel">
|
||||
<h1 class="text-center"><%= t("devise_views.passwords.new.title") %></h1>
|
||||
<div class="row auth">
|
||||
<div class="small-12 medium-8 large-5 column small-centered">
|
||||
<div class="panel">
|
||||
<h1 class="text-center"><%= t("devise_views.passwords.new.title") %></h1>
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= f.label :email, t("devise_views.passwords.new.email_label") %>
|
||||
<%= f.email_field :email, autofocus: true, placeholder: t("devise_views.passwords.new.email_label") %>
|
||||
</div>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<div class="small-12 column text-center">
|
||||
<%= f.submit t("devise_views.passwords.new.send_submit"), class: "button radius expand" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= f.label :email, t("devise_views.passwords.new.email_label") %>
|
||||
<%= f.email_field :email, autofocus: true, placeholder: t("devise_views.passwords.new.email_label") %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column text-center">
|
||||
<%= f.submit t("devise_views.passwords.new.send_submit"), class: "button radius" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= render "devise/shared/links" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -21,6 +21,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 columns">
|
||||
<%= f.check_box :use_nickname %>
|
||||
<%= t("devise_views.registrations.new.use_nickname_label") %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 columns">
|
||||
<%= f.label :nickname, t("devise_views.registrations.new.nickname_label") %>
|
||||
<%= f.text_field :nickname, placeholder: t("devise_views.registrations.new.nickname_label") %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 columns">
|
||||
<%= f.label :email, t("devise_views.registrations.new.email_label") %>
|
||||
@@ -58,4 +72,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,42 +1,34 @@
|
||||
<div class="row-full auth">
|
||||
<div class="row">
|
||||
<div class="small-12 medium-8 large-5 column small-centered">
|
||||
<div class="panel">
|
||||
<h1 class="text-center"><%= t("devise_views.sessions.new.title") %></h1>
|
||||
<div class="auth row">
|
||||
<div class="small-12 medium-8 large-5 column small-centered">
|
||||
<div class="panel">
|
||||
<h1 class="text-center"><%= t("devise_views.sessions.new.title") %></h1>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||
<div class="row">
|
||||
<div class="small-12 columns">
|
||||
<%= f.label :email, t("devise_views.sessions.new.email_label") %>
|
||||
<%= f.email_field :email, autofocus: true, placeholder: t("devise_views.sessions.new.email_label") %>
|
||||
</div>
|
||||
</div>
|
||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||
<div class="row">
|
||||
<div class="small-12 columns">
|
||||
<%= f.label :email, t("devise_views.sessions.new.email_label") %>
|
||||
<%= f.email_field :email, autofocus: true, placeholder: t("devise_views.sessions.new.email_label") %>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 columns">
|
||||
<%= f.label :password, t("devise_views.sessions.new.password_label") %>
|
||||
<%= f.password_field :password, autocomplete: "off", placeholder: t("devise_views.sessions.new.password_label") %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="small-12 columns">
|
||||
<%= f.label :password, t("devise_views.sessions.new.password_label") %>
|
||||
<%= f.password_field :password, autocomplete: "off", placeholder: t("devise_views.sessions.new.password_label") %>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<div class="row">
|
||||
<div class="small-12 columns">
|
||||
<%= f.check_box :remember_me %>
|
||||
<%= f.label :remember_me, t("devise_views.sessions.new.remember_me") %>
|
||||
</div>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 columns">
|
||||
<%= f.submit(t("devise_views.sessions.new.submit"), class: "button radius expand") %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<div class="small-12 columns">
|
||||
<%= f.check_box :remember_me %>
|
||||
<%= f.label :remember_me, t("devise_views.sessions.new.remember_me") %>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<div class="small-12 columns">
|
||||
<%= f.submit(t("devise_views.sessions.new.submit"), class: "button radius expand") %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
39
app/views/layouts/devise.html.erb
Normal file
39
app/views/layouts/devise.html.erb
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<title><%= content_for?(:title) ? yield(:title) : "Participación" %></title>
|
||||
<%= stylesheet_link_tag "application" %>
|
||||
<%= javascript_include_tag "vendor/modernizr" %>
|
||||
<%= javascript_include_tag "application", 'data-turbolinks-track' => true %>
|
||||
<%= csrf_meta_tags %>
|
||||
<script src="https://www.google.com/recaptcha/api.js?hl=<%= I18n.locale %>"></script>
|
||||
</head>
|
||||
|
||||
<body class="auth-page">
|
||||
|
||||
<% if notice %>
|
||||
<p class="alert-box success"><%= notice %></p>
|
||||
<% end %>
|
||||
|
||||
<% if alert %>
|
||||
<p class="alert-box"><%= alert %></p>
|
||||
<% end %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-8 large-5 column small-centered">
|
||||
<h1>
|
||||
<%= link_to root_path do %>
|
||||
<%= image_tag('logo_madrid_white.png', class: 'left', size: '96x96') %>
|
||||
<%= t("layouts.header.open_gov", open: "<strong>#{t('layouts.header.open')}</strong>").html_safe %> | <span><%= t("layouts.header.participation") %></span>
|
||||
<% end %>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -20,6 +20,11 @@ module Participacion
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
config.i18n.default_locale = :es
|
||||
|
||||
config.i18n.available_locales = [:en, :es]
|
||||
|
||||
# Add the new directories to the locales load path
|
||||
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
|
||||
|
||||
config.assets.paths << Rails.root.join("app", "assets", "fonts")
|
||||
|
||||
# Do not swallow errors in after_commit/after_rollback callbacks.
|
||||
|
||||
106
config/i18n-tasks.yml
Normal file
106
config/i18n-tasks.yml
Normal file
@@ -0,0 +1,106 @@
|
||||
# i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
|
||||
|
||||
# The "main" locale.
|
||||
base_locale: en
|
||||
## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
|
||||
# locales: [es, fr]
|
||||
## Reporting locale, default: en. Available: en, ru.
|
||||
# internal_locale: en
|
||||
|
||||
# Read and write translations.
|
||||
data:
|
||||
## Translations are read from the file system. Supported format: YAML, JSON.
|
||||
## Provide a custom adapter:
|
||||
# adapter: I18n::Tasks::Data::FileSystem
|
||||
|
||||
# Locale files or `File.find` patterns where translations are read from:
|
||||
read:
|
||||
## Default:
|
||||
# - config/locales/%{locale}.yml
|
||||
## More files:
|
||||
# - config/locales/**/*.%{locale}.yml
|
||||
## Another gem (replace %#= with %=):
|
||||
# - "<%#= %x[bundle show vagrant].chomp %>/templates/locales/%{locale}.yml"
|
||||
- config/locales/%{locale}.yml
|
||||
- config/locales/devise_views.%{locale}.yml
|
||||
- config/locales/responders.%{locale}.yml
|
||||
|
||||
# Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
|
||||
# `i18n-tasks normalize -p` will force move the keys according to these rules
|
||||
write:
|
||||
## For example, write devise and simple form keys to their respective files:
|
||||
# - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
|
||||
## Catch-all default:
|
||||
# - config/locales/%{locale}.yml
|
||||
|
||||
## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, or a custom class.
|
||||
# router: convervative_router
|
||||
|
||||
yaml:
|
||||
write:
|
||||
# do not wrap lines at 80 characters
|
||||
line_width: -1
|
||||
|
||||
## Pretty-print JSON:
|
||||
# json:
|
||||
# write:
|
||||
# indent: ' '
|
||||
# space: ' '
|
||||
# object_nl: "\n"
|
||||
# array_nl: "\n"
|
||||
|
||||
# Find translate calls
|
||||
search:
|
||||
## Paths or `File.find` patterns to search in:
|
||||
# paths:
|
||||
# - app/
|
||||
|
||||
## Root directories for relative keys resolution.
|
||||
# relative_roots:
|
||||
# - app/controllers
|
||||
# - app/helpers
|
||||
# - app/mailers
|
||||
# - app/presenters
|
||||
# - app/views
|
||||
|
||||
## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
|
||||
## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json)
|
||||
exclude:
|
||||
- app/assets/images
|
||||
- app/assets/fonts
|
||||
|
||||
## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
|
||||
## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
|
||||
# include: ["*.rb", "*.html.slim"]
|
||||
|
||||
## Default scanner finds t() and I18n.t() calls.
|
||||
# scanner: I18n::Tasks::Scanners::PatternWithScopeScanner
|
||||
|
||||
## Google Translate
|
||||
# translation:
|
||||
# # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
|
||||
# api_key: "AbC-dEf5"
|
||||
|
||||
## Do not consider these keys missing:
|
||||
# ignore_missing:
|
||||
# - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
|
||||
# - '{devise,simple_form}.*'
|
||||
|
||||
## Consider these keys used:
|
||||
# ignore_unused:
|
||||
# - 'activerecord.attributes.*'
|
||||
# - '{devise,kaminari,will_paginate}.*'
|
||||
# - 'simple_form.{yes,no}'
|
||||
# - 'simple_form.{placeholders,hints,labels}.*'
|
||||
# - 'simple_form.{error_notification,required}.:'
|
||||
|
||||
## Exclude these keys from the `i18n-tasks eq-base' report:
|
||||
# ignore_eq_base:
|
||||
# all:
|
||||
# - common.ok
|
||||
# fr,es:
|
||||
# - common.brand
|
||||
|
||||
## Ignore these keys completely:
|
||||
# ignore:
|
||||
# - kaminari.*
|
||||
@@ -1,6 +0,0 @@
|
||||
I18n.available_locales = [:en, :es]
|
||||
|
||||
I18n.default_locale = :es
|
||||
|
||||
# Add the new directories to the locales load path
|
||||
I18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
|
||||
@@ -56,6 +56,8 @@ en:
|
||||
title: "Sign up"
|
||||
first_name_label: "First name"
|
||||
last_name_label: "Last name"
|
||||
nickname_label: "Nickname"
|
||||
use_nickname_label: "Use nickname"
|
||||
email_label: "Email"
|
||||
password_label: "Password"
|
||||
min_length: "(%{min} characters minimum)"
|
||||
|
||||
@@ -55,7 +55,9 @@ es:
|
||||
new:
|
||||
title: "Registrarse"
|
||||
first_name_label: "Nombre"
|
||||
last_name_label: "Apellido"
|
||||
last_name_label: "Apellidos"
|
||||
nickname_label: "Pseudónimo"
|
||||
use_nickname_label: "Usar pseudónimo"
|
||||
email_label: "Email"
|
||||
password_label: "Contraseña"
|
||||
min_length: "(mínimo %{min} caracteres)"
|
||||
@@ -80,4 +82,4 @@ es:
|
||||
signin_with_provider: "Entrar con %{provider}"
|
||||
new_password: "¿Olvidaste tu contraseña?"
|
||||
new_confirmation: "¿No has recibido instrucciones para confirmar tu cuenta?"
|
||||
new_unlock: "¿No has recibido instrucciones para desbloquear?"
|
||||
new_unlock: "¿No has recibido instrucciones para desbloquear?"
|
||||
|
||||
@@ -20,9 +20,6 @@ en:
|
||||
votes: votes
|
||||
comment: Comment
|
||||
comments: Comments
|
||||
agree: I agree
|
||||
disagree: I disagree
|
||||
leave_comment: Comment
|
||||
form:
|
||||
error: error
|
||||
errors: errors
|
||||
@@ -48,7 +45,7 @@ en:
|
||||
new:
|
||||
publish_new: Publish new debate
|
||||
back_link: Back
|
||||
recommendations_tite: Tips for creating a debate
|
||||
recommendations_title: Tips for creating a debate
|
||||
recommendation_one: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore"
|
||||
recommendation_two: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore"
|
||||
recommendation_three: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore"
|
||||
@@ -61,12 +58,18 @@ en:
|
||||
agree: I agree
|
||||
disagree: I disagree
|
||||
supports: Supports
|
||||
notice_thanks: "Thanks for voting."
|
||||
notice_already_registered: "Your vote is already registered."
|
||||
account:
|
||||
show:
|
||||
title: "My account"
|
||||
save_changes_submit: "Save changes"
|
||||
change_credentials_link: "Change my credentials"
|
||||
first_name_label: "First Name"
|
||||
last_name_label: "Last Name"
|
||||
use_nickname_label: "Use nickname"
|
||||
nickname_label: "Nickname"
|
||||
recaptcha:
|
||||
errors:
|
||||
verification_failed: "The captcha verification failed"
|
||||
shared:
|
||||
tags_cloud:
|
||||
tags: Tags
|
||||
|
||||
@@ -20,9 +20,6 @@ es:
|
||||
votes: votos
|
||||
comment: Comentario
|
||||
comments: Comentarios
|
||||
agree: Estoy de acuerdo
|
||||
disagree: No estoy de acuerdo
|
||||
leave_comment: Comentar
|
||||
form:
|
||||
error: error
|
||||
errors: errores
|
||||
@@ -61,12 +58,19 @@ es:
|
||||
agree: Estoy de acuerdo
|
||||
disagree: No estoy de acuerdo
|
||||
supports: Apoyos
|
||||
notice_thanks: "Gracias por votar."
|
||||
notice_already_registered: "Tu voto ya ha sido registrado."
|
||||
account:
|
||||
show:
|
||||
title: "Mi cuenta"
|
||||
save_changes_submit: "Guardar cambios"
|
||||
change_credentials_link: "Cambiar mi contraseña"
|
||||
first_name_label: "Nombre"
|
||||
last_name_label: "Apellidos"
|
||||
use_nickname_label: "Usar pseudónimo"
|
||||
nickname_label: "Pseudónimo"
|
||||
recaptcha:
|
||||
errors:
|
||||
verification_failed: "La verificación por captcha falló"
|
||||
shared:
|
||||
tags_cloud:
|
||||
tags: Etiquetas
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ en:
|
||||
create:
|
||||
notice: '%{resource_name} was successfully created.'
|
||||
# alert: '%{resource_name} could not be created.'
|
||||
update:
|
||||
notice: '%{resource_name} was successfully updated.'
|
||||
# update:
|
||||
# notice: '%{resource_name} was successfully updated.'
|
||||
# alert: '%{resource_name} could not be updated.'
|
||||
destroy:
|
||||
notice: '%{resource_name} was successfully destroyed.'
|
||||
alert: '%{resource_name} could not be destroyed.'
|
||||
# destroy:
|
||||
# notice: '%{resource_name} was successfully destroyed.'
|
||||
# alert: '%{resource_name} could not be destroyed.'
|
||||
save_changes:
|
||||
notice: "Saved"
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ es:
|
||||
actions:
|
||||
create:
|
||||
notice: "%{resource_name} creado correctamente."
|
||||
update:
|
||||
notice: "%{resource_name} actualizado correctamente."
|
||||
destroy:
|
||||
notice: "%{resource_name} borrado correctamente."
|
||||
alert: "%{resource_name} no ha podido ser borrado."
|
||||
# update:
|
||||
# notice: "%{resource_name} actualizado correctamente."
|
||||
# destroy:
|
||||
# notice: "%{resource_name} borrado correctamente."
|
||||
# alert: "%{resource_name} no ha podido ser borrado."
|
||||
save_changes:
|
||||
notice: "Cambios guardados"
|
||||
|
||||
5
db/migrate/20150806135245_add_nickname_to_user.rb
Normal file
5
db/migrate/20150806135245_add_nickname_to_user.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddNicknameToUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :nickname, :string
|
||||
end
|
||||
end
|
||||
5
db/migrate/20150806140048_add_use_nickname_to_users.rb
Normal file
5
db/migrate/20150806140048_add_use_nickname_to_users.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddUseNicknameToUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :use_nickname, :boolean, null: false, default: false
|
||||
end
|
||||
end
|
||||
14
db/schema.rb
14
db/schema.rb
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150806111435) do
|
||||
ActiveRecord::Schema.define(version: 20150806140048) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -62,24 +62,26 @@ ActiveRecord::Schema.define(version: 20150806111435) do
|
||||
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "sign_in_count", default: 0, null: false
|
||||
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"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "first_name"
|
||||
t.string "last_name"
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "unconfirmed_email"
|
||||
t.string "nickname"
|
||||
t.boolean "use_nickname", default: false, null: false
|
||||
end
|
||||
|
||||
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
|
||||
|
||||
17
spec/i18n_spec.rb
Normal file
17
spec/i18n_spec.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
require 'i18n/tasks'
|
||||
|
||||
RSpec.describe 'I18n' do
|
||||
let(:i18n) { I18n::Tasks::BaseTask.new }
|
||||
let(:missing_keys) { i18n.missing_keys }
|
||||
let(:unused_keys) { i18n.unused_keys }
|
||||
|
||||
it 'does not have missing keys' do
|
||||
expect(missing_keys).to be_empty,
|
||||
"Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them"
|
||||
end
|
||||
|
||||
it 'does not have unused keys' do
|
||||
expect(unused_keys).to be_empty,
|
||||
"#{unused_keys.leaves.count} unused i18n keys, run `i18n-tasks unused' to show them"
|
||||
end
|
||||
end
|
||||
@@ -2,11 +2,11 @@ require 'rails_helper'
|
||||
|
||||
describe User do
|
||||
|
||||
before(:each) do
|
||||
@user = create(:user)
|
||||
end
|
||||
|
||||
describe "#votes_on_debates" do
|
||||
before(:each) do
|
||||
@user = create(:user)
|
||||
end
|
||||
|
||||
it "should return {} if no debate" do
|
||||
expect(@user.votes_on_debates()).to eq({})
|
||||
expect(@user.votes_on_debates([])).to eq({})
|
||||
@@ -27,4 +27,50 @@ describe User do
|
||||
expect(voted[debate3.id]).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
subject { build(:user) }
|
||||
|
||||
it "is valid" do
|
||||
expect(subject).to be_valid
|
||||
end
|
||||
|
||||
describe 'use_nickname' do
|
||||
describe 'when true' do
|
||||
before { subject.use_nickname = true }
|
||||
|
||||
it "activates the validation of nickname" do
|
||||
subject.nickname = nil
|
||||
expect(subject).to_not be_valid
|
||||
|
||||
subject.nickname = "dredd"
|
||||
expect(subject).to be_valid
|
||||
end
|
||||
|
||||
it "calculates the name using the nickname" do
|
||||
subject.nickname = "dredd"
|
||||
expect(subject.name).to eq("dredd")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when false' do
|
||||
before { subject.use_nickname = false }
|
||||
|
||||
it "activates the validation of first_name and last_name" do
|
||||
subject.first_name = nil
|
||||
subject.last_name = nil
|
||||
expect(subject).to_not be_valid
|
||||
|
||||
subject.first_name = "Joseph"
|
||||
subject.last_name = "Dredd"
|
||||
expect(subject).to be_valid
|
||||
end
|
||||
|
||||
it "calculates the name using first_name and last_name" do
|
||||
subject.first_name = "Joseph"
|
||||
subject.last_name = "Dredd"
|
||||
expect(subject.name).to eq("Joseph Dredd")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user