Skip to content

Commit

Permalink
Merge branch 'main' into 64-undo-functionality-in-flash-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
wuletawwonte committed Sep 19, 2024
2 parents 2352c2b + 43d65c0 commit c8fe1c8
Show file tree
Hide file tree
Showing 103 changed files with 1,488 additions and 619 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
2 changes: 1 addition & 1 deletion app/assets/images/icons/bookmark-full.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 added 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.
4 changes: 4 additions & 0 deletions app/assets/images/icons/eye-empty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/assets/images/icons/eye-off.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 added 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 added 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.
6 changes: 6 additions & 0 deletions app/assets/stylesheets/actiontext.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@
padding: 0 !important;
max-width: 100% !important;
}

.trix-content a {
color: #CB0C1C;
font-weight: 400;
text-decoration: underline;
}
41 changes: 39 additions & 2 deletions app/assets/stylesheets/application.tailwind.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@import 'actiontext.css';

@tailwind base;
@tailwind components;
@tailwind utilities;

@import 'actiontext.css';

@layer base {
ul, ol {
@apply block ml-4
Expand Down Expand Up @@ -58,3 +58,40 @@ div.field_with_errors > input {
@apply px-0;
}
}

/* Utility classes for iOS PWA support */
.pt-safe-area-6 {
padding-top: calc(env(safe-area-inset-top) + 24px)
}

.pt-safe-area-2 {
padding-top: calc(env(safe-area-inset-top) + 8px)
}

.pb-safe-area-1 {
padding-bottom: calc(env(safe-area-inset-bottom) + 4px);
}

.pt-safe-area-back-button {
padding-top: calc(env(safe-area-inset-top) + 40px);
}

.pt-safe-area-header {
padding-top: calc(env(safe-area-inset-top) + 79px);
}

.pb-safe-area-bottom-navbar {
padding-bottom: calc(env(safe-area-inset-bottom) + 54px);
}

.top-safe-area-header {
top: calc(env(safe-area-inset-top) + 79px);
}

.top-safe-area-with-filters {
top: calc(env(safe-area-inset-top) + 245px);
}

.top-safe-area-no-filters {
top: calc(env(safe-area-inset-top) + 212px);
}
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
3 changes: 2 additions & 1 deletion app/avo/resources/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ 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 :public, as: :boolean
field :starts_at, as: :date_time,
help: "The datetime field will use your browser's current timezone.", sortable: true,
format: "FFFF"
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
5 changes: 5 additions & 0 deletions app/constraints/authenticated_constraint.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AuthenticatedConstraint
def matches?(request)
request.session[:user_id].present?
end
end
5 changes: 5 additions & 0 deletions app/constraints/unauthenticated_constraint.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class UnauthenticatedConstraint
def matches?(request)
request.session[:user_id].nil?
end
end
1 change: 1 addition & 0 deletions app/controllers/abouts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class AboutsController < ApplicationController
allow_unauthenticated_access
def show
end
end
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
1 change: 1 addition & 0 deletions app/controllers/concerns/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def authenticate_user!
authenticate_user

if !user_signed_in?
flash[:notice] = I18n.t("authentication.unauthenticated")
redirect_to new_user_session_path
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/schedules_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ 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

def filter_params
params.permit(:starts_at, :live, :past, :starting_soon)
params.permit(:starts_at, :live, :past, :starting_soon).merge(show_private: user_signed_in?)
end
end
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
17 changes: 12 additions & 5 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
class SessionsController < ApplicationController
allow_unauthenticated_access

def index
@user_session_ids = current_user.sessions.pluck(:id)
@user_session_ids = current_user&.sessions&.pluck(:id)
@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])
@user_session_ids = current_user&.sessions&.pluck(:id) || []
@session = if user_signed_in?
sessions.friendly.includes(:location, :tags, speakers: [profile: :image_attachment]).find(params[:id])
else
sessions.publics.friendly.includes(:location, :tags, speakers: [profile: :image_attachment]).find(params[:id])
end
end

private

def sessions
current_conference&.sessions
Session.where(conference: current_conference)
end

def filter_params
params.permit(:starts_at, :live, :past, :starting_soon)
params.permit(:starts_at, :live, :past, :starting_soon).merge(show_private: user_signed_in?)
end
end
1 change: 1 addition & 0 deletions app/controllers/speakers_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class SpeakersController < ApplicationController
allow_unauthenticated_access only: [:show]
def show
@speaker = current_conference.speakers.friendly.find(params[:id])
@profile = @speaker.profile.presence || Profile.new
Expand Down
39 changes: 39 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
class UsersController < ApplicationController
def edit
end

def update
if Current.user.update(user_params)
redirect_to edit_user_path, notice: t("controllers.users.update.success")
else
render :edit, status: :unprocessable_entity
end
end

private

def permitted_params
params.require(:user).permit(
:email,
:password,
:password_confirmation,
:password_challenge
).with_defaults(password_challenge: "")
end

def user_params
if password_params_blank?
{email: permitted_params[:email]}
else
permitted_params
end
end

def password_params_blank?
permitted_params.values_at(
:password,
:password_confirmation,
:password_challenge
).all?(&:blank?)
end
end
Loading

0 comments on commit c8fe1c8

Please sign in to comment.