Skip to content

Commit

Permalink
Merge branch 'main' into 111-add-show-password-button
Browse files Browse the repository at this point in the history
  • Loading branch information
LuigiR0jas authored Sep 2, 2024
2 parents b9c9454 + 4015343 commit 5174930
Show file tree
Hide file tree
Showing 56 changed files with 383 additions and 161 deletions.
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ RSPEC_RETRY_RETRY_COUNT=0
MAILER_SENDER="Rails World <hello@teloslabs.co>"
REGISTRATION_ENABLED=true
SESSION_REMINDERS_ENABLED=true
ONLY_TESTER_REGISTRATION_ENABLED=false
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ PLATFORMS
arm64-darwin-21
arm64-darwin-22
arm64-darwin-23
arm64-darwin-24
x86_64-linux

DEPENDENCIES
Expand Down
Binary file modified app/assets/images/icons/calendar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/images/icons/chevron_left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/images/icons/location.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/images/icons/no_wifi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/assets/images/intersection_lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/images/main_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/splashscreens/iPhone_14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 11 additions & 18 deletions app/assets/images/telos_labs_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/avo/resources/conference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Avo::Resources::Conference < Avo::BaseResource

def fields
field :id, as: :id
field :name, as: :text
field :name, as: :text, link_to_record: true
field :locations, as: :has_many
field :sessions, as: :has_many
end
Expand Down
2 changes: 1 addition & 1 deletion app/avo/resources/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Avo::Resources::Location < Avo::BaseResource

def fields
field :id, as: :id
field :name, as: :text, sortable: true
field :name, as: :text, sortable: true, link_to_record: true
field :conference, as: :belongs_to
field :sessions, as: :has_many
end
Expand Down
2 changes: 1 addition & 1 deletion app/avo/resources/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Avo::Resources::Session < Avo::BaseResource

def fields
field :id, as: :id
field :title, as: :text, sortable: true
field :title, as: :text, sortable: true, link_to_record: true
field :slug, as: :text, hide_on: :new
field :description, as: :trix
field :starts_at, as: :date_time,
Expand Down
2 changes: 1 addition & 1 deletion app/avo/resources/speaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class Avo::Resources::Speaker < Avo::BaseResource

def fields
field :id, as: :id
field :name, as: :text, sortable: -> { query.order("profiles.name #{direction}") }, link_to_record: true
field :slug, as: :text, hide_on: :new
field :name, as: :text, sortable: -> { query.order("profiles.name #{direction}") }
field :image, as: :file, accept: "image/*", only_on: [:show, :forms]
field :image_presence, name: "Image", as: :boolean, only_on: :index do
record.image.attached?
Expand Down
2 changes: 1 addition & 1 deletion app/avo/resources/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Avo::Resources::Tag < Avo::BaseResource

def fields
field :id, as: :id
field :name, as: :text, sortable: true
field :name, as: :text, sortable: true, link_to_record: true
field :sessions, as: :has_and_belongs_to_many
end
end
2 changes: 1 addition & 1 deletion app/avo/resources/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Avo::Resources::User < Avo::BaseResource

def fields
field :id, as: :id
field :email, as: :text, sortable: true
field :email, as: :text, sortable: true, link_to_record: true
field :role, as: :select, options: User.roles, include_blank: true, sortable: true, default: "user"
field :password, as: :password, only_on: :new
field :password_confirmation, as: :password, only_on: :new
Expand Down
16 changes: 13 additions & 3 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@ class ApplicationController < ActionController::Base

helper_method :current_profile, :current_conference, :vapid_public_key

rescue_from ActionController::InvalidAuthenticityToken,
with: :after_invalid_authenticity_token

private

def current_profile = current_user&.profile

# TODO: Must change after implementing multi-conference support
def current_conference = Conference.last
def current_conference
@_current_conference ||= Conference.last
end

def vapid_public_key
Base64.urlsafe_decode64(ENV["VAPID_PUBLIC_KEY"]).bytes.to_json
@_vapid_public_key ||= Base64.urlsafe_decode64(ENV["VAPID_PUBLIC_KEY"]).bytes.to_json
end

def after_invalid_authenticity_token
path_to_redirect = request.referer
path_to_redirect ||= user_signed_in? ? sessions_path : new_user_session_path
redirect_to path_to_redirect, alert: t("authorization.invalid_auth_token")
end
end
2 changes: 1 addition & 1 deletion app/controllers/schedules_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def show
@sessions = SessionQuery.new(
relation: current_user.sessions.where(conference: current_conference),
params: filter_params
).call.includes(:attendees, :location, :speakers, :tags).order(:starts_at)
).call.includes(:location, :tags, speakers: [profile: :image_attachment]).order(:starts_at)
end

private
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/service_worker_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ def service_worker

def manifest
end

def offline
end
end
4 changes: 2 additions & 2 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ def index
@sessions = SessionQuery.new(
relation: sessions.joins(:location).distinct,
params: filter_params
).call.includes(:attendees, :tags).order(:starts_at)
).call.includes(:location, :tags, speakers: [profile: :image_attachment]).order(:starts_at)
end

