-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
265 changed files
with
5,261 additions
and
401 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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 |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
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 |
Oops, something went wrong.