merges master and fixes conflicts

This commit is contained in:
kikito
2015-07-29 17:13:09 +02:00
41 changed files with 428 additions and 109 deletions

View File

@@ -35,7 +35,8 @@ gem 'acts-as-taggable-on'
gem "responders" gem "responders"
gem 'foundation-rails' gem 'foundation-rails'
gem 'acts_as_votable' gem 'acts_as_votable'
gem "recaptcha", :require => "recaptcha/rails" gem "recaptcha", require: "recaptcha/rails"
gem 'ckeditor'
group :development, :test do group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console
@@ -50,6 +51,7 @@ group :development, :test do
gem 'capybara' gem 'capybara'
gem 'factory_girl_rails' gem 'factory_girl_rails'
gem 'launchy' gem 'launchy'
gem 'quiet_assets'
end end
group :test do group :test do

View File

@@ -59,7 +59,14 @@ GEM
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
xpath (~> 2.0) xpath (~> 2.0)
ckeditor (4.1.2)
cocaine
orm_adapter (~> 0.5.0)
climate_control (0.0.3)
activesupport (>= 3.0)
cliver (0.3.2) cliver (0.3.2)
cocaine (0.5.7)
climate_control (>= 0.0.3, < 1.0)
coffee-rails (4.1.0) coffee-rails (4.1.0)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
@@ -118,6 +125,8 @@ GEM
cliver (~> 0.3.1) cliver (~> 0.3.1)
multi_json (~> 1.0) multi_json (~> 1.0)
websocket-driver (>= 0.2.0) websocket-driver (>= 0.2.0)
quiet_assets (1.1.0)
railties (>= 3.1, < 5.0)
rack (1.6.4) rack (1.6.4)
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
@@ -216,6 +225,7 @@ DEPENDENCIES
acts_as_votable acts_as_votable
byebug byebug
capybara capybara
ckeditor
coffee-rails (~> 4.1.0) coffee-rails (~> 4.1.0)
database_cleaner database_cleaner
devise devise
@@ -226,6 +236,7 @@ DEPENDENCIES
launchy launchy
pg pg
poltergeist poltergeist
quiet_assets
rails (= 4.2.3) rails (= 4.2.3)
recaptcha recaptcha
responders responders

View File

@@ -14,6 +14,7 @@
//= require jquery_ujs //= require jquery_ujs
//= require foundation //= require foundation
//= require turbolinks //= require turbolinks
//= require ckeditor/init
//= require_tree . //= require_tree .
$(function(){ $(document).foundation(); }); $(function(){ $(document).foundation(); });

View File

@@ -0,0 +1,115 @@
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config )
{
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
/* Filebrowser routes */
// The location of an external file browser, that should be launched when "Browse Server" button is pressed.
config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog.
config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";
// The location of a script that handles file uploads in the Flash dialog.
config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Link tab of Image dialog.
config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Image dialog.
config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
// The location of a script that handles file uploads in the Image dialog.
config.filebrowserImageUploadUrl = "/ckeditor/pictures";
// The location of a script that handles file uploads.
config.filebrowserUploadUrl = "/ckeditor/attachment_files";
config.allowedContent = true;
// Rails CSRF token
config.filebrowserParams = function(){
var csrf_token, csrf_param, meta,
metas = document.getElementsByTagName('meta'),
params = new Object();
for ( var i = 0 ; i < metas.length ; i++ ){
meta = metas[i];
switch(meta.name) {
case "csrf-token":
csrf_token = meta.content;
break;
case "csrf-param":
csrf_param = meta.content;
break;
default:
continue;
}
}
if (csrf_param !== undefined && csrf_token !== undefined) {
params[csrf_param] = csrf_token;
}
return params;
};
config.addQueryString = function( url, params ){
var queryString = [];
if ( !params ) {
return url;
} else {
for ( var i in params )
queryString.push( i + "=" + encodeURIComponent( params[ i ] ) );
}
return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" );
};
// Integrate Rails CSRF token into file upload dialogs (link, image, attachment and flash)
CKEDITOR.on( 'dialogDefinition', function( ev ){
// Take the dialog name and its definition from the event data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
var content, upload;
if (CKEDITOR.tools.indexOf(['link', 'image', 'attachment', 'flash'], dialogName) > -1) {
content = (dialogDefinition.getContents('Upload') || dialogDefinition.getContents('upload'));
upload = (content == null ? null : content.get('upload'));
if (upload && upload.filebrowser && upload.filebrowser['params'] === undefined) {
upload.filebrowser['params'] = config.filebrowserParams();
upload.action = config.addQueryString(upload.action, upload.filebrowser['params']);
}
}
});
// Toolbar groups configuration.
config.toolbar = [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source'] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
// { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
// { name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
{ name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
'/',
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] }
];
config.toolbar_mini = [
{ name: 'paragraph', groups: [ 'list' ], items: [ 'NumberedList', 'BulletedList' ] },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike' ] }
];
config.toolbar = "mini";
};

