diff --git a/README.md b/README.md index 7db80e4..204392d 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,150 @@ -# README +# 📗 Table of Contents -This README would normally document whatever steps are necessary to get the -application up and running. +- [📗 Table of Contents](#-table-of-contents) + - [📖 TDD Project ](#-oop-school-library--) + - [🛠 Built With ](#-built-with-) + - [Tech Stack ](#tech-stack-) + - [Key Features](#key-features) + - [🚀 Live Demo](#live-demo) + - [📽️ Video Presentation](#video) + - [💻 Getting Started ](#-getting-started-) + - [Prerequisites](#prerequisites) + - [Setup](#setup) + - [Install](#install) + - [Usage](#usage) + - [Authors ](#authors-) + - [🔭 Future Features ](#-future-features-) + - [🤝 Contributing ](#-contributing-) + - [⭐️ Show your support ](#️-show-your-support-) + - [🙏 Acknowledgments ](#-acknowledgments-) + - [📝 License ](#-license-) -Things you may want to cover: +## 📖 SpendSmart +SpendSmart is a web-based budgeting application built using Ruby on Rails and PostgreSQL. With SpendSmart, users can effortlessly track their income and expenses, gaining full control over their finances. 💰💼 -* Ruby version +## 🛠 Built With -* System dependencies +## Tech Stack -* Configuration +- [Ruby](https://www.ruby-lang.org/en/) +- [Ruby on Rails](https://rubyonrails.org/) +- [PostgreSQL](https://www.postgresql.org/) -* Database creation +## Key Features -* Database initialization +- [ ] **Register an account** +- [ ] **Login registered account** +- [ ] **Create categories and transactions** +- [ ] **Upload Profile photo** -* How to run the test suite +

(back to top)

-* Services (job queues, cache servers, search engines, etc.) +### 🚀 Live Demo -* Deployment instructions +- [SpendSmart](#) -* ... +### 📽️ Video Presentation + +[Video Presentation ] (https://www.loom.com/share/5d571397947b49f0a677c66a047801e0?sid=14c5b6cf-58cf-45bb-bf08-e4a63cb61bbb)-Powered by Loom + +

(back to top)

+ +## 💻 Getting Started + +To get a local copy up and running, follow these steps. + +## Prerequisites + +In order to run this project you need to install the following on your machine: +- [Ruby](https://www.ruby-lang.org/en/) +- [Ruby on Rails](https://rubyonrails.org/) +- [PostgreSQL](https://www.postgresql.org/) + +## Setup + +Clone this repository to your desired folder: + +Example commands: + +- Clone this repository using GitBash or the command Terminal: + +```sh +git clone https://github.com/Lucash2022/SpendSmart.git + + cd SpendSmart +``` + +## Install + +- Inside the project directory, install the project's dependencies: + +```sh + bundle install +``` + +- Create the app's database + +```sh +rails db:create +``` + +- Setup the app's database + +```sh + rails db:setup +``` +## Usage + +```sh +rails server +``` +- Runs the app local server + + +## Authors + +👤 **Lucas Erkana** + +- GitHub: [@Lucash2022](https://github.com/Lucash2022) +- Twitter: [@Lucas_David_22](https://twitter.com/@Lucas_David_22) +- LinkedIn: [Lucas Erkana](https://www.linkedin.com/in/lucas-erkana/) +- Frontend Mentor - [@PLucash2022](https://www.frontendmentor.io/profile/Lucash2022) + +

(back to top)

+ +## 🔭 Future Features + +- [ ] **Delete and edit transactions** +- [ ] **User profile settings** + +

(back to top)

+ +## 🤝 Contributing + +Contributions, issues, and feature requests are welcome! + +Feel free to check the [issues page](https://github.com/Lucash2022/SpendSmart/issues). + +

(back to top)

+ +## ⭐️ Show your support + +If you like this project please leave a star. Thank you 🙏 + +

(back to top)

+ +## 🙏 Acknowledgments + +- I would like to thank Microverse for the great project idea. ❤️ + - Credit goes to [Gregoire Vella on Behance](https://www.behance.net/gregoirevella) whose original design was used. + + Icons were used from [Flaticon](https://www.flaticon.com/) + +

(back to top)

+ +## 📝 License + +This project is [MIT](./LICENSE) licensed. + + +

(back to top)

diff --git a/app/assets/stylesheets/mobile_nav.css b/app/assets/stylesheets/mobile_nav.css index c489e7e..fa497eb 100644 --- a/app/assets/stylesheets/mobile_nav.css +++ b/app/assets/stylesheets/mobile_nav.css @@ -67,6 +67,16 @@ padding: 20px; } +.avatar-img { + width: 200px; /* Adjust the width to your desired size */ + height: 210px; /* Adjust the height to your desired size */ +} + +.rounded-circle { + border-radius: 50%; /* Make the image circular by setting border-radius to 50% */ + overflow: hidden; /* Hide any content that exceeds the circular boundaries */ +} + .profile-info-container p { margin-top: 5px; text-align: center; diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb new file mode 100644 index 0000000..31d7af5 --- /dev/null +++ b/app/controllers/registrations_controller.rb @@ -0,0 +1,8 @@ +# app/controllers/registrations_controller.rb +class RegistrationsController < Devise::RegistrationsController + private + + def sign_up_params + params.require(:user).permit(:name, :email, :password, :password_confirmation, :photo) + end +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 779f395..4aa1ded 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -20,6 +20,10 @@ def edit; end # POST /users or /users.json def create @user = User.new(user_params) + @user.photo = params[:user][:photo] + puts "Photo URL: #{params[:user][:photo]}" + puts "User Photo: #{@user.photo}" + puts "User: #{@user}" respond_to do |format| if @user.save @@ -64,6 +68,6 @@ def set_user # Only allow a list of trusted parameters through. def user_params - params.require(:user).permit(:name) + params.require(:user).permit(:name, :email, :password, :password_confirmation, :photo) end end diff --git a/app/models/user.rb b/app/models/user.rb index da4bea6..c680471 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,6 +6,6 @@ class User < ApplicationRecord has_many :categories, foreign_key: 'author_id' has_many :entities, foreign_key: 'author_id' - + attribute :photo, :string validates :name, presence: true, length: { maximum: 50 } end diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index f42e671..c0d8a5e 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -21,6 +21,9 @@ <%= f.label :name %> <%= f.text_field :name, autofocus: true, placeholder: "Full name", required: true %> + <%= f.label :photo %> + <%= f.text_field :photo, placeholder: "Photo URL", required: false %> + <%= f.label :email %> <%= f.email_field :email, autocomplete: "email", placeholder: "Email", required: true %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2f74cf4..6048c02 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -16,12 +16,18 @@
-
-
- -
-

<%= current_user.name.split(' ').first %>

-
+
+
+ <% if user_signed_in? && current_user.photo.present? %> + <%= image_tag current_user.photo, class: "avatar-img rounded-circle" %> + <% else %> + + <% end %> +
+

<%= current_user.name.split(' ').first %>

+
+ +