Skip to content

Commit

Permalink
Apply changes from VPS
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreMesure committed Nov 8, 2019
1 parent 9bcc426 commit 8ef2e1d
Show file tree
Hide file tree
Showing 17 changed files with 167 additions and 29 deletions.
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
GIT
remote: https://github.com/halfdan/piwik-ruby-tracking.git
revision: 5c733bd0d4deaef1f72dbfe8c9e305ddf3bca52a
specs:
piwik_analytics (2.0.0)
actionpack
activesupport
rails (>= 3.0.0)

GIT
remote: https://github.com/phatworx/devise_security_extension.git
revision: b2ee978af7d49f0fb0e7271c6ac074dfb4d39353
Expand Down Expand Up @@ -657,6 +666,7 @@ DEPENDENCIES
paranoia (~> 2.4.2)
pg (~> 0.21.0)
pg_search (~> 2.0.1)
piwik_analytics!
puma (~> 4.2.1)
rack-attack (~> 5.4.2)
rails (= 5.0.7.2)
Expand Down
2 changes: 2 additions & 0 deletions Gemfile_custom
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ group :staging, :production do
gem "heroku-deflater", "~> 0.6.3"
end

gem 'piwik_analytics', git: "https://github.com/halfdan/piwik-ruby-tracking.git"

gem "rack-attack", "~> 5.4.2"

ruby "2.4.9"
Binary file added app/assets/images/custom/consul_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/custom/logo_digidem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
// * English: https://github.com/consul/consul/blob/master/CUSTOMIZE_EN.md#css
// * Spanish: https://github.com/consul/consul/blob/master/CUSTOMIZE_ES.md#css
//

.footer-sections {
padding-bottom: 1rem;
}
91 changes: 91 additions & 0 deletions app/views/custom/_footer.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<footer>
<div class="row">
<div class="small-12 large-4 column">
<h1 class="logo">
<%= link_to(t("layouts.footer.consul_url"), target: "blank", rel: "nofollow") do %>
<%= image_tag(image_path_for("consul_logo.png"), class: "float-left", alt: t("layouts.header.logo")) %>
<% end %>
</h1>

<p class="info">
<%= t("layouts.footer.description",
open_source: link_to(t("layouts.footer.open_source"), t("layouts.footer.open_source_url"), target: "blank", rel: "nofollow"),
consul: link_to(t("layouts.footer.consul"), t("layouts.footer.consul_url"), target: "blank", rel: "nofollow")).html_safe
%>
<%= link_to("Digidem Lab", "https://digidemlab.org", target: "blank", rel: "nofollow") %>
</p>
</div>

<div class="footer-sections small-12 large-8 column">
<div>
<%= link_to("https://digidemlab.org", target: "blank", rel: "nofollow") do %>
<%= image_tag(image_path_for("logo_digidem.png"), class: "float-right", alt: t("layouts.header.logo")) %>
<% end %>
</div>
</div>
</div>

<div class="subfooter row">
<div class="small-12 medium-8 column">
<%= t("layouts.footer.copyright", year: Time.current.year) %>&nbsp;|
<ul class="no-bullet inline-block">
<li class="inline-block"><%= link_to t("layouts.footer.privacy"), page_path("privacy") %>&nbsp;|</li>
<li class="inline-block"><%= link_to t("layouts.footer.conditions"), page_path("conditions") %>&nbsp;|</li>
<li class="inline-block"><%= link_to t("layouts.footer.accessibility"), page_path("accessibility") %></li>
</ul>
</div>