View File

@@ -1,5 +1,16 @@
class RegistrationsController < Devise::RegistrationsController class RegistrationsController < Devise::RegistrationsController
def create
if verify_recaptcha
super
else
build_resource(sign_up_params)
flash.now[:alert] = t('recaptcha.errors.verification_failed')
render :new
end
end
private private
def sign_up_params def sign_up_params

View File

@@ -1,7 +1,7 @@
module RecaptchaHelper module RecaptchaHelper
def recaptchable? def recaptchable?(resource)
@debate.new_record? resource.new_record?
end end
def recaptcha_keys? def recaptcha_keys?

View File

@@ -6,6 +6,6 @@
<%= f.hidden_field :commentable_type, value: parent.class %> <%= f.hidden_field :commentable_type, value: parent.class %>
<%= f.hidden_field :commentable_id, value: parent.id %> <%= f.hidden_field :commentable_id, value: parent.id %>
<%= f.submit comment_button_text(parent), :class => "button radius" %> <%= f.submit comment_button_text(parent), class: "button radius" %>
<% end %> <% end %>
</div> </div>

View File

@@ -5,21 +5,21 @@
<h3><%= link_to debate.title, debate %></h3> <h3><%= link_to debate.title, debate %></h3>
<p>Por <%= debate.author.name %> el <%= l debate.created_at.to_date %></p> <p>Por <%= debate.author.name %> el <%= l debate.created_at.to_date %></p>
<p><%= debate.description %></p> <p><%= sanitize(debate.description.html_safe) %></p>
<p><%= render 'shared/tags', debate: debate %></p> <p><%= render 'shared/tags', debate: debate %></p>
<div class="row votes"> <div class="row votes">
<div class="small-8 column"> <div class="small-8 column">
<%= link_to debate_votes_path(debate, value: 'yes'), :class => 'in-favor', method: "post" do %> <%= link_to debate_votes_path(debate, value: 'yes'), class: 'in-favor', method: "post" do %>
<i class="fi-like"></i> <i class="fi-like"></i>
<span><%= percentage('likes', debate) %></span> <span><%= percentage('likes', debate) %></span>
<% end %> <% end %>
<span class="divider"></span> <span class="divider"></span>
<%= link_to debate_votes_path(debate, value: 'no'), :class => 'against', method: "post" do %> <%= link_to debate_votes_path(debate, value: 'no'), class: 'against', method: "post" do %>
<i class="fi-dislike"></i> <i class="fi-dislike"></i>
<span><%= percentage('dislikes', debate) %></span> <span><%= percentage('dislikes', debate) %></span>
<% end %> <% end %>

View File

@@ -18,8 +18,7 @@
<br/> <br/>
<p><strong><%= t("debates.form.debate_text") %></strong></p> <p><strong><%= t("debates.form.debate_text") %></strong></p>
<p><%= t("debates.form.text_instructions") %></p> <p><%= t("debates.form.text_instructions") %></p>
<%= f.text_area :description %> <%= f.cktext_area :description, ckeditor: { language: I18n.locale } %>
<div> <div>
<%= f.label :tag_list, t("debates.form.tags_label") %><br /> <%= f.label :tag_list, t("debates.form.tags_label") %><br />
<%= f.text_field :tag_list, value: @debate.tag_list.to_s %> <%= f.text_field :tag_list, value: @debate.tag_list.to_s %>
@@ -30,10 +29,10 @@
<%= t("debates.form.accept_terms") %> <%= t("debates.form.accept_terms") %>
<% end %> <% end %>
<%= render 'shared/captcha' %> <%= render 'shared/captcha', resource: @debate %>
<div class="actions"> <div class="actions">
<%= f.submit %> <%= f.submit(class: "button radius") %>
</div> </div>
<br/> <br/>
<% end %> <% end %>

