Skip to content

Commit

Permalink
Merge pull request #477 from coopdevs/develop
Browse files Browse the repository at this point in the history
Release v1.12.0
  • Loading branch information
enricostano authored Mar 14, 2019
2 parents 937b3a2 + d0f2bbf commit 274a4cd
Show file tree
Hide file tree
Showing 16 changed files with 717 additions and 79 deletions.
13 changes: 7 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,23 @@ group :development do
gem 'airbrussh', require: false
gem 'localeapp', '2.1.1', require: false
gem 'letter_opener', '1.4.1'
gem 'dotenv-rails', '2.5.0'
gem 'dotenv-rails', '~> 2.7.1'
end

group :development, :test do
gem "rspec-rails", '~> 3.7.2'
gem "byebug"
end

group :test do
gem "rspec-rails", '~> 3.8.2'
gem "database_cleaner", '1.6.2'
gem 'shoulda-matchers', '~> 3.1.2'
gem 'fabrication'
gem 'faker'
gem 'capybara', '~> 2.7'
gem 'capybara-selenium', '~> 0.0.6'
gem 'chromedriver-helper', '~> 1.0'
gem 'faker', '~> 1.9'
gem 'capybara', '~> 3.13'
gem 'selenium-webdriver', '~> 3.141'
gem 'chromedriver-helper', '~> 2.1'
gem 'simplecov', '~> 0.16.1', require: false
end

