merges master and fix conflicts
This commit is contained in:
1
Capfile
1
Capfile
@@ -10,6 +10,7 @@ require 'capistrano/rails/assets'
|
||||
require 'capistrano/rails/migrations'
|
||||
#require 'capistrano/passenger'
|
||||
require 'capistrano/delayed-job'
|
||||
require 'whenever/capistrano'
|
||||
|
||||
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
||||
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
|
||||
|
||||
1
Gemfile
1
Gemfile
@@ -48,6 +48,7 @@ gem 'delayed_job_active_record'
|
||||
gem 'daemons'
|
||||
gem 'devise-async'
|
||||
gem 'newrelic_rpm'
|
||||
gem 'whenever', require: false
|
||||
|
||||
gem 'ahoy_matey', '~> 1.2.1'
|
||||
gem 'groupdate' # group temporary data
|
||||
|
||||
@@ -87,6 +87,7 @@ GEM
|
||||
rack (>= 1.0.0)
|
||||
rack-test (>= 0.5.4)
|
||||
xpath (~> 2.0)
|
||||
chronic (0.10.2)
|
||||
ckeditor (4.1.3)
|
||||
cocaine
|
||||
orm_adapter (~> 0.5.0)
|
||||
@@ -392,6 +393,8 @@ GEM
|
||||
websocket-driver (0.6.2)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.2)
|
||||
whenever (0.9.4)
|
||||
chronic (>= 0.6.3)
|
||||
xpath (2.0.0)
|
||||
nokogiri (~> 1.3)
|
||||
|
||||
@@ -457,6 +460,7 @@ DEPENDENCIES
|
||||
uglifier (>= 1.3.0)
|
||||
unicorn
|
||||
web-console (~> 2.0)
|
||||
whenever
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
|
||||
@@ -305,11 +305,12 @@
|
||||
.panel {
|
||||
border-radius: 0;
|
||||
box-shadow: 0px 1px 3px 0 $border;
|
||||
margin-bottom: rem-calc(4);
|
||||
margin-bottom: rem-calc(12);
|
||||
min-height: rem-calc(192);
|
||||
padding-top: rem-calc(12);
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
margin-bottom: rem-calc(-1);
|
||||
padding-bottom: rem-calc(12);
|
||||
}
|
||||
|
||||
@@ -373,7 +374,6 @@
|
||||
|
||||
.total-votes {
|
||||
display: inline-block;
|
||||
float: none;
|
||||
line-height: $line-height;
|
||||
margin-left: rem-calc(24);
|
||||
padding-top: rem-calc(12);
|
||||
@@ -381,6 +381,7 @@
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
display: block;
|
||||
float: none;
|
||||
line-height: $line-height*2;
|
||||
margin-left: 0;
|
||||
padding-top: 0;
|
||||
@@ -399,7 +400,7 @@
|
||||
|
||||
.not-logged {
|
||||
line-height: $line-height;
|
||||
padding-top: rem-calc(36);
|
||||
padding-top: rem-calc(24);
|
||||
}
|
||||
|
||||
.anonymous-votes, .organizations-votes {
|
||||
@@ -752,6 +753,14 @@
|
||||
// 06. Flags
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
.flag-content {
|
||||
|
||||
.button {
|
||||
background: none;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.flag-disable {
|
||||
color: $text-medium;
|
||||
line-height: rem-calc(24);
|
||||
|
||||
@@ -301,14 +301,37 @@ header {
|
||||
font-family: inherit;
|
||||
font-size: rem-calc(16);
|
||||
margin-top: 0;
|
||||
|
||||
&.see-more {
|
||||
width: 100%;
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.home-page {
|
||||
text-align: center;
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.more-info {
|
||||
color: white;
|
||||
display: block;
|
||||
font-size: rem-calc(14);
|
||||
margin-left: rem-calc(24);
|
||||
margin-bottom: rem-calc(24);
|
||||
text-decoration: underline;
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
margin-left: rem-calc(24);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
opacity: .75;
|
||||
}
|
||||
@@ -330,10 +353,14 @@ header {
|
||||
}
|
||||
|
||||
.icon-external {
|
||||
display: inline-block;
|
||||
font-size: rem-calc(12);
|
||||
opacity: .5;
|
||||
padding-top: rem-calc(3);
|
||||
vertical-align: top;
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
padding-top: 0;
|
||||
position: absolute;
|
||||
right: -18px;
|
||||
top: 3px;
|
||||
@@ -419,11 +446,6 @@ header {
|
||||
font-size: rem-calc(16);
|
||||
font-weight: lighter;
|
||||
line-height: $line-height*2;
|
||||
padding-left: rem-calc(12);
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
span {
|
||||
*display: inline; /* IE */
|
||||
@@ -503,6 +525,18 @@ header {
|
||||
margin-right: rem-calc(24);
|
||||
width: 100%;
|
||||
|
||||
ul {
|
||||
margin-left: 0;
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
margin-left:rem-calc(24);
|
||||
}
|
||||
}
|
||||
|
||||
ul li {
|
||||
background: none;
|
||||
}
|
||||
|
||||
ul li > a {
|
||||
font-size: rem-calc(14);
|
||||
|
||||
@@ -510,13 +544,17 @@ header {
|
||||
border-radius: 0;
|
||||
line-height: $line-height*1.5;
|
||||
text-align: left;
|
||||
background: none;
|
||||
padding-left: rem-calc(6);
|
||||
}
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
&.button {
|
||||
background: $brand;
|
||||
border-radius: rem-calc(3);
|
||||
line-height: rem-calc(15);
|
||||
margin-top: rem-calc(24);
|
||||
padding-left: rem-calc(15);
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
@@ -550,7 +588,7 @@ header {
|
||||
li:not(.has-form) a:not(.button) {
|
||||
background: none;
|
||||
color: white;
|
||||
padding: 0 rem-calc(6);
|
||||
padding: rem-calc(12) 0;
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
line-height: $line-height*4;
|
||||
@@ -608,7 +646,7 @@ header {
|
||||
|
||||
a {
|
||||
color: $text;
|
||||
display: block;
|
||||
display: inline-block;
|
||||
font-size: rem-calc(14);
|
||||
font-weight: bold;
|
||||
line-height: $line-height*2;
|
||||
@@ -616,12 +654,26 @@ header {
|
||||
text-align: left;
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
display: inline-block;
|
||||
line-height: $line-height*3;
|
||||
margin-left: rem-calc(12);
|
||||
margin-right: rem-calc(72);
|
||||
}
|
||||
|
||||
&:after {
|
||||
color: $border;
|
||||
content: "|";
|
||||
padding: 0 rem-calc(12);
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
content: none;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child:after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: $link;
|
||||
}
|
||||
@@ -758,7 +810,6 @@ footer {
|
||||
background: #065687 image-url("auth_bg.jpg");
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
padding-top: rem-calc(24);
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
padding-top: rem-calc(48);
|
||||
@@ -772,9 +823,8 @@ footer {
|
||||
@include logo;
|
||||
|
||||
a {
|
||||
line-height: $line-height;
|
||||
|
||||
span {
|
||||
span.logo-site {
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
@@ -1058,7 +1108,11 @@ img.initialjs-avatar {
|
||||
h2 {
|
||||
display: inline-block;
|
||||
font-size: rem-calc(24);
|
||||
margin-left: rem-calc(-17);
|
||||
margin: rem-calc(12) 0;
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
margin: rem-calc(24) 0;
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
@@ -1070,10 +1124,6 @@ img.initialjs-avatar {
|
||||
padding: rem-calc(12);
|
||||
width: auto;
|
||||
|
||||
@media (max-width: $small) {
|
||||
margin-left: rem-calc(-17);
|
||||
}
|
||||
|
||||
@media (min-width: $small-breakpoint) {
|
||||
margin: 0 0 rem-calc(24) rem-calc(12);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class AccountController < ApplicationController
|
||||
|
||||
def account_params
|
||||
if @account.organization?
|
||||
params.require(:account).permit(:phone_number, :email_on_debate_comment, :email_on_comment_reply, organization_attributes: [:name])
|
||||
params.require(:account).permit(:phone_number, :email_on_debate_comment, :email_on_comment_reply, organization_attributes: [:name, :responsible_name])
|
||||
else
|
||||
params.require(:account).permit(:username, :email_on_debate_comment, :email_on_comment_reply)
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ class Organizations::RegistrationsController < Devise::RegistrationsController
|
||||
private
|
||||
|
||||
def sign_up_params
|
||||
params.require(:user).permit(:email, :password, :phone_number, :password_confirmation, :captcha, :captcha_key, :terms_of_service, organization_attributes: [:name])
|
||||
params.require(:user).permit(:email, :password, :phone_number, :password_confirmation, :captcha, :captcha_key, :terms_of_service, organization_attributes: [:name, :responsible_name])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -11,7 +11,9 @@ class VerificationController < ApplicationController
|
||||
private
|
||||
|
||||
def next_step_path(user = current_user)
|
||||
if user.level_three_verified?
|
||||
if user.organization?
|
||||
{ path: account_path }
|
||||
elsif user.level_three_verified?
|
||||
{ path: account_path, notice: t('verification.redirect_notices.already_verified') }
|
||||
elsif user.verification_letter_sent?
|
||||
{ path: edit_letter_path }
|
||||
|
||||
@@ -3,7 +3,9 @@ class Organization < ActiveRecord::Base
|
||||
|
||||
validates :name, presence: true
|
||||
validates :name, uniqueness: true
|
||||
validate :validate_name_length
|
||||
validate :validate_name_length
|
||||
validates :responsible_name, presence: true
|
||||
validate :validate_responsible_name_length
|
||||
|
||||
delegate :email, :phone_number, to: :user
|
||||
|
||||
@@ -37,6 +39,10 @@ class Organization < ActiveRecord::Base
|
||||
@@name_max_length ||= self.columns.find { |c| c.name == 'name' }.limit || 60
|
||||
end
|
||||
|
||||
def self.responsible_name_max_length
|
||||
@@responsible_name_max_length ||= self.columns.find { |c| c.name == 'responsible_name' }.limit || 60
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_name_length
|
||||
@@ -46,4 +52,11 @@ class Organization < ActiveRecord::Base
|
||||
validator.validate(self)
|
||||
end
|
||||
|
||||
def validate_responsible_name_length
|
||||
validator = ActiveModel::Validations::LengthValidator.new(
|
||||
attributes: :responsible_name,
|
||||
maximum: Organization.responsible_name_max_length)
|
||||
validator.validate(self)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ class User < ActiveRecord::Base
|
||||
|
||||
validates_associated :organization, message: false
|
||||
|
||||
accepts_nested_attributes_for :organization
|
||||
accepts_nested_attributes_for :organization, update_only: true
|
||||
|
||||
scope :administrators, -> { joins(:administrators) }
|
||||
scope :moderators, -> { joins(:moderator) }
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<div class="row account">
|
||||
<div class="small-12 column">
|
||||
<%= link_to t("account.show.change_credentials_link"), edit_user_registration_path, class: "button radius small secondary right" %>
|
||||
|
||||
<div>
|
||||
<span class="right verify-account">
|
||||
<% if current_user.level_three_verified? %>
|
||||
<p class="verified">
|
||||
<i class="icon-check"></i>
|
||||
<%= t("account.show.verified_account") %>
|
||||
</p>
|
||||
<% elsif current_user.level_two_verified? %>
|
||||
<%= link_to t("account.show.finish_verification"), verification_path, class: "button radius small success right" %>
|
||||
<% else %>
|
||||
<%= link_to t("account.show.verify_my_account"), verification_path, class: "button radius small success right" %>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<% unless @account.organization? %>
|
||||
<div>
|
||||
<span class="right verify-account">
|
||||
<% if current_user.level_three_verified? %>
|
||||
<p class="verified">
|
||||
<i class="icon-check"></i>
|
||||
<%= t("account.show.verified_account") %>
|
||||
</p>
|
||||
<% elsif current_user.level_two_verified? %>
|
||||
<%= link_to t("account.show.finish_verification"), verification_path, class: "button radius small success right" %>
|
||||
<% else %>
|
||||
<%= link_to t("account.show.verify_my_account"), verification_path, class: "button radius small success right" %>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
<h1 class="inline-block"><%= t("account.show.title") %></h1>
|
||||
|
||||
<%= form_for @account, as: :account, url: account_path do |f| %>
|
||||
@@ -33,6 +33,7 @@
|
||||
<% if @account.organization? %>
|
||||
<%= f.fields_for :organization do |fo| %>
|
||||
<%= fo.text_field :name, autofocus: true, maxlength: Organization.name_max_length, placeholder: t("account.show.organization_name_label") %>
|
||||
<%= fo.text_field :responsible_name, autofocus: true, maxlength: Organization.responsible_name_max_length, placeholder: t("account.show.organization_responsible_name_placeholder") %>
|
||||
<% end %>
|
||||
<%= f.text_field :phone_number, placeholder: t("account.show.phone_number_label") %>
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<td><%= organization.name %></td>
|
||||
<td><%= organization.email %></td>
|
||||
<td><%= organization.phone_number %></td>
|
||||
<td><%= organization.responsible_name %></td>
|
||||
<% if organization.verified? %>
|
||||
<td class="verified">
|
||||
<i class="icon-check"></i>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<td><%= organization.name %></td>
|
||||
<td><%= organization.email %></td>
|
||||
<td><%= organization.phone_number %></td>
|
||||
<td><%= organization.responsible_name %></td>
|
||||
<% if organization.verified? %>
|
||||
<td class="verified">
|
||||
<i class="icon-check"></i>
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
<% if show_flag_action? comment %>
|
||||
<span class="divider"> | </span>
|
||||
<a id="flag-expand-comment-<%= comment.id %>" data-dropdown="flag-drop-comment-<%= comment.id %>" aria-controls="flag-drop-comment-<%= comment.id %>" aria-expanded="false" title="<%= t('shared.flag') %>">
|
||||
<i class="icon-flag flag-disable"></i>
|
||||
</a>
|
||||
<ul id="flag-drop-comment-<%= comment.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t("shared.flag"), flag_comment_path(comment), method: :put, remote: true, id: "flag-comment-#{comment.id}" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<span class="flag-content">
|
||||
<% if show_flag_action? comment %>
|
||||
<span class="divider"> | </span>
|
||||
<a class="button" id="flag-expand-comment-<%= comment.id %>" data-dropdown="flag-drop-comment-<%= comment.id %>" aria-controls="flag-drop-comment-<%= comment.id %>" aria-expanded="false" title="<%= t('shared.flag') %>">
|
||||
<i class="icon-flag flag-disable"></i>
|
||||
</a>
|
||||
<ul id="flag-drop-comment-<%= comment.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t("shared.flag"), flag_comment_path(comment), method: :put, remote: true, id: "flag-comment-#{comment.id}" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% if show_unflag_action? comment %>
|
||||
<span class="divider"> | </span>
|
||||
<a id="unflag-expand-comment-<%= comment.id %>" data-dropdown="unflag-drop-comment-<%= comment.id %>" aria-controls="unflag-drop-comment-<%= comment.id %>" aria-expanded="false" title="<%= t('shared.unflag') %>">
|
||||
<i class="icon-flag flag-active"></i>
|
||||
</a>
|
||||
<ul id="unflag-drop-comment-<%= comment.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t("shared.unflag"), unflag_comment_path(comment), method: :put, remote: true, id: "unflag-comment-#{comment.id}" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% if show_unflag_action? comment %>
|
||||
<span class="divider"> | </span>
|
||||
<a class="button" id="unflag-expand-comment-<%= comment.id %>" data-dropdown="unflag-drop-comment-<%= comment.id %>" aria-controls="unflag-drop-comment-<%= comment.id %>" aria-expanded="false" title="<%= t('shared.unflag') %>">
|
||||
<i class="icon-flag flag-active"></i>
|
||||
</a>
|
||||
<ul id="unflag-drop-comment-<%= comment.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t("shared.unflag"), unflag_comment_path(comment), method: :put, remote: true, id: "unflag-comment-#{comment.id}" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
<% if show_flag_action? debate %>
|
||||
<a id="flag-expand-debate-<%= debate.id %>" data-dropdown="flag-drop-debate-<%= debate.id %>" aria-controls="flag-drop-debate-<%= debate.id %>" aria-expanded="false" title="<%= t('shared.flag') %>">
|
||||
<i class="icon-flag flag-disable"></i>
|
||||
</a>
|
||||
<ul id="flag-drop-debate-<%= debate.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t('shared.flag'), flag_debate_path(debate), method: :put, remote: true, id: "flag-debate-#{ debate.id }" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<span class="flag-content">
|
||||
<% if show_flag_action? debate %>
|
||||
<a class="button" id="flag-expand-debate-<%= debate.id %>" data-dropdown="flag-drop-debate-<%= debate.id %>" aria-controls="flag-drop-debate-<%= debate.id %>" aria-expanded="false" title="<%= t('shared.flag') %>">
|
||||
<i class="icon-flag flag-disable"></i>
|
||||
</a>
|
||||
<ul id="flag-drop-debate-<%= debate.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t('shared.flag'), flag_debate_path(debate), method: :put, remote: true, id: "flag-debate-#{ debate.id }" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% if show_unflag_action? debate %>
|
||||
<a id="unflag-expand-debate-<%= debate.id %>" data-dropdown="unflag-drop-debate-<%= debate.id %>" aria-controls="unflag-drop-debate-<%= debate.id %>" aria-expanded="false" title="<%= t('shared.unflag') %>">
|
||||
<i class="icon-flag flag-active"></i>
|
||||
</a>
|
||||
<ul id="unflag-drop-debate-<%= debate.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t('shared.unflag'), unflag_debate_path(debate), method: :put, remote: true, id: "unflag-debate-#{ debate.id }" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% if show_unflag_action? debate %>
|
||||
<a class="button" id="unflag-expand-debate-<%= debate.id %>" data-dropdown="unflag-drop-debate-<%= debate.id %>" aria-controls="unflag-drop-debate-<%= debate.id %>" aria-expanded="false" title="<%= t('shared.unflag') %>">
|
||||
<i class="icon-flag flag-active"></i>
|
||||
</a>
|
||||
<ul id="unflag-drop-debate-<%= debate.id %>" class="f-dropdown" data-dropdown-content aria-hidden="true" tabindex="-1">
|
||||
<li>
|
||||
<%= link_to t('shared.unflag'), unflag_debate_path(debate), method: :put, remote: true, id: "unflag-debate-#{ debate.id }" %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
<div class="wrap row">
|
||||
<div id="debates" class="debates-list small-12 medium-9 column">
|
||||
<div class="filters">
|
||||
<div class="small-12 medium-7 column">
|
||||
<div class="small-12 medium-7 left">
|
||||
<% if @search_terms %>
|
||||
<h2 class="margin-top">
|
||||
<%= page_entries_info @debates %>
|
||||
<%= t("debates.index.search_results", count: @debates.size, search_term: @search_terms) %>
|
||||
</h2>
|
||||
<h2 class="margin-top">
|
||||
<%= page_entries_info @debates %>
|
||||
<%= t("debates.index.search_results", count: @debates.size, search_term: @search_terms) %>
|
||||
</h2>
|
||||
<% elsif @tag_filter %>
|
||||
<h2 class="margin-top">
|
||||
<%= page_entries_info @debates %>
|
||||
<%= t("debates.index.filter_topic", count: @debates.size, topic: @tag_filter) %>
|
||||
</h2>
|
||||
<h2 class="margin-top">
|
||||
<%= page_entries_info @debates %>
|
||||
<%= t("debates.index.filter_topic", count: @debates.size, topic: @tag_filter) %>
|
||||
</h2>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if @tag_filter || @search_terms %>
|
||||
@@ -28,10 +28,10 @@
|
||||
<%= t("debates.index.select_order") %>
|
||||
</h6>
|
||||
<% else %>
|
||||
<div class="small-12 column margin-top inline-block">
|
||||
<h2 class="inline-block">
|
||||
<%= t("debates.index.select_order_long") %>
|
||||
</h2>
|
||||
<div class="small-12 inline-block">
|
||||
<h2 class="inline-block">
|
||||
<%= t("debates.index.select_order_long") %>
|
||||
</h2>
|
||||
<% end %>
|
||||
<%= render 'shared/order_selector', i18n_namespace: "debates.index" %>
|
||||
</div>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<section class="subnavigation row">
|
||||
<%#= link_to t("layouts.header.welcome"), root_path %>
|
||||
<%#= link_to t("layouts.header.initiatives"), "#" %>
|
||||
<div class="small-8 column">
|
||||
<div class="small-12 medium-8 column">
|
||||
<%= link_to t("layouts.header.debates"), debates_path, class: ("active" if current_page?(controller: "/debates")) %>
|
||||
<%= link_to t("layouts.header.proposals"), proposals_path, class: ("active" if current_page?(controller: "/proposals")) %>
|
||||
<%= link_to t("layouts.header.more_information"), "/more_information", class: ("active" if current_page?("/more_information")) %>
|
||||
@@ -49,12 +49,12 @@
|
||||
</div>
|
||||
|
||||
<% if home_page? %>
|
||||
<div class="row">
|
||||
<div class="row home-page">
|
||||
<div class="small-12 medium-7 column">
|
||||
<h1><%= t("layouts.header.open_city_title") %></h1>
|
||||
<p><%= t("layouts.header.open_city_slogan") %></p>
|
||||
<%= link_to t("layouts.header.see_all_debates"), debates_path, class: "button radius" %>
|
||||
<%= link_to t("layouts.header.see_all_proposals"), proposals_path, class: "button radius" %>
|
||||
<%= link_to t("layouts.header.see_all_debates"), debates_path, class: "button radius see-more" %>
|
||||
<%= link_to t("layouts.header.see_all_proposals"), proposals_path, class: "button radius see-more" %>
|
||||
<%= link_to t("layouts.header.more_information"), "/more_information", class: "more-info" %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
<div class="small-12 medium-8 large-5 column small-centered">
|
||||
<h1>
|
||||
<%= link_to root_path do %>
|
||||
<%= image_tag("auth_logo.png", class: "left", size: "450x96", alt: t('layouts.header.logo')) %>
|
||||
<%= image_tag('header_logo_madrid.png', class: 'show-for-medium-up left', size: '96x96') %>
|
||||
<%= t("layouts.header.open_gov", open: "#{t('layouts.header.open')}").html_safe %>
|
||||
<% end %>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
|
||||
<%= f.fields_for :organization do |fo| %>
|
||||
<%= fo.text_field :name, autofocus: true, maxlength: Organization.name_max_length, placeholder: t("devise_views.organizations.registrations.new.organization_name_label") %>
|
||||
<%= fo.label t("devise_views.organizations.registrations.new.responsible_name_label") %>
|
||||
<span class="note"><%= t("devise_views.organizations.registrations.new.responsible_name_note") %></span>
|
||||
<%= fo.text_field :responsible_name, maxlength: Organization.responsible_name_max_length, label: false %>
|
||||
<% end %>
|
||||
|
||||
<%= f.email_field :email, placeholder: t("devise_views.organizations.registrations.new.email_label") %>
|
||||
<%= f.email_field :email, placeholder: t("devise_views.organizations.registrations.new.email_label") %>
|
||||
|
||||
<%= f.text_field :phone_number, placeholder: t("devise_views.organizations.registrations.new.phone_number_label") %>
|
||||
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
<div class="auth row">
|
||||
<div class="small-12 medium-8 column small-centered">
|
||||
<div class="panel">
|
||||
<h2><%= t("devise_views.organizations.registrations.success.title") %></h2>
|
||||
<p><%= t("devise_views.organizations.registrations.success.thank_you_html") %></p>
|
||||
<p><%= t("devise_views.organizations.registrations.success.instructions_1_html") %></p>
|
||||
<p><%= t("devise_views.organizations.registrations.success.instructions_2_html") %></p>
|
||||
<p><%= t("devise_views.organizations.registrations.success.instructions_3_html") %></p>
|
||||
<p>
|
||||
<%= link_to t("devise_views.organizations.registrations.success.back_to_index"),
|
||||
root_path, class: "button radius small margin-top" %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2><%= t("devise_views.organizations.registrations.success.title") %></h2>
|
||||
<p><%= t("devise_views.organizations.registrations.success.thank_you_html") %></p>
|
||||
<p><%= t("devise_views.organizations.registrations.success.instructions_1_html") %></p>
|
||||
<p><%= t("devise_views.organizations.registrations.success.instructions_2_html") %></p>
|
||||
<p><%= t("devise_views.organizations.registrations.success.instructions_3_html") %></p>
|
||||
<p>
|
||||
<%= link_to t("devise_views.organizations.registrations.success.back_to_index"),
|
||||
root_path, class: "button radius small margin-top expand" %>
|
||||
</p>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<p><%= t("welcome.welcome.instructions_3_html") %></p>
|
||||
<p>
|
||||
<%= link_to t("welcome.welcome.verify_account"),
|
||||
verification_path, class: "button large success radius margin-top expand" %>
|
||||
verification_path, class: "button success radius margin-top expand" %>
|
||||
</p>
|
||||
<p class="text-center">
|
||||
<%= link_to t("welcome.welcome.go_to_index"),
|
||||
|
||||
@@ -6,7 +6,6 @@ def deploysecret(key)
|
||||
@deploy_secrets_yml.fetch(key.to_s, 'undefined')
|
||||
end
|
||||
|
||||
|
||||
set :rails_env, fetch(:stage)
|
||||
set :rvm_ruby_version, '2.2.3'
|
||||
set :rvm_type, :user
|
||||
@@ -47,6 +46,8 @@ set(:config_files, %w(
|
||||
sidekiq.yml
|
||||
))
|
||||
|
||||
set :whenever_roles, -> { :cron }
|
||||
|
||||
namespace :deploy do
|
||||
# Check right version of deploy branch
|
||||
# before :deploy, "deploy:check_revision"
|
||||
|
||||
@@ -6,5 +6,5 @@ set :ssh_options, port: deploysecret(:ssh_port)
|
||||
set :stage, :preproduction
|
||||
set :rails_env, :preproduction
|
||||
|
||||
server deploysecret(:server1), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
server deploysecret(:server1), user: deploysecret(:user), roles: %w(web app db importer cron)
|
||||
server deploysecret(:server2), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
|
||||
@@ -7,6 +7,6 @@ set :stage, :production
|
||||
set :rails_env, :production
|
||||
|
||||
#server deploysecret(:server1), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
server deploysecret(:server2), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
server deploysecret(:server2), user: deploysecret(:user), roles: %w(web app db importer cron)
|
||||
server deploysecret(:server3), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
server deploysecret(:server4), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
|
||||
@@ -6,6 +6,6 @@ set :ssh_options, port: deploysecret(:ssh_port)
|
||||
set :stage, :staging
|
||||
set :rails_env, :staging
|
||||
|
||||
server deploysecret(:server), user: deploysecret(:user), roles: %w(web app db importer)
|
||||
server deploysecret(:server), user: deploysecret(:user), roles: %w(web app db importer cron)
|
||||
|
||||
|
||||
|
||||
@@ -31,3 +31,4 @@ en:
|
||||
official_level: Official level
|
||||
organization:
|
||||
name: Organization name
|
||||
responsible_name: Person in charge
|
||||
|
||||
@@ -52,3 +52,4 @@ es:
|
||||
official_level: Nivel del cargo
|
||||
organization:
|
||||
name: Nombre de organización
|
||||
responsible_name: Persona responsable del colectivo
|
||||
|
||||
@@ -3,7 +3,7 @@ en:
|
||||
confirmations:
|
||||
title: "Resend confirmation instructions"
|
||||
email_label: Email
|
||||
submit: "Resend confirmation instructions"
|
||||
submit: "Resend confirmation"
|
||||
mailer:
|
||||
confirmation_instructions:
|
||||
title: "Welcome to open government portal"
|
||||
@@ -37,7 +37,7 @@ en:
|
||||
new:
|
||||
title: "Forgot your password?"
|
||||
email_label: "Email"
|
||||
send_submit: "Send me reset password instructions"
|
||||
send_submit: "Send me reset password"
|
||||
users:
|
||||
registrations:
|
||||
edit:
|
||||
@@ -74,6 +74,8 @@ en:
|
||||
new:
|
||||
title: "Sign up as organization / collective"
|
||||
organization_name_label: "Organization name"
|
||||
responsible_name_label: "Name and surname of the person in charge"
|
||||
responsible_name_note: "The responsible representative of the organization"
|
||||
email_label: "Email"
|
||||
password_label: "Password"
|
||||
phone_number_label: "Phone number"
|
||||
|
||||
@@ -3,7 +3,7 @@ es:
|
||||
confirmations:
|
||||
title: "Reenviar instrucciones de confirmación"
|
||||
email_label: Email
|
||||
submit: "Reenviar instrucciones de confirmación"
|
||||
submit: "Reenviar instrucciones"
|
||||
mailer:
|
||||
confirmation_instructions:
|
||||
title: "Te damos la bienvenida al Portal de Gobierno Abierto del Ayuntamiento de Madrid"
|
||||
@@ -37,7 +37,7 @@ es:
|
||||
new:
|
||||
title: "¿Has olvidado tu contraseña?"
|
||||
email_label: "Email"
|
||||
send_submit: "Recibir instrucciones para recuperar mi contraseña"
|
||||
send_submit: "Recibir instrucciones"
|
||||
users:
|
||||
registrations:
|
||||
edit:
|
||||
@@ -74,6 +74,8 @@ es:
|
||||
new:
|
||||
title: "Registrarse como organización / colectivo"
|
||||
organization_name_label: "Nombre de la organización"
|
||||
responsible_name_label: "Nombre y apellidos de la persona responsable del colectivo"
|
||||
responsible_name_note: "Será la persona representante de la asociación/colectivo en cuyo nombre se presenten las propuestas"
|
||||
email_label: "Email"
|
||||
password_label: "Contraseña"
|
||||
phone_number_label: "Teléfono"
|
||||
|
||||
@@ -10,7 +10,6 @@ en:
|
||||
external_link_blog_url: "/blog"
|
||||
open_gov: "%{open} government"
|
||||
open: "Open"
|
||||
logo: "Open government | Participation"
|
||||
participation: Participation
|
||||
open_city_title: "The city you want, it will be the city you want."
|
||||
open_city_slogan:
|
||||
@@ -273,6 +272,7 @@ en:
|
||||
username_label: "Username"
|
||||
phone_number_label: "Phone number"
|
||||
organization_name_label: "Organization name"
|
||||
organization_responsible_name_placeholder: "The responsible representative of the organization"
|
||||
notifications: Notifications
|
||||
finish_verification: "Finish verification"
|
||||
verified_account: Verified account
|
||||
|
||||
@@ -10,7 +10,6 @@ es:
|
||||
external_link_blog_url: "/blog"
|
||||
open_gov: "Gobierno %{open}"
|
||||
open: "abierto"
|
||||
logo: "Gobierno abierto | Participación"
|
||||
participation: Participación
|
||||
open_city_title: "La ciudad que quieres será la ciudad que quieras."
|
||||
open_city_slogan:
|
||||
@@ -273,6 +272,7 @@ es:
|
||||
username_label: "Nombre de usuario"
|
||||
phone_number_label: "Teléfono"
|
||||
organization_name_label: "Nombre de la organización"
|
||||
organization_responsible_name_placeholder: "Representante de la asociación/colectivo"
|
||||
notifications: Notificaciones
|
||||
finish_verification: "Finalizar verificación"
|
||||
verified_account: Cuenta verificada
|
||||
@@ -310,7 +310,7 @@ es:
|
||||
instructions_3_html: "Sin verificar tus datos <b>el acceso que tienes es limitado</b>. Verificarlos ahora te permitirá, por ejemplo, apoyar propuestas ciudadanas."
|
||||
verify_account: "Verificar mi cuenta"
|
||||
go_to_index: "Quiero entrar como un usuario no verificado (acceso limitado)"
|
||||
instructions_4_html: "Si quieres verificarte más tarde, puedes hacerlo en <i>Mi cuenta -> Verificar mi cuenta</i>."
|
||||
instructions_4_html: "Si quieres verificarte más tarde, puedes hacerlo en <i>Mi cuenta > Verificar mi cuenta</i>."
|
||||
omniauth:
|
||||
finish_signup:
|
||||
title: Añade tu email
|
||||
|
||||
24
config/schedule.rb
Normal file
24
config/schedule.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
# Use this file to easily define all of your cron jobs.
|
||||
#
|
||||
# It's helpful, but not entirely necessary to understand cron before proceeding.
|
||||
# http://en.wikipedia.org/wiki/Cron
|
||||
|
||||
# Example:
|
||||
#
|
||||
# set :output, "/path/to/my/cron_log.log"
|
||||
#
|
||||
# every 2.hours do
|
||||
# command "/usr/bin/some_great_command"
|
||||
# runner "MyModel.some_method"
|
||||
# rake "some:great:rake:task"
|
||||
# end
|
||||
#
|
||||
# every 4.days do
|
||||
# runner "AnotherModel.prune_old_records"
|
||||
# end
|
||||
|
||||
# Learn more: http://github.com/javan/whenever
|
||||
|
||||
every 1.minute do
|
||||
command "date > ~/cron-test.txt"
|
||||
end
|
||||
@@ -29,7 +29,8 @@ moderator.create_moderator
|
||||
(1..10).each do |i|
|
||||
org_name = Faker::Company.name
|
||||
org_user = create_user("org#{i}@madrid.es", org_name)
|
||||
org = org_user.create_organization(name: org_name)
|
||||
org_responsible_name = Faker::Name.name
|
||||
org = org_user.create_organization(name: org_name, responsible_name: org_responsible_name)
|
||||
|
||||
verified = [true, false].sample
|
||||
if verified then
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class AddResponsibleNameToOrganizations < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :organizations, :responsible_name, :string, limit: 60
|
||||
|
||||
Organization.find_each do |org|
|
||||
org.update(responsible_name: org.name) if org.responsible_name.blank?
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :organizations, :responsible_name
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150911171301) do
|
||||
ActiveRecord::Schema.define(version: 20150912145218) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -180,9 +180,10 @@ ActiveRecord::Schema.define(version: 20150911171301) do
|
||||
|
||||
create_table "organizations", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.string "name", limit: 60
|
||||
t.string "name", limit: 60
|
||||
t.datetime "verified_at"
|
||||
t.datetime "rejected_at"
|
||||
t.string "responsible_name", limit: 60
|
||||
end
|
||||
|
||||
add_index "organizations", ["user_id"], name: "index_organizations_on_user_id", using: :btree
|
||||
|
||||
@@ -191,6 +191,7 @@ FactoryGirl.define do
|
||||
|
||||
factory :organization do
|
||||
user
|
||||
responsible_name "Johnny Utah"
|
||||
sequence(:name) { |n| "org#{n}" }
|
||||
|
||||
trait :verified do
|
||||
|
||||
@@ -9,6 +9,7 @@ feature 'Organizations' do
|
||||
visit new_organization_registration_path
|
||||
|
||||
fill_in 'user_organization_attributes_name', with: 'Greenpeace'
|
||||
fill_in 'user_organization_attributes_responsible_name', with: 'Dorothy Stowe'
|
||||
fill_in 'user_email', with: 'green@peace.com'
|
||||
fill_in 'user_password', with: 'greenpeace'
|
||||
fill_in 'user_password_confirmation', with: 'greenpeace'
|
||||
|
||||
@@ -176,7 +176,7 @@ feature 'Users' do
|
||||
click_link 'Forgot your password?'
|
||||
|
||||
fill_in 'user_email', with: 'manuela@madrid.es'
|
||||
click_button 'Send me reset password instructions'
|
||||
click_button 'Send me reset password'
|
||||
|
||||
expect(page).to have_content "You will receive an email with instructions on how to reset your password in a few minutes."
|
||||
|
||||
|
||||
@@ -2,6 +2,16 @@ require 'rails_helper'
|
||||
|
||||
feature 'Verification path' do
|
||||
|
||||
scenario "User is an organization" do
|
||||
user = create(:user, verified_at: Time.now)
|
||||
create(:organization, user: user)
|
||||
|
||||
login_as(user)
|
||||
visit verification_path
|
||||
|
||||
expect(current_path).to eq account_path
|
||||
end
|
||||
|
||||
scenario "User is verified" do
|
||||
user = create(:user, verified_at: Time.now)
|
||||
|
||||
|
||||
@@ -161,11 +161,12 @@ describe User do
|
||||
end
|
||||
|
||||
describe "organization_attributes" do
|
||||
before(:each) { subject.organization_attributes = {name: 'org'} }
|
||||
before(:each) { subject.organization_attributes = {name: 'org', responsible_name: 'julia'} }
|
||||
|
||||
it "triggers the creation of an associated organization" do
|
||||
expect(subject.organization).to be
|
||||
expect(subject.organization.name).to eq('org')
|
||||
expect(subject.organization.responsible_name).to eq('julia')
|
||||
end
|
||||
|
||||
it "deactivates the validation of username, and activates the validation of organization" do
|
||||
|
||||
@@ -41,7 +41,7 @@ module CommonActions
|
||||
click_link 'Forgot your password?'
|
||||
|
||||
fill_in 'user_email', with: 'manuela@madrid.es'
|
||||
click_button 'Send me reset password instructions'
|
||||
click_button 'Send me reset password'
|
||||
end
|
||||
|
||||
def comment_on(debate, user = nil)
|
||||
|
||||
Reference in New Issue
Block a user