<div class="small-12 medium-4 column social">
<div class="text-right">
<ul>
<% if setting["twitter_handle"] %>
<li class="inline-block">
<%= link_to "https://twitter.com/#{setting["twitter_handle"]}", target: "_blank",
title: t("shared.go_to_page") + t("social.twitter", org: setting["org_name"]) + t("shared.target_blank") do %>
<span class="show-for-sr"><%= t("social.twitter", org: setting["org_name"]) %></span>
<span class="icon-twitter" aria-hidden="true"></span>
<% end %>
</li>
<% end %>
<% if setting["facebook_handle"] %>
<li class="inline-block">
<%= link_to "https://www.facebook.com/#{setting["facebook_handle"]}/", target: "_blank",
title: t("shared.go_to_page") + t("social.facebook", org: setting["org_name"]) + t("shared.target_blank") do %>
<span class="show-for-sr"><%= t("social.facebook", org: setting["org_name"]) %></span>
<span class="icon-facebook" aria-hidden="true"></span>
<% end %>
</li>
<% end %>
<% if setting["youtube_handle"] %>
<li class="inline-block">
<%= link_to "https://www.youtube.com/#{setting["youtube_handle"]}", target: "_blank",
title: t("shared.go_to_page") + t("social.youtube", org: setting["org_name"]) + t("shared.target_blank") do %>
<span class="show-for-sr"><%= t("social.youtube", org: setting["org_name"]) %></span>
<span class="icon-youtube" aria-hidden="true"></span>
<% end %>
</li>
<% end %>
<% if setting["telegram_handle"] %>
<li class="inline-block">
<%= link_to "https://www.telegram.me/#{setting["telegram_handle"]}", target: "_blank",
title: t("shared.go_to_page") + t("social.telegram", org: setting["org_name"]) + t("shared.target_blank") do %>
<span class="show-for-sr"><%= t("social.telegram", org: setting["org_name"]) %></span>
<span class="icon-telegram" aria-hidden="true"></span>
<% end %>
</li>
<% end %>
<% if setting["instagram_handle"] %>
<li class="inline-block">
<%= link_to "https://www.instagram.com/#{setting["instagram_handle"]}", target: "_blank",
title: t("shared.go_to_page") + t("social.instagram", org: setting["org_name"]) + t("shared.target_blank") do %>
<span class="show-for-sr"><%= t("social.instagram", org: setting["org_name"]) %></span>
<span class="icon-instagram" aria-hidden="true"></span>
<% end %>
</li>
<% end %>
<%= raw content_block("footer", I18n.locale) %>
</ul>
</div>
</div>
</div>
</footer>
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<%= content_for :social_media_meta_tags %>

<%= raw setting["html.per_page_code_head"] %>
<%= piwik_tracking_tag %>
</head>
<body class="<%= yield (:body_class) %>">
<%= raw setting["html.per_page_code_body"] %>
Expand Down
12 changes: 3 additions & 9 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,14 @@ class Application < Rails::Application

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :en
config.i18n.default_locale = :sv
available_locales = [
"sv",
"en",
"de",
"es",
"fr"
"en"
]
config.i18n.available_locales = available_locales
config.i18n.fallbacks = {
'sv' => 'en',
'de' => 'en',
'es' => 'en',
'fr' => 'en',
'sv' => 'en'
}

config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**[^custom]*", "*.{rb,yml}")]
Expand Down
5 changes: 4 additions & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ development: &development
# The staging, preproduction and production dbs are only needed
# for running rake assets:precompile locally before deploying
staging:
<<: *default
url: <%= ENV['DATABASE_URL'] %>

preproduction:
<<: *development
<<: *default
url: <%= ENV['DATABASE_URL'] %>

production:
<<: *default
url: <%= ENV['DATABASE_URL'] %>

