diff --git a/Gemfile b/Gemfile index 9296891..1b142a1 100644 --- a/Gemfile +++ b/Gemfile @@ -56,6 +56,15 @@ group :test do gem "selenium-webdriver" end +# QR code generation +# RQRCode gem for generating QR codes gem "rqrcode", "~> 2.2" +# Password management (if uncommented earlier) gem "bcrypt", "~> 3.1.7" + +# Frontend styling +# Bootstrap for styling and responsive design +gem "bootstrap" +# SassC-rails for integrating Sass with Rails +gem "sassc-rails" diff --git a/Gemfile.lock b/Gemfile.lock index b22c631..8417f74 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -74,12 +74,17 @@ GEM addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) + autoprefixer-rails (10.4.19.0) + execjs (~> 2) base64 (0.2.0) bcrypt (3.1.20) bigdecimal (3.1.8) bindex (0.8.1) bootsnap (1.18.4) msgpack (~> 1.2) + bootstrap (5.3.3) + autoprefixer-rails (>= 9.1.0) + popper_js (>= 2.11.8, < 3) brakeman (6.2.1) racc builder (3.3.0) @@ -102,6 +107,13 @@ GEM reline (>= 0.3.8) drb (2.2.1) erubi (1.13.0) + execjs (2.9.1) + ffi (1.17.0-aarch64-linux-gnu) + ffi (1.17.0-arm-linux-gnu) + ffi (1.17.0-arm64-darwin) + ffi (1.17.0-x86-linux-gnu) + ffi (1.17.0-x86_64-darwin) + ffi (1.17.0-x86_64-linux-gnu) globalid (1.2.1) activesupport (>= 6.1) i18n (1.14.5) @@ -159,6 +171,7 @@ GEM ast (~> 2.4.1) racc pg (1.5.7) + popper_js (2.11.8) psych (5.1.2) stringio public_suffix (6.0.1) @@ -245,6 +258,14 @@ GEM rubocop-rails ruby-progressbar (1.13.0) rubyzip (2.3.2) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt securerandom (0.3.1) selenium-webdriver (4.24.0) base64 (~> 0.2) @@ -264,6 +285,7 @@ GEM stringio (3.1.1) strscan (3.1.0) thor (1.3.2) + tilt (2.4.0) timeout (0.4.1) turbo-rails (2.0.6) actionpack (>= 6.0.0) @@ -298,6 +320,7 @@ PLATFORMS DEPENDENCIES bcrypt (~> 3.1.7) bootsnap + bootstrap brakeman capybara debug @@ -308,6 +331,7 @@ DEPENDENCIES rails (~> 7.2.1) rqrcode (~> 2.2) rubocop-rails-omakase + sassc-rails selenium-webdriver sprockets-rails stimulus-rails diff --git a/README.md b/README.md index e787204..e6017ae 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,91 @@ -# Pet Register System +# Pet Tag Generator -This README would normally document whatever steps are necessary to get the -application up and running. +[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Release Version](https://img.shields.io/github/release/sarahcssiqueira/pet-tag-generator.svg)](https://github.com/sarahcssiqueira/pet-tag-generator/releases/latest) +[![Support Level](https://img.shields.io/badge/support-may_take_time-yellow.svg)](#support-level) -Things you may want to cover: +Welcome to the Pet Tag Generator! This open-source project provides an easy way to create personalized pet tags with QR codes, ensuring your pets are always safe and secure. -* Ruby version +## Features -* System dependencies +- **Free and Easy**: Create pet tags at no cost. +- **Custom QR Codes**: Generate unique QR codes linked to a webpage with your pet's information. +- **Update Anytime**: Modify your pet’s information through the website as needed. +- **Secure**: Only authorized users can view or update the pet information. +- **Vet-Friendly**: Ideal for veterinarians to use in their consultories for providing clients with customizable pet tags. -* Configuration +## Getting Started -* Database creation +To get started with the Pet Tag Generator, follow these steps: -* Database initialization +### Prerequisites -* How to run the test suite +- Ruby (version `3.3.3` or later) +- Rails (version `7.2.1` or later) +- PostgreSQL (or your preferred database) +- Node.js and Yarn (for managing JavaScript dependencies) -* Services (job queues, cache servers, search engines, etc.) +### Installation -* Deployment instructions +1. Clone the Repository -* ... + `git clone https://github.com/your-username/pet-tag-generator.git` -## Webpacker + `cd -pet-tag-generator` -. Install Webpacker -If your Rails app doesn’t already use Webpacker, you can add it by running: +2. Install Gems -bash +`bundle install` -rails webpacker:install +3. Setup Database -This command sets up Webpacker in your Rails app. -2. Enable Hot Module Replacement (HMR) +```bash -Webpacker supports HMR, which allows you to see changes in your frontend code without needing to refresh the entire page. -a. Development Server +rails db:create +rails db:migrate +rails db:seed +``` -To enable HMR, you need to run the Webpack development server. Webpacker installs this automatically. You can start it by running: +4. Run the Rails Server -bash +`rails server` -bin/webpack-dev-server +Visit http://localhost:3000 in your browser to see the application in action. -This server watches your frontend files and applies updates as you make changes. -b. Configuration +### Usage -Ensure that your config/webpacker.yml file is configured for development. By default, Webpacker is set up to use HMR in development, but you can check the development section to make sure hmr is enabled: +- Register Your Pet: Fill out a form with your pet’s details. +- Generate QR Code: Create and print a QR code linked to your pet’s information. +- Attach: Put the QR code on your pet’s collar or tag. +- Update Information: Log in to update your pet’s details as needed. + +### Vet Use + +Veterinarians can integrate this tool into their consultories, allowing pet owners to easily create and manage customized pet tags. This feature enhances the safety and security of pets and provides an additional service for clients. + +### Deployment + + +### Contributing + +We welcome contributions to enhance the Free Pet Tag Generator. To contribute: + +- Fork the repository. +- Create a new branch (git checkout -b feature-branch). +- Commit your changes (git commit -am 'Add new feature'). +- Push to the branch (git push origin feature-branch). +- Open a Pull Request. + +### License + +This project is licensed under the MIT License - see the LICENSE file for details. +Acknowledgements + +- Bootstrap for styling. +- QR Code Libraries for QR code generation. + +### Contact + +For any questions or feedback, please open an issue on GitHub. \ No newline at end of file diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.scss similarity index 97% rename from app/assets/stylesheets/application.css rename to app/assets/stylesheets/application.scss index 288b9ab..05c538d 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.scss @@ -13,3 +13,5 @@ *= require_tree . *= require_self */ + + @import "bootstrap"; \ No newline at end of file diff --git a/app/controllers/privacy_policy_controller.rb b/app/controllers/privacy_policy_controller.rb new file mode 100644 index 0000000..5155b37 --- /dev/null +++ b/app/controllers/privacy_policy_controller.rb @@ -0,0 +1,4 @@ +class PrivacyPolicyController < ApplicationController + def index + end +end diff --git a/app/helpers/privacy_policy_helper.rb b/app/helpers/privacy_policy_helper.rb new file mode 100644 index 0000000..e10fd15 --- /dev/null +++ b/app/helpers/privacy_policy_helper.rb @@ -0,0 +1,2 @@ +module PrivacyPolicyHelper +end diff --git a/app/javascript/application.js b/app/javascript/application.js index 0d7b494..aea1163 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,3 +1,5 @@ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails import "@hotwired/turbo-rails" import "controllers" +import "popper" +import "bootstrap" diff --git a/app/javascript/print_section.js b/app/javascript/print_section.js new file mode 100644 index 0000000..f385a70 --- /dev/null +++ b/app/javascript/print_section.js @@ -0,0 +1,11 @@ +function printDiv(divName) { + var printContents = document.getElementById(divName).innerHTML; + var originalContents = document.body.innerHTML; + + document.body.innerHTML = printContents; + + window.print(); + + document.body.innerHTML = originalContents; + } + \ No newline at end of file diff --git a/app/models/pet.rb b/app/models/pet.rb index cd1a6de..f02acef 100644 --- a/app/models/pet.rb +++ b/app/models/pet.rb @@ -7,6 +7,15 @@ class Pet < ApplicationRecord # ActiveStorage association for the image has_one_attached :pet_photo + validate :pet_photo_size + + private + + def pet_photo_size + if pet_photo.attached? && pet_photo.byte_size > 1.megabyte + errors.add(:pet_photo, "size should be less than 1MB") + end + end include Rails.application.routes.url_helpers diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 2085730..77c2122 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,2 +1,52 @@ -