View File

@@ -1,12 +1,12 @@
<article class="debate-show"> <article class="debate-show">
<%= link_to t("debates.show.back_link"), debates_path, :class => 'right' %> <%= link_to t("debates.show.back_link"), debates_path, class: 'right' %>
<div class="row"> <div class="row">
<div id="debate-<%= @debate.id %>" class="small-12 medium-9 column"> <div id="debate-<%= @debate.id %>" class="small-12 medium-9 column">
<h1><%= @debate.title %></h1> <h1><%= @debate.title %></h1>
<p>Por <%= @debate.author.name %> el <%= l @debate.created_at.to_date %></p> <p>Por <%= @debate.author.name %> el <%= l @debate.created_at.to_date %></p>
<p><%= @debate.description %></p> <p><%= sanitize(@debate.description.html_safe) %></p>
<p><%= render 'shared/tags', debate: @debate %></p> <p><%= render 'shared/tags', debate: @debate %></p>
</div> </div>
@@ -25,7 +25,7 @@
</div> </div>
<% if current_user && @debate.editable_by?(current_user) %> <% if current_user && @debate.editable_by?(current_user) %>
<%= link_to t("debates.show.edit_debate_link"), edit_debate_path(@debate), :class => 'button radius right' %> <%= link_to t("debates.show.edit_debate_link"), edit_debate_path(@debate), class: 'button radius right' %>
<% end %> <% end %>
</article> </article>

View File

@@ -1,15 +1,15 @@
<h2>Resend confirmation instructions</h2> <h2><%= t("devise_views.confirmations.title") %></h2>
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
<%= devise_error_messages! %> <%= devise_error_messages! %>
<div class="field"> <div class="field">
<%= f.label :email %><br /> <%= 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) %> <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
</div> </div>
<div class="actions"> <div class="actions">
<%= f.submit "Resend confirmation instructions" %> <%= f.submit(t("devise_views.confirmations.submit"), class: "button radius") %>
</div> </div>
<% end %> <% end %>

View File

@@ -1,5 +1,5 @@
<p>Welcome <%= @email %>!</p> <p><%= t("devise_views.mailer.confirmation_instructions.welcome") %> <%= @email %></p>
<p>You can confirm your account email through the link below:</p> <p><%= t("devise_views.mailer.confirmation_instructions.text") %></p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p> <p><%= link_to t("devise_views.mailer.confirmation_instructions.confirm_link"), confirmation_url(@resource, confirmation_token: @token) %></p>

View File

@@ -1,8 +1,8 @@
<p>Hello <%= @resource.email %>!</p> <p><%= t("devise_views.mailer.reset_password_instructions.hello") %> <%= @resource.email %></p>
<p>Someone has requested a link to change your password. You can do this through the link below.</p> <p><%= t("devise_views.mailer.reset_password_instructions.text") %></p>
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p> <p><%= link_to t("devise_views.mailer.reset_password_instructions.change_link"), edit_password_url(@resource, reset_password_token: @token) %></p>
<p>If you didn't request this, please ignore this email.</p> <p><%= t("devise_views.mailer.reset_password_instructions.ignore_text") %></p>
<p>Your password won't change until you access the link above and create a new one.</p> <p><%= t("devise_views.mailer.reset_password_instructions.info_text") %></p>

View File

@@ -1,7 +1,7 @@
<p>Hello <%= @resource.email %>!</p> <p><%= t("devise_views.mailer.unlock_instructions.hello") %> <%= @resource.email %></p>
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p> <p><%= t("devise_views.mailer.unlock_instructions.info_text") %></p>
<p>Click the link below to unlock your account:</p> <p><%= t("devise_views.mailer.unlock_instructions.instructions_text") %></p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p> <p><%= link_to t("devise_views.mailer.unlock_instructions.unlock_link"), unlock_url(@resource, unlock_token: @token) %></p>

View File