def show
@session = sessions.friendly.find(params[:id])
@session = sessions.friendly.includes(:location, :tags, speakers: [profile: :image_attachment]).find(params[:id])
end

private
Expand Down
34 changes: 30 additions & 4 deletions app/helpers/navigation_helper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
module NavigationHelper
def nav_icon_class_for(path)
return "fill-red w-6 h-6" if path.any? { |p| current_page?(p) }
def nav_icon_class_for(paths)
return "fill-red w-6 h-6" if paths.any? { |p| active_path?(p) }
"fill-grey-400 w-6 h-6"
end

def nav_text_class_for(path)
return "text-red" if path.any? { |p| current_page?(p) }
def nav_text_class_for(paths)
return "text-red" if paths.any? { |p| active_path?(p) }
"text-grey-400"
end

def active_path?(path)
return request.path == path if root_path == path

request.path.starts_with?(path)
end

def show_header?
!current_page?(new_user_session_path) &&
!current_page?(about_path) &&
Expand All @@ -20,7 +26,27 @@ def show_bottom_navbar?
!current_page?(coming_soon_path)
end

def show_back_button?
current_page?(notification_settings_path) ||
resource_show_page?("speakers") ||
resource_show_page?("sessions")
end

def back_title
if controller_name.include?("_")
controller_name.humanize
else
"#{controller_name.singularize.capitalize} detail"
end
end

def title(title)
content_for :title, title
end

private

def resource_show_page?(resource)
controller_name == resource && action_name == "show"
end
end
2 changes: 1 addition & 1 deletion app/mailers/password_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class PasswordMailer < ApplicationMailer
def password_reset
mail to: params[:user].email
mail(to: params[:user].email, subject: I18n.t("mailers.password_mailer.password_reset.subject"))
end
end
2 changes: 2 additions & 0 deletions app/models/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
# Indexes
#
# index_sessions_on_conference_id (conference_id)
# index_sessions_on_ends_at (ends_at)
# index_sessions_on_location_id (location_id)
# index_sessions_on_slug (slug) UNIQUE
# index_sessions_on_starts_at (starts_at)
#
class Session < ApplicationRecord
extend FriendlyId
Expand Down
9 changes: 9 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class User < ApplicationRecord
validates :email, presence: true, uniqueness: true, format: {with: URI::MailTo::EMAIL_REGEXP}
validates :password_digest, presence: true
validates :password, length: {minimum: 8}, if: -> { password.present? }
validate :validate_tester_user

after_create_commit { create_profile! }

Expand All @@ -44,4 +45,12 @@ class User < ApplicationRecord
def self.ransackable_attributes(_auth_object = nil)
%w[email]
end

private

def validate_tester_user
if Feature.enabled?(:only_tester_registration)
errors.add(:base, "Only tester users are allowed to sign up") unless email.include?("+tester")
end
end
end
13 changes: 7 additions & 6 deletions app/views/abouts/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<%= title "About - Rails World 2024" %>

<div class="flex flex-col items-center w-full h-full font-karla">
<div class="flex flex-col items-center w-full h-full px-5 pt-6 pb-10 bg-blue-marine">
<div class="flex flex-col justify-center h-full max-w-screen-sm font-normal text-center">
<div class="relative flex flex-col items-center w-full h-full font-karla">
<div class="absolute left-0 bottom-0 z-0 w-full max-w-[430px] h-[228px] bg-no-repeat bg-cover" style="background-image: url(<%= asset_path 'intersection_lines.svg' %>)"></div>
<div class="flex flex-col items-center w-full h-full px-5 pt-6 pb-10 bg-gradient-to-r from-blue-marine from-[16.68%] to-[#001827] to-[99.85%] bg-no-repeat">
<div class="z-10 flex flex-col justify-center h-full max-w-screen-sm font-light text-center">
<p class="mb-6 text-base text-white">Brought to you by</p>
<a href="https://www.teloslabs.co/?utm_source=rails_world_app&utm_medium=affiliate&utm_campaign=rails_world_app">
<%= inline_svg_tag "telos_labs_logo.svg", class: "mb-10 w-full" %>
</a>
<p class="mb-6 text-lg text-white">
<p class="mb-6 text-lg leading-6 text-white">
We designed and developed this open-source app for the Rails community.
<br>
You can contribute to the repo <a href="https://github.com/TelosLabs/rails-world" target="_blank" class="text-blue-teal">here</a>.
You can contribute to the repo <a href="https://github.com/TelosLabs/rails-world" target="_blank" class="font-normal text-blue-teal">here</a>.
</p>
<p class="mb-10 text-lg text-white">Telos creates disruptive, purpose-driven software for visionary clients to enhance productivity and enrich lives.</p>
<p class="mb-10 text-lg leading-6 text-white">Telos creates disruptive, purpose-driven software for visionary clients to enhance productivity and enrich lives.</p>
<div class="flex flex-row items-center w-full gap-5">
<a href="https://www.teloslabs.co/?utm_source=rails_world_app&utm_medium=affiliate&utm_campaign=rails_world_app" target="_blank" class="grow bg-blue-teal rounded-[10px] p-4 flex flex-row items-center justify-center">
<%= inline_svg_tag "icon_web.svg", class: "w-6 h-6" %>
Expand Down
27 changes: 27 additions & 0 deletions app/views/layouts/_apple_splash_screen.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,30 @@

