diff --git a/Gemfile b/Gemfile index de6025a920..7856aaf158 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ gem 'devise', '~> 4.8.1' gem 'devise_invitable', '~> 2.0.9' gem 'devise-pwned_password' gem 'devise_uid' -gem 'pg', '1.1.4' +gem 'pg', '>= 1.4' gem "recaptcha" gem 'resque', '2.6.0' gem 'resque-scheduler', '4.10.2' diff --git a/Gemfile.lock b/Gemfile.lock index 47a1eebda2..1a54232774 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -314,7 +314,10 @@ GEM parser (3.2.2.4) ast (~> 2.4.1) racc - pg (1.1.4) + pg (1.6.1-aarch64-linux) + pg (1.6.1-arm64-darwin) + pg (1.6.1-x86_64-darwin) + pg (1.6.1-x86_64-linux) premailer (1.18.0) addressable css_parser (>= 1.12.0) @@ -613,6 +616,7 @@ PLATFORMS aarch64-linux arm64-darwin-21 arm64-darwin-22 + arm64-darwin-24 x86_64-darwin-20 x86_64-darwin-21 x86_64-linux @@ -653,7 +657,7 @@ DEPENDENCIES omniauth-facebook omniauth-google-oauth2 (~> 1.0.1) omniauth-rails_csrf_protection (~> 1.0.1) - pg (= 1.1.4) + pg (>= 1.4) premailer-rails pry-byebug pry-rails diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9c948237a7..d29e86a614 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -50,7 +50,10 @@ <%= react_component('SkipToContent', props: { id: 'mainContent' })%> - <%= react_component('Header', props: header_props) %> + <%= react_component('Header', props: header_props.merge( + locale: @locale.to_s, + locales: @locales.map(&:to_s) + )) %>
<%= react_component('Toast', props: { notice: notice.present? ? notice : '', diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb index 601632fdf6..e06470f2bb 100644 --- a/app/views/shared/_footer.html.erb +++ b/app/views/shared/_footer.html.erb @@ -30,7 +30,6 @@ <%= link_to(t('pages.resources.emergency'), "/resources?filter[]=#{t('pages.resources.tags.hotlines')}") %>
- <%= react_component('ToggleLocale', props: { locale: @locale, locales: @locales }) %>
<%= sanitize t('shared.footer.licence_subtitle', licence: link_to(t('shared.footer.licence'), 'https://github.com/ifmeorg/ifme/blob/main/LICENSE.txt', target: '_blank')) diff --git a/client/app/components/Header/index.jsx b/client/app/components/Header/index.jsx index 9f17526a9c..aa3cb62ed4 100644 --- a/client/app/components/Header/index.jsx +++ b/client/app/components/Header/index.jsx @@ -11,12 +11,15 @@ import { HeaderProfile } from 'components/Header/HeaderProfile'; import type { Profile, Link } from './types'; import css from './Header.scss'; import { useFocusTrap } from '../../hooks'; +import { ToggleLocale } from '../../widgets/ToggleLocale'; export type Props = { home: Link, links: Link[], mobileOnly?: any, profile?: Profile, + locale: string, + locales: string[], }; export type State = { @@ -24,8 +27,15 @@ export type State = { }; export const Header = ({ - home, links, mobileOnly, profile, + home, + links, + mobileOnly, + profile, + locale, + locales, }: Props): Node => { + console.log('Locale props:', locale, locales); + const [mobileNavOpen, setMobileNavOpen] = useState(false); const [scrolled, setScrolled] = useState(false); const navigationRef = useRef(null); @@ -96,7 +106,18 @@ export const Header = ({ {displayToggle()}
{!mobileNavOpen && ( -
{displayLinks()}
+
+ {displayLinks()} +
+ +
+
)}
@@ -147,7 +168,19 @@ export const Header = ({ }; export default ({ - home, links, mobileOnly, profile, + home, + links, + mobileOnly, + profile, + locale, + locales, }: Props): Node => ( -
+
); diff --git a/client/app/widgets/ToggleLocale/index.jsx b/client/app/widgets/ToggleLocale/index.jsx index e352cd261a..ce8533ab77 100644 --- a/client/app/widgets/ToggleLocale/index.jsx +++ b/client/app/widgets/ToggleLocale/index.jsx @@ -12,7 +12,7 @@ export type Props = { locales: string[], }; -const options = (locales) => { +const options = (locales = []) => { const result = []; locales.forEach((locale: string) => { result.push({ diff --git a/db/schema.rb b/db/schema.rb index 1de1621107..5663d1b939 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -16,8 +16,8 @@ create_table "allyships", force: :cascade do |t| t.integer "user_id" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" t.integer "ally_id" t.integer "status" end @@ -25,15 +25,15 @@ create_table "bootsy_image_galleries", force: :cascade do |t| t.integer "bootsy_resource_id" t.string "bootsy_resource_type" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" end create_table "bootsy_images", force: :cascade do |t| t.string "image_file" t.integer "image_gallery_id" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" end create_table "care_plan_contacts", force: :cascade do |t| @@ -47,8 +47,8 @@ create_table "categories", force: :cascade do |t| t.string "name" t.text "description" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" t.integer "user_id" t.string "slug" t.boolean "visible", default: true @@ -60,8 +60,8 @@ t.integer "commentable_id" t.integer "comment_by" t.text "comment" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" t.string "visibility" t.text "viewers" t.index ["commentable_type", "commentable_id"], name: "index_comments_on_commentable_type_and_commentable_id" @@ -83,14 +83,14 @@ t.integer "group_id" t.integer "user_id" t.boolean "leader" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" end create_table "groups", force: :cascade do |t| t.string "name" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" t.text "description" t.string "slug" t.index ["slug"], name: "index_groups_on_slug", unique: true @@ -99,9 +99,9 @@ create_table "medications", force: :cascade do |t| t.string "name" t.integer "dosage" - t.datetime "refill", precision: nil - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.timestamptz "refill" + t.datetime "created_at" + t.datetime "updated_at" t.integer "user_id" t.integer "total" t.integer "strength" @@ -119,8 +119,8 @@ t.integer "meeting_id" t.integer "user_id" t.boolean "leader" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" t.string "google_cal_event_id" end @@ -131,8 +131,8 @@ t.string "time" t.integer "maxmembers" t.integer "group_id" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" t.string "date" t.string "slug" t.index ["slug"], name: "index_meetings_on_slug", unique: true @@ -153,8 +153,8 @@ t.string "name" t.text "why" t.text "fix" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" t.integer "user_id" t.text "viewers" t.boolean "comment" @@ -189,8 +189,8 @@ create_table "moods", force: :cascade do |t| t.string "name" t.text "description" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" t.integer "user_id" t.string "slug" t.boolean "visible", default: true @@ -233,8 +233,8 @@ t.text "description" t.text "viewers" t.boolean "comment" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" t.string "name" t.string "slug" t.datetime "published_at", precision: nil @@ -253,8 +253,8 @@ t.integer "user_id" t.string "support_type" t.text "support_ids" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" end create_table "take_medication_reminders", id: :serial, force: :cascade do |t| @@ -268,15 +268,15 @@ t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" - t.datetime "reset_password_sent_at", precision: nil - t.datetime "remember_created_at", precision: nil + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at", precision: nil - t.datetime "last_sign_in_at", precision: nil + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.datetime "created_at", precision: nil - t.datetime "updated_at", precision: nil + t.datetime "created_at" + t.datetime "updated_at" t.string "name" t.string "location" t.string "timezone" diff --git a/spec/support/cloudinary_mock.rb b/spec/support/cloudinary_mock.rb new file mode 100644 index 0000000000..14e55f20e1 --- /dev/null +++ b/spec/support/cloudinary_mock.rb @@ -0,0 +1,7 @@ +RSpec.configure do |config| + config.before(:each) do + allow(Cloudinary::Utils).to receive(:cloudinary_url).and_return("https://res.cloudinary.com/test/image/upload/fake.jpg") + allow(Cloudinary::Uploader).to receive(:upload).and_return({ "public_id" => "fake_id" }) + allow(Cloudinary::Uploader).to receive(:destroy).and_return({ "result" => "ok" }) + end +end