@@ -1,14 +1,14 @@
<ul class="right"> <ul class="right">
<% if user_signed_in? %> <% if user_signed_in? %>
<li> <li>
<%= link_to('Salir', destroy_user_session_path, method: :delete) %> <%= link_to(t("devise_views.menu.login_items.logout"), destroy_user_session_path, method: :delete) %>
</li> </li>
<% else %> <% else %>
<li> <li>
<%= link_to('Entrar', new_user_session_path) %> <%= link_to(t("devise_views.menu.login_items.login"), new_user_session_path) %>
</li> </li>
<li class="active"> <li class="active">
<%= link_to('Registrarse', new_user_registration_path) %> <%= link_to(t("devise_views.menu.login_items.signup"), new_user_registration_path) %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@@ -1,24 +1,24 @@
<h2>Change your password</h2> <h2><%= t("devise_views.passwords.edit.title") %></h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %> <%= devise_error_messages! %>
<%= f.hidden_field :reset_password_token %> <%= f.hidden_field :reset_password_token %>
<div class="field"> <div class="field">
<%= f.label :password, "New password" %><br /> <%= f.label :password, t("devise_views.passwords.edit.password_label") %><br />
<% if @minimum_password_length %> <% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em> <em><%= t("devise_views.passwords.edit.min_length", min: @minimum_password_length) %></em>
<% end %><br /> <% end %><br />
<%= f.password_field :password, autofocus: true, autocomplete: "off" %> <%= f.password_field :password, autofocus: true, autocomplete: "off" %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :password_confirmation, "Confirm new password" %><br /> <%= f.label :password_confirmation, t("devise_views.passwords.edit.password_confirmation_label") %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %> <%= f.password_field :password_confirmation, autocomplete: "off" %>
</div> </div>
<div class="actions"> <div class="actions">
<%= f.submit "Change my password" %> <%= f.submit t("devise_views.passwords.edit.change_submit") %>
</div> </div>
<% end %> <% end %>

View File

@@ -1,15 +1,15 @@
<h2>Forgot your password?</h2> <h2><%= t("devise_views.passwords.new.title") %></h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= devise_error_messages! %> <%= devise_error_messages! %>
<div class="field"> <div class="field">
<%= f.label :email %><br /> <%= f.label :email, t("devise_views.passwords.new.email_label") %><br />
<%= f.email_field :email, autofocus: true %> <%= f.email_field :email, autofocus: true %>
</div> </div>
<div class="actions"> <div class="actions">
<%= f.submit "Send me reset password instructions" %> <%= f.submit t("devise_views.passwords.new.send_submit") %>
</div> </div>
<% end %> <% end %>

View File

@@ -1,39 +1,39 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2> <h2><%= t("devise_views.registrations.edit.edit") %> <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %> <%= devise_error_messages! %>
<div class="field"> <div class="field">
<%= f.label :email %><br /> <%= f.label :email, t("devise_views.registrations.edit.email_label") %><br />
<%= f.email_field :email, autofocus: true %> <%= f.email_field :email, autofocus: true %>
</div> </div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div> <div><%= t("devise_views.registrations.edit.waiting_for") %> <%= resource.unconfirmed_email %></div>
<% end %> <% end %>
<div class="field"> <div class="field">
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br /> <%= f.label :password, t("devise_views.registrations.edit.password_label") %> <i><%= t("devise_views.registrations.edit.leave_blank") %></i><br />
<%= f.password_field :password, autocomplete: "off" %> <%= f.password_field :password, autocomplete: "off" %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :password_confirmation %><br /> <%= f.label :password_confirmation, t("devise_views.registrations.edit.password_confirmation_label") %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %> <%= f.password_field :password_confirmation, autocomplete: "off" %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br /> <%= f.label :current_password, t("devise_views.registrations.edit.current_password_label") %> <i><%= t("devise_views.registrations.edit.need_current") %></i><br />
<%= f.password_field :current_password, autocomplete: "off" %> <%= f.password_field :current_password, autocomplete: "off" %>
</div> </div>
<div class="actions"> <div class="actions">
<%= f.submit "Update" %> <%= f.submit t("devise_views.registrations.edit.update_submit") %>
</div> </div>
<% end %> <% end %>
<h3>Cancel my account</h3> <h3><%= t("devise_views.registrations.edit.cancel_title") %></h3>
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p> <p><%= t("devise_views.registrations.edit.cancel_text") %> <%= button_to t("devise_views.registrations.edit.cancel_link"), registration_path(resource_name), data: { confirm: t("devise_views.registrations.edit.cancel_confirm") }, method: :delete %></p>
<%= link_to "Back", :back %> <%= link_to t("devise_views.registrations.edit.back_link"), :back %>