<!-- iPad Pro 11" (1668x2388) -->
<link rel="apple-touch-startup-image" href="<%= image_path "splashscreens/iPad_Pro_11.png" %>" media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2)">

<!-- iPhone 12 and iPhone 12 Pro -->
<link rel="apple-touch-startup-image" href="/assets/splashscreens/iPhone_12_Pro.png" media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3)">

<!-- iPhone 12 Mini -->
<link rel="apple-touch-startup-image" href="/assets/splashscreens/iPhone_12_Mini.png" media="(device-width: 360px) and (device-height: 780px) and (-webkit-device-pixel-ratio: 3)">

<!-- iPhone 12 Pro Max -->
<link rel="apple-touch-startup-image" href="/assets/splashscreens/iPhone_12_Pro_Max.png" media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3)">

<!-- iPhone 13 and iPhone 13 Pro -->
<link rel="apple-touch-startup-image" href="/assets/splashscreens/iPhone_13_Pro.png" media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3)">

<!-- iPhone 13 Mini -->
<link rel="apple-touch-startup-image" href="/assets/splashscreens/iPhone_13_Mini.png" media="(device-width: 360px) and (device-height: 780px) and (-webkit-device-pixel-ratio: 3)">

<!-- iPhone 13 Pro Max -->
<link rel="apple-touch-startup-image" href="/assets/splashscreens/iPhone_13_Pro_Max.png" media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3)">

<!-- iPhone 14 and iPhone 14 Pro -->
<link rel="apple-touch-startup-image" href="/assets/splashscreens/iPhone_14_Pro.png" media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3)">

<!-- iPhone 14 Plus -->
<link rel="apple-touch-startup-image" href="/assets/splashscreens/iPhone_14_Plus.png" media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3)">

<!-- iPhone 14 Pro Max -->
<link rel="apple-touch-startup-image" href="/assets/splashscreens/iPhone_14_Pro_Max.png" media="(device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3)">
10 changes: 5 additions & 5 deletions app/views/layouts/_bottom_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
anchor: session_anchor(current_agenda_session)
),
class: [
nav_text_class_for([sessions_path, root_path]),
nav_text_class_for([sessions_path, root_path, "/speakers"]),
"flex flex-col items-center justify-center"
]
) do %>
<%= inline_svg_tag "icons/calendar.svg", class: nav_icon_class_for([sessions_path, root_path]) %>
<%= inline_svg_tag "icons/calendar.svg", class: nav_icon_class_for([sessions_path, root_path, "/speakers"]) %>
Agenda
<% end %>
Expand All @@ -32,13 +32,13 @@
<%= link_to(
profile_path(current_profile&.uuid),
class: [
nav_text_class_for([profile_path(current_profile&.uuid), edit_profile_path(current_profile&.uuid)]),
nav_text_class_for(["/profiles"]),
"flex flex-col items-center justify-center"
]
) do %>
<%= inline_svg_tag(
"icons/avatar_no_fill.svg",
class: nav_icon_class_for([profile_path(current_profile&.uuid), edit_profile_path(current_profile&.uuid)])
class: nav_icon_class_for(["/profiles"])
) %>
Profile
<% end %>
Expand All @@ -54,7 +54,7 @@
<% if unread_notifications.present? %>
<div class="absolute -top-0.5 right-0 w-[18px] h-[18px] rounded-full bg-red flex justify-center items-center">
<span class="text-[11px] text-white font-bold px-1">
<%= unread_notifications.count < 10 ? unread_notifications.count : "+9" %>
<%= unread_notifications.length < 10 ? unread_notifications.length : "+9" %>
</span>
</div>
<% end %>
Expand Down
10 changes: 10 additions & 0 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<% if show_back_button? %>
<div class="relative flex items-center justify-center w-full py-2">
<%= link_to :back, class: "absolute left-0 flex items-center py-2" do %>
<%= inline_svg_tag("icons/chevron_left.svg", size: "24", class: "fill-red") %>
<span class="ml-1 text-lg italic font-black text-red">Back</span>
<% end %>
<p class="text-lg font-bold"><%= back_title %></p>
</div>
<% end %>

<div class="sticky top-0 z-30 flex justify-center w-full py-6 mx-auto border-b border-b-white bg-purple-dark">
<div class="flex max-w-screen-sm px-5">
<%= link_to root_path(
Expand Down
Loading

0 comments on commit 5174930

Please sign in to comment.