Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmorenoh committed May 17, 2021
2 parents 5c92866 + c26ffbc commit b0f9fa1
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ gem "devise-async", "~> 1.0.0"
gem "devise_security_extension", git: "https://github.com/phatworx/devise_security_extension.git" #, "~> 0.10"
gem "foundation-rails", "~> 6.4.3.0"
gem "foundation_rails_helper", "~> 2.0.0"
gem "globalize", "~> 5.2.0"
gem "globalize", "5.2.0"
gem "globalize-accessors", "~> 0.2.1"
gem "graphiql-rails", "~> 1.4.1"
gem "graphql", "~> 1.7.8"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ DEPENDENCIES
faker (~> 1.8.7)
foundation-rails (~> 6.4.3.0)
foundation_rails_helper (~> 2.0.0)
globalize (~> 5.2.0)
globalize (= 5.2.0)
globalize-accessors (~> 0.2.1)
graphiql-rails (~> 1.4.1)
graphql (~> 1.7.8)
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/admin/budget_groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ def destroy

def load_budget
@budget = Budget.find_by_slug_or_id! params[:budget_id]
rescue
@budget = nil
end

def load_group
@group = @budget.groups.find_by_slug_or_id! params[:id]
rescue
@group = nil
end

def groups_index
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def set_locale
session[:locale] = params[:locale]
end

session[:locale] ||= I18n.default_locale
session[:locale] ||= :es

locale = session[:locale]

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/budgets/groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def load_budget

def load_group
@group = @budget.groups.find_by_slug_or_id! params[:id]
rescue
@group = nil
end

end
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/budgets/investments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ def investment_params

def load_investment
@investment = @budget.investments.find(params["id"])
rescue
@investment = nil
end

def load_ballot
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/management/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def set_locale
session[:locale] = params[:locale]
end

session[:locale] ||= I18n.default_locale
session[:locale] ||= :es

I18n.locale = session[:locale]
Globalize.locale = I18n.locale
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/topics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def load_community

def load_topic
@topic = Topic.find(params[:id])
rescue
@topic = nil
end

def load_rank
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def proposal_notification_digest(user, notifications)
def user_invite(email)
@email_to = email

I18n.with_locale(I18n.default_locale) do
I18n.with_locale(:es) do
mail(to: @email_to, subject: t("mailers.user_invite.subject", org_name: Setting["org_name"]))
end
end
Expand Down
2 changes: 2 additions & 0 deletions app/models/concerns/sluggable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def self.find_by_slug_or_id(slug_or_id)

def self.find_by_slug_or_id!(slug_or_id)
find_by_slug(slug_or_id) || find(slug_or_id)
rescue
find(slug_or_id)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/site_customization/content_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class SiteCustomization::ContentBlock < ApplicationRecord
validates :name, presence: true, uniqueness: { scope: :locale }, inclusion: { in: VALID_BLOCKS }

def self.block_for(name, locale)
locale ||= I18n.default_locale
locale ||= :es
find_by(name: name, locale: locale).try(:body)
end
end
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def email_required?
end

def locale
self[:locale] ||= I18n.default_locale.to_s
self[:locale] ||= :es.to_s
end

def confirmation_required?
Expand Down
2 changes: 1 addition & 1 deletion app/views/communities/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

<div class="small-12 medium-9 column">
<div id="topics" class="topics-list">
<%= link_to content_tag(:span, nil, class: "icon-angle-left") + "Volver", borought_debates_path(geozone: Proposal.find_by(community_id: @community.id).geozone_id) %>
<%= link_to content_tag(:span, nil, class: "icon-angle-left") + "Volver", borought_debates_path(geozone: Proposal.find_by(community_id: @community.id).try(:geozone_id)) %>
<%= render "topics/topics", topics: @topics %>
</div>
<%= paginate @topics %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/custom/proposals/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div id="<%= dom_id(@proposal) unless @proposal.blank? %>" class="row">
<div class="small-12 medium-9 column">
<%unless params[:author_id].blank? %>
<%= back_link_to user_path(current_user) %>
<%= back_link_to user_path(current_user) if !current_user.blank? %>
<div style="float:right">
<%if @proposal.previous(params[:author_id]) %>
<%= link_to proposal_path(@proposal.previous(params[:author_id]), author_id: params[:author_id]) do %>
Expand Down
4 changes: 3 additions & 1 deletion config/initializers/globalize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ module InstanceMethods
def save(*)
# Credit for this code belongs to Jack Tomaszewski:
# https://github.com/globalize/globalize/pull/578
Globalize.with_locale(Globalize.locale || I18n.default_locale) do
Globalize.with_locale(Globalize.locale || :es) do
super
end
rescue
super
end
end
end
Expand Down
5 changes: 0 additions & 5 deletions db/migrate/20210511081034_change_column_name_users.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
require "selenium/webdriver"

Rails.application.load_tasks if Rake::Task.tasks.empty?
I18n.default_locale = :en
I18n.default_locale = :es

include Warden::Test::Helpers
Warden.test_mode!
Expand Down

0 comments on commit b0f9fa1

Please sign in to comment.