test:
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = false
config.force_ssl = true

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
Expand Down
12 changes: 6 additions & 6 deletions config/locales/en/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ en:
footer:
accessibility: Accessibility
conditions: Terms and conditions of use
consul: CONSUL application
consul_url: https://github.com/consul/consul
contact_us: For technical assistance visit
copyright: CONSUL, %{year}
description: This portal uses the %{consul} which is %{open_source}.
consul: CONSUL
consul_url: http://consulproject.org/en/
contact_us: Digidem Lab
copyright: Göteborgs stad & Digidem Lab, %{year}
description: This portal uses %{consul} which is %{open_source}. Do you want to use CONSUL in your city? Contact
open_source: open-source software
open_source_url: http://www.gnu.org/licenses/agpl-3.0.html
open_source_url: https://github.com/digidemlab/consul
participation_text: Decide how to shape the city you want to live in.
participation_title: Participation
privacy: Privacy Policy
Expand Down
14 changes: 7 additions & 7 deletions config/locales/sv-SE/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,17 @@ sv:
other: "Stöd"
footer:
accessibility: Tillgänglighet
conditions: användarvillkoren
conditions: Användarvillkoren
consul: CONSUL
consul_url: https://github.com/consul/consul
contact_us: För teknisk support gå till
copyright: CONSUL, %{year}
description: Den här webbplatsen använder %{consul} som är %{open_source}.
consul_url: http://consulproject.org/en/
contact_us: Digidem Lab
copyright: Göteborgs stad & Digidem Lab, %{year}
description: Den här webbplatsen använder %{consul} som är %{open_source}. Vill du använda CONSUL i din stad? Kontakta
open_source: en plattform med öppen källkod
open_source_url: http://www.gnu.org/licenses/agpl-3.0.html
open_source_url: https://github.com/digidemlab/consul
participation_text: Skapa den stad du vill ha.
participation_title: Deltagande
privacy: sekretesspolicyn
privacy: Sekretesspolicyn
header:
administration_menu: Admin
administration: Administration
Expand Down
29 changes: 29 additions & 0 deletions config/piwik.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
production:
piwik:
id_site: <%= ENV["MATOMO_SITE_ID"] %>
url: matomo.digidemlab.org
disabled: <%= ENV["MATOMO_SITE_ID"].blank? %>

preproduction:
piwik:
id_site: <%= ENV["MATOMO_SITE_ID"] %>
url: matomo.digidemlab.org
disabled: <%= ENV["MATOMO_SITE_ID"].blank? %>

staging:
piwik:
id_site: <%= ENV["MATOMO_SITE_ID"] %>
url: matomo.digidemlab.org
disabled: <%= ENV["MATOMO_SITE_ID"].blank? %>

test:
piwik:
id_site: <%= ENV["MATOMO_SITE_ID"] %>
url: matomo.digidemlab.org
disabled: true

development:
piwik:
id_site: <%= ENV["MATOMO_SITE_ID"] %>
url: matomo.digidemlab.org
disabled: true
2 changes: 1 addition & 1 deletion config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
workers ENV.fetch("WEB_CONCURRENCY") { 2 }

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
Expand Down
2 changes: 1 addition & 1 deletion config/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ email: &email
smtp_password: <%= ENV["SMTP_PASSWORD"] %>
smtp_address: <%= ENV["SMTP_ADDRESS"] %>
smtp_domain: <%= ENV["SMTP_DOMAIN"] %>
smtp_port: "587"
smtp_port: <%= ENV["SMTP_PORT"] %>
smtp_starttls_auto: true
smtp_authentication: "plain"

Expand Down
7 changes: 6 additions & 1 deletion lib/census_caller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
class CensusCaller
def call(document_type, document_number, date_of_birth, postal_code)
if ENV["NO_CENSUS"].present? && ENV["NO_CENSUS"] == true
response = NoBorderApi.new.call(document_type, document_number) unless response.valid?
return response
end

if Setting["feature.remote_census"].present?
response = RemoteCensusApi.new.call(document_type, document_number, date_of_birth, postal_code)
else
response = CensusApi.new.call(document_type, document_number)
end
response = LocalCensus.new.call(document_type, document_number) unless response.valid?
response = NoBorderApi.new.call(document_type, document_number) unless response.valid?

response
end
end
3 changes: 1 addition & 2 deletions spec/lib/tasks/dev_seed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

describe "rake db:dev_seed" do
let :run_rake_task do
Rails.application.load_tasks
Rake.application.invoke_task('db:dev_seed[avoid_log]')
Rake.application.invoke_task("db:dev_seed[avoid_log]")
end

it "seeds the database without errors" do
Expand Down

0 comments on commit 8ef2e1d

Please sign in to comment.