Home#index

-

Find me in app/views/home/index.html.erb

+
+
+

Welcome to the Free Pet Tag Generator!

+
+
+ +
+
+

Give Your Pet the Safety They Deserve

+

We believe every pet deserves to be safe and secure. That's why we're excited to introduce our Free Pet Tag Generator – a simple and efficient way to ensure your furry friends are always protected.

+
+ +
+

What is the Free Pet Tag Generator?

+

Our Free Pet Tag Generator is an easy-to-use online tool that lets you create personalized pet tags at no cost. With just a few clicks, you can generate a unique QR code that will be linked to a dedicated webpage with all the information you provide about your pet.

+
+ +
+

How It Works

+ +
+ +
+

Why Use This Pet Tag Generator?

+ +
+ +
+

Ready to Get Started?

+
    +
  1. Visit <%= link_to 'the register page', pets_path, class: 'cta-button' %>
  2. +
  3. Register Your Pet
  4. +
  5. Generate Your QR Code
  6. +
  7. Print and Attach
  8. +
+ +

Make sure your pet is always safe and secure with our Free Pet Tag Generator. It’s a small step that can make a big difference.

+ + <%= link_to 'Get Started Now!', pets_path, class: 'cta-button' %> +
+
+ diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb new file mode 100644 index 0000000..7f2b96d --- /dev/null +++ b/app/views/layouts/_footer.html.erb @@ -0,0 +1,33 @@ + diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb index 3522d86..c4c25bf 100644 --- a/app/views/layouts/_navbar.html.erb +++ b/app/views/layouts/_navbar.html.erb @@ -1,19 +1,32 @@ - + +
+ +
\ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 64981ac..c9eb67c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -19,15 +19,13 @@ <%= render 'layouts/navbar' %> - <%= yield %> - <% if logged_in? %> - <%= link_to 'Log Out', logout_path, method: :delete %> - <% else %> - <%= link_to 'Log In', login_path %> - <%= link_to 'Sign Up', new_user_path %> - <%= link_to "Logout", logout_path, method: :delete, data: { confirm: "Are you sure?" } %> +
+ <%= yield %> +
-<% end %> + + <%= render 'layouts/footer' %> + diff --git a/app/views/pets/_form.html.erb b/app/views/pets/_form.html.erb index 2063837..9b4e0a5 100644 --- a/app/views/pets/_form.html.erb +++ b/app/views/pets/_form.html.erb @@ -1,8 +1,7 @@ -<%= form_with(model: pet) do |form| %> +<%= form_with(model: pet, local: true) do |form| %> <% if pet.errors.any? %> -
-