View File

@@ -1,39 +1,41 @@
<h2>Sign up</h2> <h2><%= t("devise_views.registrations.new.title") %></h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %> <%= devise_error_messages! %>
<div class="field"> <div class="field">
<%= f.label :first_name %><br /> <%= f.label :first_name, t("devise_views.registrations.new.first_name_label") %><br />
<%= f.text_field :first_name, autofocus: true %> <%= f.text_field :first_name, autofocus: true %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :last_name %><br /> <%= f.label :last_name, t("devise_views.registrations.new.last_name_label") %><br />
<%= f.text_field :last_name %> <%= f.text_field :last_name %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :email %><br /> <%= f.label :email, t("devise_views.registrations.new.email_label") %><br />
<%= f.email_field :email %> <%= f.email_field :email %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :password %> <%= f.label :password, t("devise_views.registrations.new.password_label") %>
<% if @minimum_password_length %> <% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em> <em><%= t("devise_views.registrations.new.min_length", min: @minimum_password_length) %></em>
<% end %><br /> <% end %><br />
<%= f.password_field :password, autocomplete: "off" %> <%= f.password_field :password, autocomplete: "off" %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :password_confirmation %><br /> <%= f.label :password_confirmation, t("devise_views.registrations.new.password_confirmation_label") %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %> <%= f.password_field :password_confirmation, autocomplete: "off" %>
</div> </div>
<div class="actions"> <%= render 'shared/captcha', resource: resource %>
<%= f.submit "Registrarse", class: 'button radius' %>
<div class="actions" style="padding-top:20px">
<%= f.submit t("devise_views.registrations.new.submit"), class: 'button radius' %>
</div> </div>
<% end %> <% end %>

View File

@@ -1,25 +1,25 @@
<h2>Log in</h2> <h2><%= t("devise_views.sessions.new.title") %></h2>
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="field"> <div class="field">
<%= f.label :email %><br /> <%= f.label :email, t("devise_views.sessions.new.email_label") %><br />
<%= f.email_field :email, autofocus: true %> <%= f.email_field :email, autofocus: true %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :password %><br /> <%= f.label :password, t("devise_views.sessions.new.password_label") %><br />
<%= f.password_field :password, autocomplete: "off" %> <%= f.password_field :password, autocomplete: "off" %>
</div> </div>
<% if devise_mapping.rememberable? -%> <% if devise_mapping.rememberable? -%>
<div class="field"> <div class="field">
<%= f.check_box :remember_me %> <%= f.check_box :remember_me %>
<%= f.label :remember_me %> <%= f.label :remember_me, t("devise_views.sessions.new.remember_me") %>
</div> </div>
<% end -%> <% end -%>
<div class="actions"> <div class="actions">
<%= f.submit "Entrar" %> <%= f.submit(t("devise_views.sessions.new.submit"), class: "button radius") %>
</div> </div>
<% end %> <% end %>

View File

@@ -1,25 +1,25 @@
<%- if controller_name != 'sessions' %> <%- if controller_name != 'sessions' %>
<%= link_to "Log in", new_session_path(resource_name) %><br /> <%= link_to t("devise_views.shared.links.login"), new_session_path(resource_name) %><br />
<% end -%> <% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %> <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br /> <%= link_to t("devise_views.shared.links.signup"), new_registration_path(resource_name) %><br />
<% end -%> <% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br /> <%= link_to t("devise_views.shared.links.new_password"), new_password_path(resource_name) %><br />
<% end -%> <% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br /> <%= link_to t("devise_views.shared.links.new_confirmation"), new_confirmation_path(resource_name) %><br />
<% end -%> <% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> <%- 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 /> <%= link_to t("devise_views.shared.links.new_unlock"), new_unlock_path(resource_name) %><br />
<% end -%> <% end -%>
<%- if devise_mapping.omniauthable? %> <%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %> <%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br /> <%= link_to t("devise_views.shared.links.signin_with_provider", provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider) %><br />
<% end -%> <% end -%>
<% end -%> <% end -%>

