-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
7e67964
commit 7b3a6f3
Showing
10 changed files
with
116 additions
and
89 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 |
---|---|---|
@@ -1,4 +1,10 @@ | ||
class ApplicationController < ActionController::Base | ||
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. | ||
allow_browser versions: :modern | ||
|
||
helper_method :current_user | ||
|
||
def current_user | ||
@current_user ||= User.find(session[:user_id]) if session[: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
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
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,18 @@ | ||
<div class="mb-4"> | ||
<h2 class="mb-3">Log In</h2> | ||
<%= form_tag '/login', class: 'needs-validation' do %> | ||
<div class="mb-3"> | ||
<%= label_tag :email, "Username", class: 'form-label' %> | ||
<%= text_field_tag :email, nil, class: 'form-control' %> | ||
</div> | ||
|
||
<div class="mb-3"> | ||
<%= label_tag :password, "Password", class: 'form-label' %> | ||
<%= password_field_tag :password, nil, class: 'form-control' %> | ||
</div> | ||
|
||
<div class="mb-3"> | ||
<%= submit_tag "Log In", class: 'btn btn-primary' %> | ||
</div> | ||
<% end %> | ||
</div> |
This file was deleted.
Oops, something went wrong.
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,9 +1,19 @@ | ||
<h1><%= @user.name %></h1> | ||
<p>Email: <%= @user.email %></p> | ||
<h1 class="mb-4"><%= @user.name %></h1> | ||
<p class="mb-4">Registered e-mail: <%= @user.email %></p> | ||
<div class="mb-4"> | ||
<%= link_to 'Edit User Info', edit_user_path(@user), class: 'btn btn-warning' %> | ||
</div> | ||
|
||
<h2>Pets</h2> | ||
<ul> | ||
<h2 class="mb-4">My Pets</h2> | ||
<div class="row"> | ||
<% @user.pets.each do |pet| %> | ||
<li><%= link_to pet.name, pet_path(pet) %></li> | ||
<div class="col-md-4 mb-4"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h5 class="card-title"><%= link_to pet.name, pet_path(pet), class: 'text-decoration-none' %></h5> | ||
<%= link_to 'Show Pet', pet_path(pet), class: 'btn btn-primary' %> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
</ul> | ||
</div> |
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,30 +1,23 @@ | ||
Rails.application.routes.draw do | ||
get "up" => "rails/health#show", as: :rails_health_check | ||
# Render dynamic PWA files from app/views/pwa/* | ||
get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker | ||
get "manifest" => "rails/pwa#manifest", as: :pwa_manifest | ||
# Users routes | ||
resources :users, only: [ :index, :new, :create, :edit, :update, :show, :destroy ] | ||
|
||
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" | ||
|
||
# Defines a route for "/pets" | ||
get "/pets", to: "pets#index" | ||
get "/users", to: "users#index" | ||
|
||
# Routes for sessions (login and logout) | ||
get "/login", to: "sessions#new", as: "login" | ||
# Sessions routes | ||
get "/login", to: "sessions#login" | ||
post "/login", to: "sessions#create" | ||
delete "/logout", to: "sessions#destroy", as: "logout" | ||
delete "/logout", to: "sessions#destroy" | ||
|
||
# Pets Routes | ||
resources :pets, only: [ :index, :show, :new, :create, :edit, :update, :destroy ] | ||
|
||
# Privacy Policy | ||
get "/privacy-policy", to: "privacy_policy#index" | ||
resources :privacy_policy, only: [ :index ] | ||
|
||
# Homepage | ||
get "home/index" | ||
root "home#index" | ||
|
||
# Define a route for the external URL | ||
# External Routes | ||
get "github_repo", to: proc { |env| [ 302, { "Location" => "https://github.com/sarahcssiqueira/pet-tag-generator" }, [] ] } | ||
get "contribute_guide", to: proc { |env| [ 302, { "Location" => "https://github.com/sarahcssiqueira/pet-tag-generator/blob/main/CONTRIBUTING.md" }, [] ] } | ||
end |