<%= pluralize(pet.errors.count, "error") %> prohibited this pet from being saved:

- +
+

<%= pluralize(pet.errors.count, "error") %> prohibited this pet from being saved:

<% end %> -
- <%= form.label :name, style: "display: block" %> - <%= form.text_field :name %> +
+ <%= form.label :name, class: "form-label" %> + <%= form.text_field :name, class: "form-control", required: true %>
-
- <%= form.label :tutor, style: "display: block" %> - <%= form.text_field :tutor %> +
+ <%= form.label :tutor, class: "form-label" %> + <%= form.text_field :tutor, class: "form-control" %> +
+ +
+ <%= form.label :pet_race, class: "form-label" %> + <%= form.text_field :pet_race, class: "form-control" %> +
+ +
+ <%= form.label :tutors_contact, class: "form-label" %> + <%= form.text_field :tutors_contact, class: "form-control" %> +
+ +
+ <%= form.label :pet_coat_color, class: "form-label" %> + <%= form.text_field :pet_coat_color, class: "form-control" %> +
+ +
+ <%= form.label :pet_photo, class: "form-label" %> + <%= form.file_field :pet_photo, class: "form-control", accept: "image/*" %> + Max size: 1MB +
+ +
+ <%= form.label :pet_city, class: "form-label" %> + <%= form.text_field :pet_city, class: "form-control" %> +
+ +
+ <%= form.label :pet_instagram, class: "form-label" %> + <%= form.text_field :pet_instagram, class: "form-control" %> +
+ +
+ <%= form.label :pet_tiktok, class: "form-label" %> + <%= form.text_field :pet_tiktok, class: "form-control" %>
-
- <%= form.label :pet_birthdate, style: "display: block" %> - <%= form.text_field :pet_birthdate %> +
+ <%= form.label :pet_birthdate, class: "form-label" %> + <%= form.date_field :pet_birthdate, class: "form-control" %>
- <%= form.submit %> + <%= form.submit "Save Pet", class: "btn btn-primary" %>
<% end %> diff --git a/app/views/pets/_pet.html.erb b/app/views/pets/_pet.html.erb index adedf77..71ffed6 100644 --- a/app/views/pets/_pet.html.erb +++ b/app/views/pets/_pet.html.erb @@ -1,51 +1,76 @@
-