View File

@@ -1,15 +1,15 @@
<h2>Resend unlock instructions</h2> <h2><%= t("devise_views.unlocks.new.title") %></h2>
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
<%= devise_error_messages! %> <%= devise_error_messages! %>
<div class="field"> <div class="field">
<%= f.label :email %><br /> <%= f.label :email, t("devise_views.unlocks.new.email_label") %><br />
<%= f.email_field :email, autofocus: true %> <%= f.email_field :email, autofocus: true %>
</div> </div>
<div class="actions"> <div class="actions">
<%= f.submit "Resend unlock instructions" %> <%= f.submit t("devise_views.unlocks.new.submit") %>
</div> </div>
<% end %> <% end %>

View File

@@ -3,7 +3,7 @@
<div class="row"> <div class="row">
<div class="small-12 column"> <div class="small-12 column">
<div class="right"> <div class="right">
<a href="#">Portal de Transparencia</a> | <a href="#">Datos abiertos</a> <a href="#"><%= t("layouts.header.external_link_transparency") %></a> | <a href="#"><%= t("layouts.header.external_link_opendata") %></a>
</div> </div>
</div> </div>
</div> </div>
@@ -14,11 +14,11 @@
<ul class="title-area"> <ul class="title-area">
<li class="name"> <li class="name">
<%= link_to root_path do %> <%= link_to root_path do %>
<%= image_tag('header-logo-madrid.png', :class => 'left', :size => '96x96') %> <%= image_tag('header-logo-madrid.png', class: 'left', size: '96x96') %>
gobierno<strong>abierto</strong> | <span>Participación</span> <%= t("layouts.header.open_gov", open: "<strong>#{t('layouts.header.open')}</strong>").html_safe %> | <span><%= t("layouts.header.participation") %></span>
<% end %> <% end %>
</li> </li>
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li> <li class="toggle-topbar menu-icon"><a href="#"><span><%= t("layouts.header.menu") %></span></a></li>
</ul> </ul>
<section class="top-bar-section"> <section class="top-bar-section">
@@ -30,9 +30,9 @@
<% if home_page? %> <% if home_page? %>
<div class="row"> <div class="row">
<div class="small-12 column text-center"> <div class="small-12 column text-center">
<h1>Estamos abriendo Madrid</h1> <h1><%= t("layouts.header.open_city") %></h1>
<h2>Para que todos los madrileños decidamos que ciudad queremos tener.</h2> <h2><%= t("layouts.header.open_city_slogan") %></h2>
<%= link_to 'Participa en los últimos debates e iniciativas', new_debate_path, :class => 'button radius' %> <%= link_to t("layouts.header.create_debate"), new_debate_path, class: 'button radius' %>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@@ -20,7 +20,7 @@
<% end %> <% end %>
<% if alert %> <% if alert %>
<p class="alert-box success"><%= alert %></p> <p class="alert-box"><%= alert %></p>
<% end %> <% end %>
<div class="row"> <div class="row">

View File

@@ -1,3 +1,3 @@
<% if recaptchable? and recaptcha_keys? %> <% if recaptchable?(resource) and recaptcha_keys? %>
<%= recaptcha_tags ajax: true, hl: I18n.locale %> <%= recaptcha_tags ajax: true, hl: I18n.locale %>
<% end %> <% end %>

View File

@@ -1 +1 @@
ActsAsTaggableOn.delimiter = ','

View File

