Skip to content

Commit

Permalink
Merge pull request #11 from rauversion/products
Browse files Browse the repository at this point in the history
Products
  • Loading branch information
michelson committed Jul 14, 2024
2 parents d741664 + 48c1c8e commit e3eae9b
Show file tree
Hide file tree
Showing 259 changed files with 5,924 additions and 303 deletions.
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ gem "cssbundling-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

gem "country_select"

# gem "tailwindcss-rails"

# Use Redis adapter to run Action Cable in production
Expand Down Expand Up @@ -142,11 +144,15 @@ group :development, :test do
end
end

gem 'ransack'
gem "paranoia"

gem "rails_autolink", "~> 1.1"

gem "transbank-sdk", "~> 3.0"
gem "stripe", "~> 8.6"
gem "mercadopago", "~> 2.3"
gem "redcarpet"

gem "meta-tags", github: "kpumuk/meta-tags", branch: :main

Expand All @@ -163,3 +169,6 @@ gem "rubyzip", "~> 2.3"
gem "sequel", "~> 5.71"

gem "mrsk", "~> 0.15.1"

# gem 'backstage-rails', path: 'backstage-rails'
gem 'backstage', path: 'backstage'
59 changes: 44 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ GIT
specs:
rspec-support (3.13.0.pre)

PATH
remote: backstage
specs:
backstage (0.1.0)
rails (>= 7.1.3.2)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -223,7 +229,7 @@ GEM
bootsnap (1.16.0)
msgpack (~> 1.2)
browser (5.3.1)
builder (3.2.4)
builder (3.3.0)
capybara (3.39.2)
addressable
matrix
Expand All @@ -235,8 +241,12 @@ GEM
xpath (~> 3.2)
chunky_png (1.4.0)
coderay (1.1.3)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
countries (6.0.1)
unaccent (~> 0.3)
country_select (9.0.0)
countries (> 5.0, < 7.0)
crass (1.0.6)
cssbundling-rails (1.2.0)
railties (>= 6.0.0)
Expand Down Expand Up @@ -268,7 +278,7 @@ GEM
railties (>= 3.2)
drb (2.2.1)
ed25519 (1.3.0)
erubi (1.12.0)
erubi (1.13.0)
event_stream_parser (1.0.0)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -308,9 +318,10 @@ GEM
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.6.0)
irb (1.7.4)
reline (>= 0.3.6)
io-console (0.7.2)
irb (1.13.2)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -356,7 +367,7 @@ GEM
method_source (1.1.0)
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.22.3)
minitest (5.24.1)
mrsk (0.15.1)
activesupport (>= 7.0)
bcrypt_pbkdf (~> 1.0)
Expand Down Expand Up @@ -385,11 +396,11 @@ GEM
net-protocol
net-ssh (7.2.0)
nio4r (2.7.3)
nokogiri (1.16.5-arm64-darwin)
nokogiri (1.16.6-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.5-x86_64-darwin)
nokogiri (1.16.6-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.5-x86_64-linux)
nokogiri (1.16.6-x86_64-linux)
racc (~> 1.4)
oauth (1.1.0)
oauth-tty (~> 1.0, >= 1.0.1)
Expand Down Expand Up @@ -427,20 +438,24 @@ GEM
rack
orm_adapter (0.5.0)
parallel (1.23.0)
paranoia (2.6.3)
activerecord (>= 5.1, < 7.2)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
pg (1.5.3)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
psych (5.1.2)
stringio
public_suffix (5.0.3)
puma (6.4.2)
nio4r (~> 2.0)
qdrant-ruby (0.9.3)
faraday (>= 2.0.1, < 3)
racc (1.7.3)
rack (3.0.11)
racc (1.8.0)
rack (3.1.6)
rack-protection (3.0.6)
rack
rack-session (2.0.0)
Expand Down Expand Up @@ -488,12 +503,19 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
ransack (4.1.1)
activerecord (>= 6.1.5)
activesupport (>= 6.1.5)
i18n
rdoc (6.7.0)
psych (>= 4.0.0)
redcarpet (3.6.0)
redis (5.0.6)
redis-client (>= 0.9.0)
redis-client (0.22.1)
connection_pool
regexp_parser (2.8.1)
reline (0.3.6)
reline (0.5.9)
io-console (~> 0.5)
responders (3.1.0)
actionpack (>= 5.2)
Expand Down Expand Up @@ -585,13 +607,15 @@ GEM
railties (>= 6.0.0)
store_attribute (1.1.1)
activerecord (>= 6.0)
stringio (3.1.1)
stripe (8.6.0)
thor (1.3.1)
timeout (0.4.1)
transbank-sdk (3.0.2)
json (~> 2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unaccent (0.4.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
Expand All @@ -600,7 +624,7 @@ GEM
version_gem (1.1.3)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.0)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
Expand All @@ -616,7 +640,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.11)
zeitwerk (2.6.16)

