Skip to content

Commit

Permalink
backstage engine, products
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed Jul 13, 2024
1 parent 73a68c6 commit fd283bd
Show file tree
Hide file tree
Showing 265 changed files with 5,261 additions and 401 deletions.
5 changes: 5 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 @@ -143,6 +145,7 @@ group :development, :test do
end

gem 'ransack'
gem "paranoia"

gem "rails_autolink", "~> 1.1"

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

gem "mrsk", "~> 0.15.1"

gem 'backstage-rails', path: 'backstage-rails'
16 changes: 16 additions & 0 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-rails
specs:
backstage-rails (0.1.0)
rails (>= 7.1.3.2)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -237,6 +243,10 @@ GEM
coderay (1.1.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 @@ -428,6 +438,8 @@ 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
Expand Down Expand Up @@ -603,6 +615,7 @@ GEM
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 Down Expand Up @@ -642,9 +655,11 @@ DEPENDENCIES
acts_as_list (~> 0.9.19)
aws-sdk-rails
aws-sdk-s3 (~> 1.48)
backstage-rails!
bootsnap
browser (~> 5.3)
capybara
country_select
cssbundling-rails
database_cleaner
database_cleaner-active_record
Expand Down Expand Up @@ -672,6 +687,7 @@ DEPENDENCIES
omniauth-rails_csrf_protection
omniauth-twitch
omniauth-twitter
paranoia
pg (~> 1.1)
pry
puma
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
24 changes: 0 additions & 24 deletions app/controllers/admin/base_controller.rb

This file was deleted.

10 changes: 0 additions & 10 deletions app/controllers/admin/base_dashboard_controller.rb

This file was deleted.

3 changes: 1 addition & 2 deletions app/controllers/admin/categories_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::CategoriesController < Admin::BaseController
include AdminControllerConcern
class Admin::CategoriesController < Backstage::Rails::BaseController

private

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/dashboard_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Admin::DashboardController < Admin::BaseDashboardController
class Admin::DashboardController < Backstage::Rails::BaseController
def index
readme_path = Rails.root.join('app', 'views', 'admin', 'README.md')
@readme_content = File.exist?(readme_path) ? File.read(readme_path) : "Welcome to the Admin Panel"
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/admin/posts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::PostsController < Admin::BaseController
include AdminControllerConcern
class Admin::PostsController < Backstage::Rails::BaseController

private

Expand Down
12 changes: 12 additions & 0 deletions app/controllers/admin/terms_and_conditions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Admin::TermsAndConditionsController < Backstage::Rails::BaseController

private

def model_class
TermsAndCondition
end

def permitted_params
params.require(:terms_and_condition).permit(:title, :category, :content)
end
end
3 changes: 1 addition & 2 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Admin::UsersController < Admin::BaseController
include AdminControllerConcern
class Admin::UsersController < Backstage::Rails::BaseController

private

Expand Down
64 changes: 0 additions & 64 deletions app/controllers/concerns/admin_controller_concern.rb

This file was deleted.

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 fd283bd

Please sign in to comment.