Skip to content

Commit

Permalink
Rails 7 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmarcia committed Apr 9, 2023
1 parent 86973f2 commit 1479160
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
- run:
name: Setup Chrome
command: |
wget http://archive.ubuntu.com/ubuntu/pool/main/libu/libu2f-host/libu2f-udev_1.1.4-1_all.deb
sudo dpkg -i libu2f-udev_1.1.4-1_all.deb
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
- save_cache:
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ gem 'uglifier', '~> 4.1.20'
gem 'carrierwave', '~> 1.3.1'
gem 'certified', '1.0.0'
gem 'chronic', '0.10.2'
gem 'cloudinary', '~> 1.21.0'
gem 'cloudinary', '~> 1.25.0'
gem 'google-api-client', '~> 0.53.0'
gem 'kaminari', '1.2.1'
gem 'omniauth', '~> 2.0'
Expand Down Expand Up @@ -103,7 +103,7 @@ end
group :test do
gem 'database_cleaner'
gem 'rails-controller-testing'
gem 'shoulda-matchers'
gem 'shoulda-matchers', '~> 5.3.0'
gem 'simplecov', '~> 0.21.0'
end

Expand Down
11 changes: 7 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ GEM
childprocess (4.1.0)
choice (0.2.0)
chronic (0.10.2)
cloudinary (1.21.0)
cloudinary (1.25.0)
aws_cf_signer
rest-client (>= 2.0.0)
coderay (1.1.3)
Expand Down Expand Up @@ -263,6 +263,8 @@ GEM
net-protocol
netrc (0.11.0)
nio4r (2.5.8)
nokogiri (1.13.9-arm64-darwin)
racc (~> 1.4)
nokogiri (1.13.9-x86_64-darwin)
racc (~> 1.4)
oauth2 (1.4.11)
Expand Down Expand Up @@ -503,7 +505,7 @@ GEM
semantic_range (3.0.0)
sentry-raven (3.1.2)
faraday (>= 1.0)
shoulda-matchers (5.2.0)
shoulda-matchers (5.3.0)
activesupport (>= 5.2.0)
sidekiq (6.5.7)
connection_pool (>= 2.2.5)
Expand Down Expand Up @@ -581,6 +583,7 @@ GEM
zeitwerk (2.6.1)

PLATFORMS
arm64-darwin-21
x86_64-darwin-20

DEPENDENCIES
Expand All @@ -596,7 +599,7 @@ DEPENDENCIES
carrierwave (~> 1.3.1)
certified (= 1.0.0)
chronic (= 0.10.2)
cloudinary (~> 1.21.0)
cloudinary (~> 1.25.0)
database_cleaner
devise (~> 4.8.1)
devise-pwned_password
Expand Down Expand Up @@ -652,7 +655,7 @@ DEPENDENCIES
sdoc (= 1.0.0)
selenium-webdriver (~> 4.1.0)
sentry-raven
shoulda-matchers
shoulda-matchers (~> 5.3.0)
sidekiq
sidekiq-cron (~> 1.1)
sidekiq-failures
Expand Down
29 changes: 29 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true
module ApplicationHelper
include ViewersHelper
include AssetsHelper

def html_options
{ class: 'htmlOptions' }
Expand All @@ -17,6 +18,34 @@ def sign_in_path?
devise_page?(new_user_session_path, 'sessions', 'new')
end

def page_title
t('app_name') +
if sign_in_path?
" | " + t('account.sign_in')
elsif join_path?
" | " + t('account.sign_up')
elsif forgot_password_path?
" | " + t('account.forgot_password')
elsif update_account_path?
" | " + t('account.singular')
elsif current_page?(root_path)
" | " + t('app_description')
elsif send_ally_invitation_path?
" | " + t('devise.invitations.new.header')
elsif ally_accept_invitation_path?
" | " + t('devise.invitations.edit.header')
elsif reset_password_path?
" | " + t('layouts.title.reset_password')
elsif new_user_confirmation_path?
" | " + t('devise.confirmations.resend_confirmation')
else
" | " + title_content
end
end

def title_content
content_for(:title) || 'a community for mental health experiences'
end
def join_path?
path = new_user_registration_path
devise_page?(path, 'registrations', 'create') ||
Expand Down
3 changes: 2 additions & 1 deletion app/helpers/moments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
module MomentsHelper
include ViewersHelper
include VisibleHelper
include ActionView::Helpers::UrlHelper

def moments_data_json
{
Expand All @@ -14,7 +15,7 @@ def moments_data_html
return unless current_user

# +1 day buffer to ensure we include today as well
start_date = 1.week.ago.to_date
start_date = 1.week.ago.to_date
end_date = Date.tomorrow
range = start_date..end_date
@react_moments = current_user.moments
Expand Down
22 changes: 0 additions & 22 deletions app/views/layouts/_title.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="<%= @locale %>">
<head>
<title><%= render 'layouts/title' %></title>
<title><%= page_title %></title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="manifest" href="/manifest.json">
Expand Down

0 comments on commit 1479160

Please sign in to comment.