- Name: - <%= pet.name %> -

+
+

+ <% if pet.name.present? %> + Name: + <%= pet.name %> + <% end %> +

-

- Tutor: - <%= pet.tutor %> -

+

+ <% if pet.tutor.present? %> + Tutor: + <%= pet.tutor %> + <% end %> +

+ <% if pet.pet_race.present? %> +

+ Race: + <%= pet.pet_race %> +

+ <% end %> + <% if pet.tutors_contact.present? %> +

+ Tutor's contact: + <%= pet.tutors_contact %> +

+ <% end %> -

- Race: - <%= pet.pet_race %> -

+ <% if pet.pet_coat_color.present? %> +

+ Coat Color: + <%= pet.pet_coat_color %> +

+ <% end %> -

- Tutor's contact: - <%= pet.tutors_contact %> -

+ <% if pet.pet_photo.present? %> +

+ Photo:
+ <%= image_tag pet.pet_photo, alt: "#{pet.name} photo", class: "img-fluid" %> +

+ <% end %> -

- Coat Color: - <%= pet.pet_coat_color %> -

+ <% if pet.pet_city.present? %> +

+ City: + <%= pet.pet_city %> +

+ <% end %> -

- Photo: - <%= pet.pet_photo %> -

+ <% if pet.pet_instagram.present? %> +

+ Instagram: + <%= pet.pet_instagram %> +

+ <% end %> -

- City: - <%= pet.pet_city %> -

+ <% if pet.pet_tiktok.present? %> +

+ TikTok: + <%= pet.pet_tiktok %> +

+ <% end %> +
-

- Instagram: - <%= pet.pet_instagram %> -

+ <%= javascript_include_tag 'print_section' %> -

- Tik Tok: - <%= pet.pet_tiktok %> -

+

Print Pet QR Code

- <%= image_tag(url_for(pet.qrcode)) %> +
+ <%= image_tag(url_for(pet.qrcode), class: "img-fluid") %> +
+
diff --git a/app/views/pets/index.html.erb b/app/views/pets/index.html.erb index f09f7e9..04906e5 100644 --- a/app/views/pets/index.html.erb +++ b/app/views/pets/index.html.erb @@ -2,16 +2,25 @@ <% content_for :title, "Pets" %> -

Pets List

+

Pet Members

- <% @pets.each do |pet| %> - <%= render pet %> -

- <%= link_to "Show this pet", pet %> -

- <% end %> - +
+
+ <% @pets.each do |pet| %> +
+
+
+ <%= render pet %> +

+ <%= link_to "Show pet", pet, class: "btn btn-primary" %> +

+
+
+
+ <% end %> +
+
-<%= link_to "New pet", new_pet_path %> +<%= link_to "Register new pet", new_pet_path, class: "btn btn-success mt-3" %> diff --git a/app/views/pets/new.html.erb b/app/views/pets/new.html.erb index beb1ab1..90dc1f7 100644 --- a/app/views/pets/new.html.erb +++ b/app/views/pets/new.html.erb @@ -1,6 +1,6 @@ <% content_for :title, "New pet" %> -

New pet

+

Register new pet

<%= render "form", pet: @pet %> diff --git a/app/views/pets/show.html.erb b/app/views/pets/show.html.erb index 4ebc28b..1f6e1fb 100644 --- a/app/views/pets/show.html.erb +++ b/app/views/pets/show.html.erb @@ -3,8 +3,8 @@ <%= render @pet %>
- <%= link_to "Edit this pet", edit_pet_path(@pet) %> | - <%= link_to "Back to pets", pets_path %> + <%= link_to "Update pet", edit_pet_path(@pet) %> | + <%= link_to "Back to pet members", pets_path %> <%= button_to "Destroy this pet", @pet, method: :delete %>
diff --git a/app/views/privacy_policy/index.html.erb b/app/views/privacy_policy/index.html.erb new file mode 100644 index 0000000..b03fbed --- /dev/null +++ b/app/views/privacy_policy/index.html.erb @@ -0,0 +1,64 @@ + +
+

Privacy Policy

+ +