@@ -0,0 +1,83 @@
en:
devise_views:
confirmations:
title: "Resend confirmation instructions"
email_label: Email
submit: "Resend confirmation instructions"
mailer:
confirmation_instructions:
welcome: "Welcome"
text: "You can confirm your account email through the link below:"
confirm_link: "Confirm my account"
reset_password_instructions:
hello: "Hello"
text: "Someone has requested a link to change your password. You can do this through the link below."
change_link: "Change my password"
ignore_text: "If you didn't request this, please ignore this email."
info_text: "Your password won't change until you access the link above and create a new one."
unlock_instructions:
hello: "Hello"
info_text: "Your account has been locked due to an excessive number of unsuccessful sign in attempts."
instructions_text: "Click the link below to unlock your account:"
unlock_link: "Unlock my account"
menu:
login_items:
logout: "Logout"
signup: "Sign up"
login: "Log in"
passwords:
edit:
title: "Change your password"
password_label: "New password"
min_length: "(%{min} characters minimum)"
password_confirmation_label: "Confirm new password"
change_submit: "Change my password"
new:
title: "Forgot your password?"
email_label: "Email"
send_submit: "Send me reset password instructions"
registrations:
edit:
edit: "Edit"
email_label: "Email"
waiting_for: "Currently waiting confirmation for:"
leave_blank: "(leave blank if you don't want to change it)"
password_label: "New password"
password_confirmation_label: "Confirm new password"
current_password_label: "Current password"
need_current: "(we need your current password to confirm your changes)"
update_submit: "Update"
cancel_title: "Cancel my account"
cancel_text: "Unhappy?"
cancel_link: "Cancel my account"
cancel_confirm: "Are you sure?"
back_link: "Back"
new:
title: "Sign up"
first_name_label: "First name"
last_name_label: "Last name"
email_label: "Email"
password_label: "Password"
min_length: "(%{min} characters minimum)"
password_confirmation_label: "Confirm password"
submit: "Sign up"
sessions:
new:
title: "Log in"
email_label: "Email"
password_label: "Password"
remember_me: "Remember me"
submit: "Log in"
unlocks:
new:
title: "Resend unlock instructions"
email_label: "Email"
submit: "Resend unlock instructions"
shared:
links:
login: "Log in"
signup: "Sign up"
signin_with_provider: "Sign in with %{provider}"
new_password: "Forgot your password?"
new_confirmation: "Didn't receive confirmation instructions?"
new_unlock: "Didn't receive unlock instructions?"

View File

@@ -0,0 +1,83 @@
es:
devise_views:
confirmations:
title: "Reenviar instrucciones de confirmación"
email_label: Email
submit: "Reenviar instrucciones de confirmación"
mailer:
confirmation_instructions:
welcome: "Bienvenido"
text: "Puedes confirmar tu cuenta de correo electrónico en el siguiente enlace:"
confirm_link: "Confirmar my cuenta"
reset_password_instructions:
hello: "Hola"
text: "Se ha solicitado un enlace para cambiar tu contraseña, puedes hacerlo en el siguiente enlace:"
change_link: "cambiar mi contraseña"
ignore_text: "Si tu no lo has solicitado, puedes ignorar este email"
info_text: "Tu contraseña no cambiará hasta que no accedas al enlace y la modifiques."
unlock_instructions:
hello: "Hola"
info_text: "Tu cuenta ha sido bloqueada debido a un excesivo número de intentos fallidos de alta."
instructions_text: "Sigue el siguiente enlace para desbloquear tu cuenta:"
unlock_link: "Desbloquear mi cuenta"
menu:
login_items:
logout: "Salir"
signup: "Registrarse"
login: "Entrar"
passwords:
edit:
title: "Cambia tu contraseña"
password_label: "Contraseña nueva"
min_length: "(mínimo %{min} caracteres)"
password_confirmation_label: "Confirmar contraseña nueva"
change_submit: "Cambiar mi contraseña"
new:
title: "¿Has olvidado tu contraseña?"
email_label: "Email"
send_submit: "Recibir instrucciones para recuperar mi contraseña"
registrations:
edit:
edit: "Editar"
email_label: "Email"
waiting_for: "Esperando confirmación de:"
leave_blank: "(dejar en blanco si no deseas cambiarla)"
password_label: "Contraseña nueva"
password_confirmation_label: "Confirmar contraseña nueva"
current_password_label: "Contraseña actual"
need_current: "(necesitamos tu contraseña actual para confirmar los cambios)"
update_submit: "Actualizar"
cancel_title: "Cancelar cuenta"
cancel_text: "¿Deseas borrar tu cuenta?"
cancel_link: "Cancelar mi cuenta"
cancel_confirm: "¿Seguro?"
back_link: "Atrás"
new:
title: "Registrarse"
first_name_label: "Nombre"
last_name_label: "Apellido"
email_label: "Email"
password_label: "Contraseña"
min_length: "(mínimo %{min} caracteres)"
password_confirmation_label: "Confirmar contraseña"
submit: "Registrarse"
sessions:
new:
title: "Entrar"
email_label: "Email"
password_label: "Contraseña"
remember_me: "Recordarme"
submit: "Entrar"
unlocks:
new:
title: "Reenviar instrucciones para desbloquear"
email_label: "Email"
submit: "Reenviar instrucciones para desbloquear"
shared:
links:
login: "Entrar"
signup: "Registrarse"
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?"

