-
Notifications
You must be signed in to change notification settings - Fork 1
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
87 changed files
with
1,998 additions
and
143 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
h1 { | ||
color: red; | ||
color: rgb(0, 0, 0); | ||
} | ||
|
||
td, | ||
th { | ||
border: 1px solid black; | ||
} | ||
|
||
.icon-app { | ||
width: 2rem; | ||
margin-right: 0.5rem; | ||
} |
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 |
---|---|---|
@@ -1,2 +1,19 @@ | ||
class ApplicationController < ActionController::Base | ||
before_action :authenticate_user! | ||
before_action :configure_permitted_parameters, if: :devise_controller? | ||
|
||
protected | ||
|
||
def configure_permitted_parameters | ||
devise_parameter_sanitizer.permit(:sign_up, keys: %i[email name password password_confirmation]) | ||
end | ||
|
||
def set_current_user | ||
@current_user = current_user | ||
end | ||
|
||
def after_sign_in_path_for(resource) | ||
flash[:notice] = "Welcome back, #{resource.name}!" | ||
super | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
class FoodsController < ApplicationController | ||
before_action :set_food, only: %i[show edit update destroy] | ||
|
||
# GET /foods or /foods.json | ||
def index | ||
@foods = Food.all | ||
end | ||
|
||
# GET /foods/1 or /foods/1.json | ||
def show; end | ||
|
||
# GET /foods/new | ||
def new | ||
@food = Food.new | ||
end | ||
|
||
# GET /foods/1/edit | ||
def edit; end | ||
|
||
# POST /foods or /foods.json | ||
def create | ||
@food = Food.new(food_params) | ||
|
||
respond_to do |format| | ||
if @food.save | ||
format.html { redirect_to food_url(@food), notice: 'Food was successfully created.' } | ||
format.json { render :show, status: :created, location: @food } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @food.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /foods/1 or /foods/1.json | ||
def update | ||
respond_to do |format| | ||
if @food.update(food_params) | ||
format.html { redirect_to food_url(@food), notice: 'Food was successfully updated.' } | ||
format.json { render :show, status: :ok, location: @food } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @food.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /foods/1 or /foods/1.json | ||
def destroy | ||
@food.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to foods_url, notice: 'Food was successfully destroyed.' } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
|
||
# Use callbacks to share common setup or constraints between actions. | ||
def set_food | ||
@food = Food.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def food_params | ||
params.require(:food).permit(:name, :measure_unit, :price, :quantity, :user_id) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
class RecipeFoodsController < ApplicationController | ||
before_action :set_recipe_food, only: %i[show edit update destroy] | ||
|
||
# GET /recipe_foods or /recipe_foods.json | ||
def index | ||
@recipe_foods = RecipeFood.all | ||
end | ||
|
||
# GET /recipe_foods/1 or /recipe_foods/1.json | ||
def show; end | ||
|
||
# GET /recipe_foods/new | ||
def new | ||
@recipe_food = RecipeFood.new | ||
end | ||
|
||
# GET /recipe_foods/1/edit | ||
def edit; end | ||
|
||
# POST /recipe_foods or /recipe_foods.json | ||
def create | ||
@recipe_food = RecipeFood.new(recipe_food_params) | ||
|
||
respond_to do |format| | ||
if @recipe_food.save | ||
format.html { redirect_to recipe_food_url(@recipe_food), notice: 'Recipe food was successfully created.' } | ||
format.json { render :show, status: :created, location: @recipe_food } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @recipe_food.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /recipe_foods/1 or /recipe_foods/1.json | ||
def update | ||
respond_to do |format| | ||
if @recipe_food.update(recipe_food_params) | ||
format.html { redirect_to recipe_food_url(@recipe_food), notice: 'Recipe food was successfully updated.' } | ||
format.json { render :show, status: :ok, location: @recipe_food } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @recipe_food.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /recipe_foods/1 or /recipe_foods/1.json | ||
def destroy | ||
@recipe_food.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to recipe_foods_url, notice: 'Recipe food was successfully destroyed.' } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
|
||
# Use callbacks to share common setup or constraints between actions. | ||
def set_recipe_food | ||
@recipe_food = RecipeFood.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def recipe_food_params | ||
params.require(:recipe_food).permit(:quantity, :recipe_id, :food_id) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
class RecipesController < ApplicationController | ||
before_action :set_recipe, only: %i[show edit update destroy] | ||
|
||
# GET /recipes or /recipes.json | ||
def index | ||
@recipes = Recipe.all | ||
end | ||
|
||
# GET /recipes/1 or /recipes/1.json | ||
def show; end | ||
|
||
# GET /recipes/new | ||
def new | ||
@recipe = Recipe.new | ||
end | ||
|
||
# GET /recipes/1/edit | ||
def edit; end | ||
|
||
# POST /recipes or /recipes.json | ||
def create | ||
@recipe = Recipe.new(recipe_params) | ||
|
||
respond_to do |format| | ||
if @recipe.save | ||
format.html { redirect_to recipe_url(@recipe), notice: 'Recipe was successfully created.' } | ||
format.json { render :show, status: :created, location: @recipe } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @recipe.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /recipes/1 or /recipes/1.json | ||
def update | ||
respond_to do |format| | ||
if @recipe.update(recipe_params) | ||
format.html { redirect_to recipe_url(@recipe), notice: 'Recipe was successfully updated.' } | ||
format.json { render :show, status: :ok, location: @recipe } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @recipe.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /recipes/1 or /recipes/1.json | ||
def destroy | ||
@recipe.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to recipes_url, notice: 'Recipe was successfully destroyed.' } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
|
||
# Use callbacks to share common setup or constraints between actions. | ||
def set_recipe | ||
@recipe = Recipe.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def recipe_params | ||
params.require(:recipe).permit(:name, :prep_time, :cooking_time, :description, :public, :user_id) | ||
end | ||
end |
Oops, something went wrong.