Welcome to [Pet Tag Generator] ("Project"). We are an open-source initiative committed to transparency and protecting your privacy. This privacy policy explains how we collect, use, and protect your personal information when you use our open-source project to generate QR codes for your pets.

+ +

Data We Collect

+ +

1. Personal Information:

+
    +
  • Name: We collect your name to personalize your QR code.
  • +
  • Email Address: We collect your email address to communicate with you if necessary, such as for support or updates related to the Project.
  • +
+ +

2. Pet Data:

+
    +
  • Pet Information: We collect details about your pet to generate a unique QR code. This may include your pet's name, breed, and any other relevant information you provide.
  • +
+ +

How We Use Your Data

+ +
    +
  • QR Code Generation: We use the collected data to generate QR codes for your pets. These QR codes can be used as-is and include the pet information you provided.
  • +
  • Communication: We may use your email address to send you updates about the Project, respond to your inquiries, or provide support.
  • +
+ +

Data Storage and Security

+ +
    +
  • Storage: Your data is stored securely on our servers. We take reasonable steps to protect your data from unauthorized access, disclosure, alteration, or destruction.
  • +
  • Security Measures: We use encryption and other security measures to safeguard your personal and pet data.
  • +
+ +

Data Sharing

+ +

Third Parties: We do not share your personal or pet data with third parties. Your data is used solely for generating the QR codes and for communication related to the Project.

+ +

Your Rights

+ +
    +
  • Access and Correction: You have the right to access and update your personal information. If you need to correct or delete any data, please contact us.
  • +
  • Opt-Out: If you no longer wish to receive communications from us, you may opt out by following the unsubscribe instructions in the emails we send or by contacting us directly.
  • +
+ +

Cookies and Tracking

+ +

Cookies: We do not use cookies or other tracking technologies on our Project.

+ +

Legal Compliance

+ +
    +
  • Regulations: We comply with applicable data protection laws, including the General Data Protection Regulation (GDPR) and the California Consumer Privacy Act (CCPA), as applicable.
  • +
  • Legal Requirements: We adhere to legal requirements regarding the collection and use of personal data.
  • +
+ +

Open Source Transparency

+ +

As an open-source project, our code and processes are publicly available for review and contribution. We believe in transparency and encourage community involvement to ensure the integrity and security of our Project.

+ +

Changes to This Privacy Policy

+ +

We may update this privacy policy from time to time. Any changes will be posted on this page with an updated effective date. We encourage you to review this policy periodically to stay informed about how we are protecting your data.

+ +
\ No newline at end of file diff --git a/config/importmap.rb b/config/importmap.rb index 909dfc5..277f672 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -5,3 +5,5 @@ pin "@hotwired/stimulus", to: "stimulus.min.js" pin "@hotwired/stimulus-loading", to: "stimulus-loading.js" pin_all_from "app/javascript/controllers", under: "controllers" +pin "popper", to: "popper.js", preload: true +pin "bootstrap", to: "bootstrap.min.js", preload: true diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index bd5bcd2..3cfd2bf 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,6 +3,9 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = "1.0" +# Bootsrap +Rails.application.config.assets.precompile += %w[ bootstrap.min.js popper.js] + # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path diff --git a/config/routes.rb b/config/routes.rb index 3b4cc23..9bd10bc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,7 @@ resources :users, only: [ :new, :create, :show, :delete ] resources :pets, only: [ :index, :show, :new, :create, :edit, :update, :destroy ] resources :sessions, only: [ :new, :create, :destroy ] + resources :privacy_policy get "home/index" root "home#index" @@ -19,4 +20,11 @@ get "/login", to: "sessions#new", as: "login" post "/login", to: "sessions#create" delete "/logout", to: "sessions#destroy", as: "logout" + + # Privacy Policy + get "/privacy-policy", to: "privacy_policy#index" + + + # Define a route for the external URL + get "github_repo", to: proc { |env| [ 302, { "Location" => "https://github.com/sarahcssiqueira/pet-tag-generator" }, [] ] } end diff --git a/test/controllers/privacy_policy_controller_test.rb b/test/controllers/privacy_policy_controller_test.rb new file mode 100644 index 0000000..969f4b4 --- /dev/null +++ b/test/controllers/privacy_policy_controller_test.rb @@ -0,0 +1,8 @@ +require "test_helper" + +class PrivacyPolicyControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get privacy_policy_index_url + assert_response :success + end +end