-
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
27 changed files
with
290 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,3 +75,5 @@ group :test do | |
gem 'selenium-webdriver' | ||
gem 'webdrivers' | ||
end | ||
|
||
gem 'cancancan' |
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 |
---|---|---|
@@ -1,24 +1,175 @@ | ||
# README | ||
<h2>Recipe-App</h2> | ||
<img src="app/assets/images/cook-book.png" alt="Icon" width="100px" height="100px" /> | ||
<br> | ||
<br> | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
# 📗 Table of Contents | ||
- [📖 About the Project](#about-project) | ||
- [🛠 Built With](#built-with) | ||
- [Tech Stack](#tech-stack) | ||
- [Key Features](#key-features) | ||
- [💻 Getting Started](#getting-started) | ||
- [Setup](#setup) | ||
- [Prerequisites](#prerequisites) | ||
- [Install](#install) | ||
- [Usage](#usage) | ||
- [Run tests](#run-tests) | ||
- [Deployment](#triangular_flag_on_post-deployment) | ||
- [👥 Authors](#authors) | ||
- [🔭 Future Features](#future-features) | ||
- [🤝 Contributing](#contributing) | ||
- [⭐️ Show your support](#support) | ||
- [🙏 Acknowledgements](#acknowledgements) | ||
- [📝 License](#license) | ||
|
||
Things you may want to cover: | ||
# 📖 Recipe-App <a name="about-project"></a> | ||
Recipe App is a robust and user-friendly recipe application built using Ruby on Rails, leveraging the power of Bootstrap, Devise, and Capybara gems. Seamlessly create, discover, and share recipes with it. It offers a delightful cooking experience with its intuitive interface and extensive features. | ||
**Recipe-App** | ||
## 🛠 Built With <a name="built-with"></a> | ||
PostgresSQL | ||
Ruby on rails | ||
### Tech Stack <a name="tech-stack"></a> | ||
|
||
* Ruby version | ||
<details> | ||
<ul> | ||
<li><a href="https://www.ruby-lang.org/en/">Ruby</a></li> | ||
<li><a href="https://rubyonrails.org/">Ruby on rails</a></li> | ||
<li><a href="https://www.postgresql.org/">PSQL</a></li> | ||
</ul> | ||
</details> | ||
<br> | ||
|
||
* System dependencies | ||
### Key Features <a name="key-features"></a> | ||
<details> | ||
<ul> | ||
<li>Add Foods with its value and measure unit</li> | ||
<li>Add Recipes with its cooking time and prep time</li> | ||
<li>If recipe is made public by that user than it shows under public recipes page</li> | ||
</ul> | ||
</details> | ||
|
||
* Configuration | ||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
* Database creation | ||
|
||
* Database initialization | ||
## 💻 Getting Started <a name="getting-started"></a> | ||
<br> | ||
|
||
* How to run the test suite | ||
### Prerequisites | ||
<details> | ||
<p>In order to run this project you need:</p> | ||
<ul> | ||
<li>Ruby installed</li> | ||
<li>Add Recipes with its cooking time and prep time</li> | ||
<li>rbenv installed</li> | ||
</ul> | ||
</details> | ||
<br> | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
|
||
* Deployment instructions | ||
### Setup | ||
|
||
* ... | ||
Clone this repository to your desired folder: | ||
|
||
git clone https://github.com/anas599/Recipe-app.git | ||
cd Recipe-App | ||
|
||
|
||
<br> | ||
|
||
|
||
### Install | ||
|
||
|
||
<details> | ||
<p>Install this project with:</p> | ||
<ul> | ||
<li> cd Recipe-app</li> | ||
<li> run rails server</li> | ||
</ul> | ||
</details> | ||
<br> | ||
|
||
|
||
### Usage | ||
<details> | ||
<p>To run the project, execute the following command:</p> | ||
<ul> | ||
<li> cd Recipe-app</li> | ||
<li> run rails server</li> | ||
</ul> | ||
</details> | ||
<br> | ||
|
||
|
||
|
||
### Run tests | ||
<details> | ||
<p>To run tests, run the following command:</p> | ||
<ul> | ||
<li>rspec</li> | ||
</ul> | ||
</details> | ||
<br> | ||
|
||
|
||
### Deployment | ||
<details> | ||
<p>You can deploy this project using:</p> | ||
<ul> | ||
<li>Heroku</li> | ||
</ul> | ||
</details> | ||
<br> | ||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p>👥 Authors <a name="authors"></a> | ||
|
||
👤 **ANAS ALSAMMARRAIE** | ||
|
||
- GitHub: [@anas599](https://github.com/anas599) | ||
- Twitter: [@anas599](https://twitter.com/anas599) | ||
- LinkedIn: [anas1993](https://linkedin.com/in/anas1993) | ||
|
||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
|
||
## 🔭 Future Features <a name="future-features"></a> | ||
<details> | ||
<ul> | ||
<li>Add videos for new data</li> | ||
<li>Add images of food</li> | ||
<li>Update style</li> | ||
</ul> | ||
</details> | ||
<br> | ||
|
||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
|
||
## 🤝 Contributing <a name="contributing"></a> | ||
|
||
Contributions, issues, and feature requests are welcome! | ||
|
||
Feel free to check the [issues page](../../issues/). | ||
|
||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
## ⭐️ Show your support <a name="support"></a> | ||
|
||
> If you like the project Please do not hesitate if you have any questions | ||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
## 🙏 Acknowledgments <a name="acknowledgements"></a> | ||
|
||
> I would like to thank Microverse for this project based learning | ||
<p align="right">(<a href="#readme-top">back to top</a>)</p> | ||
|
||
## 📝 License <a name="license"></a> | ||
|
||
This project is [MIT](./LICENSE) licensed. | ||
|
||
<p align="right">(<a href="#readme-top">back to top</a>)</p> |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class PublicRecipesController < ApplicationController | ||
def index | ||
@public_recipes = Recipe.where(public: true) | ||
@public_recipes = Recipe.where(public: true).order(created_at: :desc) | ||
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 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,36 @@ | ||
class Ability | ||
include CanCan::Ability | ||
|
||
def initialize(user) | ||
# Define abilities for the user here. For example: | ||
# | ||
# return unless user.present? | ||
# can :read, :all | ||
# return unless user.admin? | ||
# can :manage, :all | ||
# | ||
# The first argument to `can` is the action you are giving the user | ||
# permission to do. | ||
# If you pass :manage it will apply to every action. Other common actions | ||
# here are :read, :create, :update and :destroy. | ||
# | ||
# The second argument is the resource the user can perform the action on. | ||
# If you pass :all it will apply to every resource. Otherwise pass a Ruby | ||
# class of the resource. | ||
# | ||
# The third argument is an optional hash of conditions to further filter the | ||
# objects. | ||
# For example, here the user can only update published articles. | ||
# | ||
# can :update, Article, published: true | ||
# | ||
# See the wiki for details: | ||
# https://github.com/CanCanCommunity/cancancan/blob/develop/docs/define_check_abilities.md | ||
|
||
user ||= User.new | ||
|
||
can :read, :all | ||
can :manage, Food, user_id: user.id | ||
can :manage, Recipe, user_id: 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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
class Food < ApplicationRecord | ||
belongs_to :user | ||
validates :name, presence: true | ||
validates :measure_unit, presence: true, inclusion: { in: %w[Gram Pound Unit] } | ||
validates :price, presence: true, numericality: { only_integer: true } | ||
validates :quantity, presence: true, numericality: { only_integer: true } | ||
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
class Recipe < ApplicationRecord | ||
belongs_to :user | ||
has_many :recipe_foods | ||
validates :name, presence: true | ||
validates :description, presence: true | ||
validates :cooking_time, presence: true, numericality: { only_integer: true } | ||
validates :prep_time, presence: true, numericality: { only_integer: true } | ||
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 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<%= render @food %> | ||
|
||
|
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 |
---|---|---|
|
@@ -5,20 +5,21 @@ | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<%= csrf_meta_tags %> | ||
<%= csp_meta_tag %> | ||
|
||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> | ||
<%= stylesheet_link_tag 'custom', 'data-turbo-track': 'reload' %> | ||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"> | ||
</head> | ||
<%=render "shared/navbar"%> | ||
|
||
<body> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> | ||
|
||
<div class="container"> | ||
<%= yield %> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> | ||
<div class="container"> | ||
<% flash.each do |key, value| %> | ||
<div class="alert <%= bootstrap_alert_class(key) %> alert-dismissible fade show" role="alert"> | ||
<%= value %> | ||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> | ||
</div> | ||
<% end %> <%= yield %> | ||
</div> | ||
|
||
</body> | ||
</html> |
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<h1>Recipe foods</h1> | ||
|
||
|
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,4 +1,3 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<%= render @recipe_food %> | ||
|
||
|
Oops, something went wrong.