PLATFORMS
arm64-darwin-21
Expand All @@ -631,9 +655,11 @@ DEPENDENCIES
acts_as_list (~> 0.9.19)
aws-sdk-rails
aws-sdk-s3 (~> 1.48)
backstage!
bootsnap
browser (~> 5.3)
capybara
country_select
cssbundling-rails
database_cleaner
database_cleaner-active_record
Expand Down Expand Up @@ -661,13 +687,16 @@ DEPENDENCIES
omniauth-rails_csrf_protection
omniauth-twitch
omniauth-twitter
paranoia
pg (~> 1.1)
pry
puma
qdrant-ruby (~> 0.9.2)
rails (~> 7.1.3.2)
rails_autolink (~> 1.1)
rails_heroicon
ransack
redcarpet
rqrcode (~> 2.0)
rspec-core!
rspec-expectations!
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@layer components {
.ProseMirror {
@apply text-default;
@apply text-default focus:outline-none outline-none dark:prose-invert;
}
:root {
/* background */
Expand Down
14 changes: 14 additions & 0 deletions app/controllers/backstage/categories_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# lib/generators/backstage/templates/controller.rb
module Backstage
class CategoriesController < Backstage::BaseController

def model_class
Category
end

def permitted_params
params.require(:user).permit(:email, :username, :role, :editor)
end

end
end
6 changes: 6 additions & 0 deletions app/controllers/backstage/posts_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# lib/generators/backstage/templates/controller.rb
module Backstage
class PostsController < Backstage::BaseController
# Add any resource-specific logic here
end
end
13 changes: 13 additions & 0 deletions app/controllers/backstage/terms_and_conditions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# lib/generators/backstage/templates/controller.rb
module Backstage
class TermsAndConditionsController < Backstage::BaseController
def model_class
TermsAndCondition
end

def permitted_params
params.require(:user).permit(:email, :username, :role, :editor)
end

end
end
14 changes: 14 additions & 0 deletions app/controllers/backstage/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# lib/generators/backstage/templates/controller.rb
module Backstage
class UsersController < Backstage::BaseController

def model_class
User
end

def permitted_params
params.require(:user).permit(:email, :username, :role, :editor)
end

end
end
2 changes: 1 addition & 1 deletion app/controllers/event_streaming_services_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def show
@event = current_user.events.find_signed(params[:id])
@provider = @event.streaming_service["name"]
@service_klass = StreamingProviders::Service.find_module_by_type(@provider)
@service = @service_klass.new(@event.streaming_service)
@service = @service_klass&.new(@event.streaming_service)
end

def new
Expand Down
30 changes: 30 additions & 0 deletions app/controllers/product_cart_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# app/controllers/product_cart_controller.rb
class ProductCartController < ApplicationController
include ApplicationHelper # This gives us access to the current_cart method
before_action :set_cart

def add
product = Product.find(params[:product_id])
@cart.add_product(product)
redirect_back(fallback_location: root_path, notice: 'Item added to cart')
end

def show
@cart_items = @cart.product_cart_items.includes(:product)
end

def remove
item = @cart.product_cart_items.find_by(product_id: params[:product_id])
item.destroy if item
redirect_to( product_cart_path, notice: 'Item removed from cart')
end

private

def set_cart
@cart = current_cart
if @cart.blank?
redirect_to root_path, notice: "Log in first to access your cart" and return
end
end
end
Loading

0 comments on commit e3eae9b

Please sign in to comment.