Skip to content

Commit

Permalink
Format styles
Browse files Browse the repository at this point in the history
  • Loading branch information
dvnishshanka committed Jan 5, 2023
1 parent ff5848a commit 1968a0c
Show file tree
Hide file tree
Showing 22 changed files with 255 additions and 300 deletions.
16 changes: 8 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ gem "stimulus-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

#####new gems####
# ####new gems####
# Faker
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
gem 'faker', git: 'https://github.com/faker-ruby/faker.git', branch: 'main'

gem "dotenv-rails", groups: [:development, :test]
gem "cloudinary"
# gem for authentication
gem "devise"
Expand All @@ -41,6 +40,8 @@ gem "simple_form", github: "heartcombo/simple_form"
# Geocoder
gem "geocoder"

gem 'rubocop', '~> 1.42', require: false

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"

Expand All @@ -51,7 +52,7 @@ gem "geocoder"
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
Expand All @@ -62,17 +63,16 @@ gem "sassc-rails"
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

#custom gem files
# custom gem files
gem "autoprefixer-rails"
gem "font-awesome-sass", "~> 6.1"
gem "dotenv-rails", groups: [:development, :test]
gem "dotenv-rails", groups: %i[development test]
gem "pg_search"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri mingw x64_mingw ]
gem "debug", platforms: %i[mri mingw x64_mingw]
gem "dotenv-rails"

end

group :development do
Expand Down
21 changes: 21 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ GEM
tzinfo (~> 2.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
autoprefixer-rails (10.4.7.0)
execjs (~> 2)
aws_cf_signer (0.1.3)
Expand Down Expand Up @@ -143,6 +144,7 @@ GEM
activesupport (>= 5.0.0)
jsbundling-rails (1.0.3)
railties (>= 6.0.0)
json (2.6.3)
loofah (2.19.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
Expand Down Expand Up @@ -172,6 +174,9 @@ GEM
nokogiri (1.13.9-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
parallel (1.22.1)
parser (3.2.0.0)
ast (~> 2.4.1)
pg (1.4.4)
pg_search (2.3.6)
activerecord (>= 5.2)
Expand Down Expand Up @@ -209,6 +214,7 @@ GEM
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.6.0)
reline (0.3.1)
Expand All @@ -222,6 +228,19 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rubocop (1.42.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.24.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
rubyzip (2.3.2)
sassc (2.4.0)
ffi (~> 1.9)
Expand Down Expand Up @@ -257,6 +276,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (2.4.2)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.0)
Expand Down Expand Up @@ -297,6 +317,7 @@ DEPENDENCIES
pg_search
puma (~> 5.0)
rails (~> 7.0.4)
rubocop (~> 1.42)
sassc-rails
selenium-webdriver
simple_form!
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ class ApplicationController < ActionController::Base

def configure_permitted_parameters
# For additional fields in app/views/devise/registrations/new.html.erb
devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :city])
devise_parameter_sanitizer.permit(:sign_up, keys: %i[first_name last_name city])

# For additional in app/views/devise/registrations/edit.html.erb
devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :city])
devise_parameter_sanitizer.permit(:account_update, keys: %i[first_name last_name city])
end
end
3 changes: 1 addition & 2 deletions app/controllers/bookings_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class BookingsController < ApplicationController
before_action :set_booking, only: [:show]
before_action :set_pet, only: [:new, :create]

before_action :set_pet, only: %i[new create]

def index
@bookings = current_user.bookings
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def map
{
lat: pet.latitude,
lng: pet.longitude,
info_window: render_to_string(partial: "shared/info_window", locals: { pet: pet}),
info_window: render_to_string(partial: "shared/info_window", locals: { pet: }),
image_url: helpers.asset_url("green-paw.png")
}
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/pets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ def index
@specific_city = params[:city]
@less_than_price = params[:price].to_i


# if (@specific_pet == "" || @specific_pet.nil?) && (@specific_city == "" || @specific_city.nil?) && (@less_than_price == "" || @less_than_price.nil?)
@pets = Pet.all
@pets = Pet.all
# else
# raise
# @pets = Pet.where(species: @specific_pet).where(city: @specific_city).where("price < ?", @less_than_price)
Expand Down
8 changes: 4 additions & 4 deletions app/models/pet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class Pet < ApplicationRecord

include PgSearch::Model
pg_search_scope :global_search,
against: [ :name, :species, :category, :address, :city ],
using: {
tsearch: { prefix: true }
}
against: %i[name species category address city],
using: {
tsearch: { prefix: true }
}