group :production do
Expand Down
80 changes: 43 additions & 37 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,17 @@ GEM
capistrano-rbenv (2.1.3)
capistrano (~> 3.1)
sshkit (~> 1.3)
capybara (2.18.0)
capybara (3.13.2)
addressable
mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0, < 4.0)
capybara-selenium (0.0.6)
capybara
selenium-webdriver
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
xpath (~> 3.2)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (1.2.0)
chromedriver-helper (2.1.0)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
chronic (0.10.2)
Expand All @@ -124,12 +122,13 @@ GEM
responders
warden (~> 1.2.3)
diff-lcs (1.3)
docile (1.3.1)
domain_name (0.5.20170223)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.5.0)
dotenv-rails (2.5.0)
dotenv (= 2.5.0)
railties (>= 3.2, < 6.0)
dotenv (2.7.1)
dotenv-rails (2.7.1)
dotenv (= 2.7.1)
railties (>= 3.2, < 6.1)
elasticsearch (1.0.8)
elasticsearch-api (= 1.0.7)
elasticsearch-transport (= 1.0.7)
Expand All @@ -149,11 +148,11 @@ GEM
tzinfo
execjs (2.6.0)
fabrication (2.11.3)
faker (1.4.3)
i18n (~> 0.5)
faker (1.9.3)
i18n (>= 0.7)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
ffi (1.9.25)
ffi (1.10.0)
formtastic (3.1.5)
actionpack (>= 3.2.13)
formtastic_i18n (0.6.0)
Expand Down Expand Up @@ -288,6 +287,7 @@ GEM
polyamorous (~> 1.3.2)
rdiscount (2.1.7.1)
redis (4.0.1)
regexp_parser (1.3.0)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
Expand All @@ -297,23 +297,23 @@ GEM
netrc (~> 0.8)
rollbar (2.8.3)
multi_json
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-rails (3.7.2)
rspec-support (~> 3.8.0)
rspec-rails (3.8.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.52.1)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
Expand All @@ -334,9 +334,9 @@ GEM
tilt (>= 1.1, < 3)
select2-rails (4.0.1)
thor (~> 0.14)
selenium-webdriver (3.11.0)
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
rubyzip (~> 1.2, >= 1.2.2)
shoulda-matchers (3.1.2)
activesupport (>= 4.0.0)
sidekiq (5.1.3)
Expand All @@ -350,6 +350,11 @@ GEM
simple_form (3.1.0)
actionpack (~> 4.0)
activemodel (~> 4.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
skylight (2.0.1)
skylight-core (= 2.0.1)
skylight-core (2.0.1)
Expand Down Expand Up @@ -390,7 +395,7 @@ GEM
sprockets-rails (>= 2.0, < 4.0)
whenever (0.9.4)
chronic (>= 0.6.3)
xpath (3.0.0)
xpath (3.2.0)
nokogiri (~> 1.8)

PLATFORMS
Expand All @@ -406,18 +411,17 @@ DEPENDENCIES
capistrano (~> 3.1)
capistrano-rails (~> 1.1)
capistrano-rbenv (~> 2.1)
capybara (~> 2.7)
capybara-selenium (~> 0.0.6)
chromedriver-helper (~> 1.0)
capybara (~> 3.13)
chromedriver-helper (~> 2.1)
coffee-rails
dalli
database_cleaner (= 1.6.2)
devise (~> 4.5.0)
dotenv-rails (= 2.5.0)
dotenv-rails (~> 2.7.1)
elasticsearch-model
elasticsearch-rails
fabrication
faker
faker (~> 1.9)
has_scope
hstore_translate
http_accept_language (~> 2.1.1)
Expand All @@ -434,15 +438,17 @@ DEPENDENCIES
rails_12factor (= 0.0.3)
rdiscount
rollbar (= 2.8.3)
rspec-rails (~> 3.7.2)
rspec-rails (~> 3.8.2)
rubocop (~> 0.52.1)
rufus-scheduler (~> 3.4.2)
sass-rails (~> 5.0.7)
select2-rails
selenium-webdriver (~> 3.141)
shoulda-matchers (~> 3.1.2)
sidekiq (= 5.1.3)
sidekiq-cron (= 0.6.3)
simple_form (>= 3.0.0)
simplecov (~> 0.16.1)
skylight
uglifier (= 2.7.2)
unicorn
Expand Down
Binary file added app/assets/images/redeira.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 5 additions & 15 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class ApplicationController < ActionController::Base
before_filter :configure_permitted_parameters, if: :devise_controller?
before_filter :set_locale
before_filter :set_current_organization
after_filter :store_location

rescue_from MissingTOSAcceptance, OutadedTOSAcceptance do
redirect_to terms_path
Expand All @@ -21,7 +20,11 @@ class ApplicationController < ActionController::Base

helper_method :current_organization, :admin?, :superadmin?

protected
def switch_lang
redirect_to :back
end

private

def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
Expand All @@ -35,17 +38,6 @@ def set_current_organization
end
end

def store_location
# store last url - this is needed for post-login redirect to whatever the
# user last visited.
return unless request.get?
paths = ["/", "/users/sign_in", "/users/sign_up", "/users/password/new",
"/users/password/edit", "/users/confirmation", "/users/sign_out"]
if !paths.include?(request.path) && !request.xhr?
session[:previous_url] = request.fullpath
end
end

def after_sign_in_path_for(user)
if user.members.present?
users_path
Expand All @@ -54,8 +46,6 @@ def after_sign_in_path_for(user)
end
end

private

def check_for_terms_acceptance!
if user_signed_in?
accepted = current_user.terms_accepted_at
Expand Down
5 changes: 0 additions & 5 deletions app/controllers/global_controller.rb

This file was deleted.

17 changes: 17 additions & 0 deletions app/helpers/brand_logo_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module BrandLogoHelper
def render_brand_logo
return unless should_render_logo?
render 'application/brand_logo'
end

private

def should_render_logo?
return false unless current_user
current_organization&.id == branded_organization_id
end

def branded_organization_id
Rails.application.config.branded_organization_id
end
end
3 changes: 3 additions & 0 deletions app/views/application/_brand_logo.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="container" style="margin-bottom: 30px">
<%= image_tag("redeira.png", class: 'organization-brand-logo img-responsive center-block') %>
</div>
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
</div>
</div>

<%= render_brand_logo %>
<%= render 'application/footer' %>

<div class="back-overlay"></div>
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Application < Rails::Application
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.default_locale = :es
config.i18n.available_locales = [:es, :ca, :eu, :en, :'pt-BR']
config.i18n.available_locales = [:es, :ca, :eu, :gl, :en, :'pt-BR']
config.i18n.fallbacks = true

# Do not swallow errors in after_commit/after_rollback callbacks.
Expand Down
7 changes: 7 additions & 0 deletions config/initializers/branded_organization.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DEFAULT_BRANDED_ORG_ID = 246

Rails.application.config.branded_organization_id = nil

unless Rails.env.test?
Rails.application.config.branded_organization_id = (Redis.current.get('branded_organization_id') || DEFAULT_BRANDED_ORG_ID).to_i
end
Loading

0 comments on commit 274a4cd

Please sign in to comment.