This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class UserMailer < PublicMailer | |
| def daily_report | |
| daily_report_id = params[:daily_report_id] | |
| @daily_report = Rayo::DailyReport.find(daily_report_id) | |
| @brand = @daily_report.user.brand | |
| with_recipient_locale(recipient_user: @daily_report.user, to_email: @daily_report.user.contact_email) do | |
| mail from: @brand.contact_from_email_address, | |
| to: @daily_report.user.contact_email, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| module Rayo | |
| class PreferencesController < ApplicationController | |
| skip_before_action :authorize_user | |
| # GET /preferences | |
| def show | |
| load_supported_languages | |
| @language_preference = current_user.language_preference.presence || I18n.locale.to_s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Rayo | |
| class SessionsController < ApplicationController | |
| # POST /sessions | |
| def create | |
| @login = Rayo::Forms::Login.new(login_params) | |
| if @login.save(session, current_brand) | |
| sync_user_locale_on_sign_in(@login.user) | |
| # ... | |
| else | |
| locale = session[:locale] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # In Rayo::Forms::SignUp#save: | |
| resolved_locale = locale.presence || I18n.locale.to_s | |
| sign_up_request = Rayo::SignUpRequest.create!( | |
| brand: brand, | |
| country_id: country_id, | |
| email: email, | |
| locale: resolved_locale, | |
| password: password, | |
| password_confirmation: password_confirmation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module UserWithApplicationSettings | |
| extend ActiveSupport::Concern | |
| included do | |
| has_one :application_settings, class_name: 'Rayo::UserApplicationSettings', inverse_of: :user, dependent: :destroy | |
| end | |
| def language_preference | |
| application_setting('language_preference') | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| module Rayo | |
| module SetLocale | |
| extend ActiveSupport::Concern | |
| TLD_TO_LOCALE = { | |
| 'gr' => :el, | |
| 'nl' => :nl | |
| }.freeze |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ApplicationHelper | |
| def sign_up_url | |
| "#{application_url}/sign_ups/new?locale=#{I18n.locale}" | |
| end | |
| def sign_in_url | |
| "#{application_url}/sessions/new?locale=#{I18n.locale}" | |
| end | |
| def contact_us_url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| class LocaleController < ApplicationController | |
| skip_before_action :set_locale | |
| # GET /set_locale?locale=XX | |
| def set_locale | |
| super | |
| redirect_back_or_to root_path, allow_other_host: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| module SetLocale | |
| extend ActiveSupport::Concern | |
| TLD_TO_LOCALE = { | |
| 'gr' => :el, | |
| 'nl' => :nl | |
| }.freeze |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| module EnqueueableJob | |
| extend ActiveSupport::Concern | |
| included do | |
| def process_enqueued_job(queueable:) | |
| enqueued_job = nil | |
| ActiveRecord::Base.transaction do |
NewerOlder