def check_species(input)
case input
Expand Down
32 changes: 16 additions & 16 deletions app/views/bookings/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<div class="container">
<div class="form-control" style="background-color:white;border: none">
<h2>Book a date with <br><%= @pet.name %> ?</h2>
<%= form_with model: [@pet, @booking], authenticity_token: true do |f| %>
<%= f.text_field :start_date, placeholder: 'Start Date', label:false,
data: {
controller: "flatpickr",
flatpickr_date_format: "d-m-Y",
flatpickr_min_date: Time.zone.now #disables past dates
} %>
<%= f.text_field :end_date, placeholder: 'End Date', label:false,
data: {
controller: "flatpickr",
flatpickr_date_format: "d-m-Y",
flatpickr_min_date: Time.zone.now #disables past dates
} %>
<h2>Book a date with <br><%= @pet.name %> ?</h2>
<%= form_with model: [@pet, @booking], authenticity_token: true do |f| %>
<%= f.text_field :start_date, placeholder: 'Start Date', label:false,
data: {
controller: "flatpickr",
flatpickr_date_format: "d-m-Y",
flatpickr_min_date: Time.zone.now #disables past dates
} %>
<%= f.text_field :end_date, placeholder: 'End Date', label:false,
data: {
controller: "flatpickr",
flatpickr_date_format: "d-m-Y",
flatpickr_min_date: Time.zone.now #disables past dates
} %>
<div class="container d-flex justify-content-end">
<%= f.submit class: "btn-green" %>
</div>
<% end %>
</div>
<% end %>
</div>
</div>
79 changes: 37 additions & 42 deletions app/views/bookings/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,49 +1,44 @@
<div class="container mb-4 mt-5 p-0" style="background-color: white; color: black; width: 1000px; height: 500px;z-index: 100;">
<div class="d-flex justify-content-between p-0 m-0" style="background-color: white;
">
<% if @pet.photo.key%>
<%= cl_image_tag @pet.photo.key, :height=>500, :width=>500, :fill=>"fill" %>
<% else %>
<div class="card-product-show">
<div class="card-image-show">
<div class="card-product img">
<% if @pet.species == "dog" %>
<%= image_tag ("https://images.unsplash.com/photo-1530281700549-e82e7bf110d6?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=388&q=80")%>
<% elsif @pet.species == "monkey" %>
<%= image_tag("https://images.unsplash.com/photo-1516636052745-e142aecffd0c?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1935&q=80")%>
<% elsif @pet.species == "cat" %>
<%= image_tag("https://images.unsplash.com/photo-1543852786-1cf6624b9987?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80")%>
<% elsif @pet.species == "piglet" %>
<%= image_tag("https://images.unsplash.com/photo-1617167152074-821b4f8af3d5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80")%>
<% elsif @pet.species == "rabbit" %>
<%= image_tag("https://images.unsplash.com/photo-1591382386627-349b692688ff?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80")%>
<% end %>
</div>
</div>

</div>

<% end %>

<div class="mt-5" style="width: 600px;">
<div class="form-actions" >
<%= render 'bookings/form', pet: @pet, booking: @booking %>
<div class="d-flex justify-content-between p-0 m-0" style="background-color: white;">
<% if @pet.photo.key%>
<%= cl_image_tag @pet.photo.key, :height=>500, :width=>500, :fill=>"fill" %>
<% else %>
<div class="card-product-show">
<div class="card-image-show">
<div class="card-product img">
<% if @pet.species == "dog" %>
<%= image_tag ("https://images.unsplash.com/photo-1530281700549-e82e7bf110d6?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=388&q=80")%>
<% elsif @pet.species == "monkey" %>
<%= image_tag("https://images.unsplash.com/photo-1516636052745-e142aecffd0c?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1935&q=80")%>
<% elsif @pet.species == "cat" %>
<%= image_tag("https://images.unsplash.com/photo-1543852786-1cf6624b9987?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80")%>
<% elsif @pet.species == "piglet" %>
<%= image_tag("https://images.unsplash.com/photo-1617167152074-821b4f8af3d5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80")%>
<% elsif @pet.species == "rabbit" %>
<%= image_tag("https://images.unsplash.com/photo-1591382386627-349b692688ff?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80")%>
<% end %>
</div>
</div>
</div>

</div>
</div>
<% end %>

<div class="" style="
z-index: -2;
top: -104px;
position: relative;
left: 853px;
display: flex;
justify-content: flex-start;
align-items: self-end;">
<div class="img-booking" style="border: none;">
<%= image_tag "huella.png", height: 300, class: "animal", style: "border: none;" %>
<div class="mt-5" style="width: 600px;">
<div class="form-actions" >
<%= render 'bookings/form', pet: @pet, booking: @booking %>
</div>
</div>
</div>

<div class="" style="
z-index: -2;
top: -104px;
position: relative;
left: 853px;
display: flex;
justify-content: flex-start;
align-items: self-end;">
<div class="img-booking" style="border: none;">
<%= image_tag "huella.png", height: 300, class: "animal", style: "border: none;" %>
</div>
</div>
</div>
9 changes: 4 additions & 5 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
</head>

<body class="pt-1" style="min-height:100vh; display:flex; flex-direction: column; background-color:#ffe01b; color:white; ">

<%= render "shared/navbar" %>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= render "shared/navbar" %>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %>
<%= render "shared/footer" %>
<%= render "shared/footer" %>
</body>
</html>
32 changes: 14 additions & 18 deletions app/views/pages/dashboard.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@
<br>
<h4 >Welcome back <%= current_user.first_name.capitalize %> !</h4>
<hr>

<h5 class="p-0">My Bookings: </h5>

<% if @bookings.length >0 %>
<%= render 'shared/bookmark' %>
<% else %>
<h5 class="p-0">My Bookings: </h5>
<% if @bookings.length >0 %>
<%= render 'shared/bookmark' %>
<% else %>
<h6>You don't have any bookings.</h6>
<% end %>

<hr>
<% end %>
<hr>

<h5>My Pets:
<h5>My Pets:
<%= link_to new_pet_path do%>
<button class="btn-sign-up float-end"><i class="fa-solid fa-circle-plus "></i> Add pet</button>
<% end %>
</h5>

<% if @pets.length >0 %>
<%= render 'shared/my_pet_card' %>
<% else %>
<h6>You have not added any pets.</h6>
<button class="btn-sign-up float-end"><i class="fa-solid fa-circle-plus "></i> Add pet</button>
<% end %>
</h5>

<% if @pets.length >0 %>
<%= render 'shared/my_pet_card' %>
<% else %>
<h6>You have not added any pets.</h6>
<% end %>
</div>
</div>
Loading

0 comments on commit 1968a0c

Please sign in to comment.