View File

@@ -1,4 +1,15 @@
en: en:
layouts:
header:
external_link_transparency: Transparency
external_link_opendata: Open data
open_gov: "%{open} government"
open: "Open"
participation: Participation
menu: Menu
open_city: We are opening Madrid
open_city_slogan: So the citizens can decide what kind of city they want.
create_debate: Create a debate
debates: debates:
debate: debate:
debate: Debate debate: Debate

View File

@@ -1,4 +1,15 @@
es: es:
layouts:
header:
external_link_transparency: Portal de Transparencia
external_link_opendata: Datos abiertos
open_gov: "Gobierno %{open}"
open: "abierto"
participation: Participación
menu: Menú
open_city: Estamos abriendo Madrid
open_city_slogan: Para que todos los madrileños decidamos que ciudad queremos tener.
create_debate: Crea un debate
debates: debates:
debate: debate:
debate: Debate debate: Debate

View File

@@ -6,7 +6,7 @@ class ActsAsCommentableWithThreadingMigration < ActiveRecord::Migration
t.string :title t.string :title
t.text :body t.text :body
t.string :subject t.string :subject
t.integer :user_id, :null => false t.integer :user_id, null: false
t.integer :parent_id, :lft, :rgt t.integer :parent_id, :lft, :rgt
t.timestamps t.timestamps
end end

View File

@@ -4,7 +4,7 @@ feature 'Users' do
scenario 'Sign up' do scenario 'Sign up' do
visit '/' visit '/'
click_link 'Registrarse' click_link 'Sign up'
fill_in 'user_first_name', with: 'Manuela' fill_in 'user_first_name', with: 'Manuela'
fill_in 'user_last_name', with: 'Carmena' fill_in 'user_last_name', with: 'Carmena'
@@ -12,7 +12,7 @@ feature 'Users' do
fill_in 'user_password', with: 'judgementday' fill_in 'user_password', with: 'judgementday'
fill_in 'user_password_confirmation', with: 'judgementday' fill_in 'user_password_confirmation', with: 'judgementday'
click_button 'Registrarse' click_button 'Sign up'
expect(page).to have_content 'Welcome! You have signed up successfully.' expect(page).to have_content 'Welcome! You have signed up successfully.'
end end
@@ -21,10 +21,10 @@ feature 'Users' do
user = create(:user, email: 'manuela@madrid.es', password: 'judgementday') user = create(:user, email: 'manuela@madrid.es', password: 'judgementday')
visit '/' visit '/'
click_link 'Entrar' click_link 'Log in'
fill_in 'user_email', with: 'manuela@madrid.es' fill_in 'user_email', with: 'manuela@madrid.es'
fill_in 'user_password', with: 'judgementday' fill_in 'user_password', with: 'judgementday'
click_button 'Entrar' click_button 'Log in'
expect(page).to have_content 'Signed in successfully.' expect(page).to have_content 'Signed in successfully.'
end end
@@ -34,7 +34,7 @@ feature 'Users' do
login_as(user) login_as(user)
visit "/" visit "/"
click_link 'Salir' click_link 'Logout'
expect(page).to have_content 'Signed out successfully.' expect(page).to have_content 'Signed out successfully.'
end end

View File

@@ -5,13 +5,13 @@ describe RecaptchaHelper do
describe '#recaptchable?' do describe '#recaptchable?' do
it 'should be true if new record' do it 'should be true if new record' do
assign(:debate, build(:debate)) debate = build(:debate)
expect(helper.recaptchable?).to be true expect(helper.recaptchable?(debate)).to be true
end end
it 'should be false if existing record' do it 'should be false if existing record' do
assign(:debate, create(:debate)) debate = create(:debate)
expect(helper.recaptchable?).to be false expect(helper.recaptchable?(debate)).to be false
end end
end end

View File

0
test/fixtures/.keep vendored
View File

View File

View File

View File

View File

View File

@@ -1,10 +0,0 @@
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end