-
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
889982b
commit 0cfba7d
Showing
53 changed files
with
946 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
class DogdatesController < ApplicationController | ||
before_action :set_dogdate, only: %i[ show edit update destroy ] | ||
|
||
# GET /dogdates or /dogdates.json | ||
def index | ||
@dogdates = Dogdate.all | ||
end | ||
|
||
# GET /dogdates/1 or /dogdates/1.json | ||
def show | ||
end | ||
|
||
# GET /dogdates/new | ||
def new | ||
@dogdate = Dogdate.new | ||
end | ||
|
||
# GET /dogdates/1/edit | ||
def edit | ||
end | ||
|
||
# POST /dogdates or /dogdates.json | ||
def create | ||
@dogdate = Dogdate.new(dogdate_params) | ||
|
||
respond_to do |format| | ||
if @dogdate.save | ||
format.html { redirect_to dogdate_url(@dogdate), notice: "Dogdate was successfully created." } | ||
format.json { render :show, status: :created, location: @dogdate } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @dogdate.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /dogdates/1 or /dogdates/1.json | ||
def update | ||
respond_to do |format| | ||
if @dogdate.update(dogdate_params) | ||
format.html { redirect_to dogdate_url(@dogdate), notice: "Dogdate was successfully updated." } | ||
format.json { render :show, status: :ok, location: @dogdate } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @dogdate.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /dogdates/1 or /dogdates/1.json | ||
def destroy | ||
@dogdate.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to dogdates_url, notice: "Dogdate was successfully destroyed." } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_dogdate | ||
@dogdate = Dogdate.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def dogdate_params | ||
params.require(:dogdate).permit(:account_id, :dogs_id, :date, :location) | ||
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
class DogsController < ApplicationController | ||
before_action :set_dog, only: %i[ show edit update destroy ] | ||
|
||
# GET /dogs or /dogs.json | ||
def index | ||
@dogs = Dog.all | ||
end | ||
|
||
# GET /dogs/1 or /dogs/1.json | ||
def show | ||
end | ||
|
||
# GET /dogs/new | ||
def new | ||
@dog = Dog.new | ||
end | ||
|
||
# GET /dogs/1/edit | ||
def edit | ||
end | ||
|
||
# POST /dogs or /dogs.json | ||
def create | ||
@dog = Dog.new(dog_params) | ||
|
||
respond_to do |format| | ||
if @dog.save | ||
format.html { redirect_to dog_url(@dog), notice: "Dog was successfully created." } | ||
format.json { render :show, status: :created, location: @dog } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @dog.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /dogs/1 or /dogs/1.json | ||
def update | ||
respond_to do |format| | ||
if @dog.update(dog_params) | ||
format.html { redirect_to dog_url(@dog), notice: "Dog was successfully updated." } | ||
format.json { render :show, status: :ok, location: @dog } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @dog.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /dogs/1 or /dogs/1.json | ||
def destroy | ||
@dog.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to dogs_url, notice: "Dog was successfully destroyed." } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_dog | ||
@dog = Dog.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def dog_params | ||
params.require(:dog).permit(:account_id, :name, :breed, :bio, :sociability, :img) | ||
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
class RatingsController < ApplicationController | ||
before_action :set_rating, only: %i[ show edit update destroy ] | ||
|
||
# GET /ratings or /ratings.json | ||
def index | ||
@ratings = Rating.all | ||
end | ||
|
||
# GET /ratings/1 or /ratings/1.json | ||
def show | ||
end | ||
|
||
# GET /ratings/new | ||
def new | ||
@rating = Rating.new | ||
end | ||
|
||
# GET /ratings/1/edit | ||
def edit | ||
end | ||
|
||
# POST /ratings or /ratings.json | ||
def create | ||
@rating = Rating.new(rating_params) | ||
|
||
respond_to do |format| | ||
if @rating.save | ||
format.html { redirect_to rating_url(@rating), notice: "Rating was successfully created." } | ||
format.json { render :show, status: :created, location: @rating } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @rating.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /ratings/1 or /ratings/1.json | ||
def update | ||
respond_to do |format| | ||
if @rating.update(rating_params) | ||
format.html { redirect_to rating_url(@rating), notice: "Rating was successfully updated." } | ||
format.json { render :show, status: :ok, location: @rating } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @rating.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /ratings/1 or /ratings/1.json | ||
def destroy | ||
@rating.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to ratings_url, notice: "Rating was successfully destroyed." } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_rating | ||
@rating = Rating.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def rating_params | ||
params.require(:rating).permit(:rating, :dog_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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module DogdatesHelper | ||
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module DogsHelper | ||
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module RatingsHelper | ||
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Dog < ApplicationRecord | ||
belongs_to :account | ||
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class Dogdate < ApplicationRecord | ||
belongs_to :account | ||
belongs_to :dogs | ||
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Rating < ApplicationRecord | ||
belongs_to :dog | ||
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div id="<%= dom_id dogdate %>"> | ||
<p class="my-5"> | ||
<strong class="block font-medium mb-1">Account:</strong> | ||
<%= dogdate.account_id %> | ||
</p> | ||
|
||
<p class="my-5"> | ||
<strong class="block font-medium mb-1">Dogs:</strong> | ||
<%= dogdate.dogs_id %> | ||
</p> | ||
|
||
<p class="my-5"> | ||
<strong class="block font-medium mb-1">Date:</strong> | ||
<%= dogdate.date %> | ||
</p> | ||
|
||
<p class="my-5"> | ||
<strong class="block font-medium mb-1">Location:</strong> | ||
<%= dogdate.location %> | ||
</p> | ||
|
||
<% if action_name != "show" %> | ||
<%= link_to "Show this dogdate", dogdate, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
<%= link_to 'Edit this dogdate', edit_dogdate_path(dogdate), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %> | ||
<hr class="mt-6"> | ||
<% end %> | ||
</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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
json.extract! dogdate, :id, :account_id, :dogs_id, :date, :location, :created_at, :updated_at | ||
json.url dogdate_url(dogdate, format: :json) |
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,37 @@ | ||
<%= form_with(model: dogdate, class: "contents") do |form| %> | ||
<% if dogdate.errors.any? %> | ||
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3"> | ||
<h2><%= pluralize(dogdate.errors.count, "error") %> prohibited this dogdate from being saved:</h2> | ||
|
||
<ul> | ||
<% dogdate.errors.each do |error| %> | ||
<li><%= error.full_message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="my-5"> | ||
<%= form.label :account_id %> | ||
<%= form.text_field :account_id, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> | ||
</div> | ||
|
||
<div class="my-5"> | ||
<%= form.label :dogs_id %> | ||
<%= form.text_field :dogs_id, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> | ||
</div> | ||
|
||
<div class="my-5"> | ||
<%= form.label :date %> | ||
<%= form.text_field :date, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> | ||
</div> | ||
|
||
<div class="my-5"> | ||
<%= form.label :location %> | ||
<%= form.text_field :location, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> | ||
</div> | ||
|
||
<div class="inline"> | ||
<%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %> | ||
</div> | ||
<% 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="mx-auto md:w-2/3 w-full"> | ||
<h1 class="font-bold text-4xl">Editing dogdate</h1> | ||
|
||
<%= render "form", dogdate: @dogdate %> | ||
|
||
<%= link_to "Show this dogdate", @dogdate, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
<%= link_to "Back to dogdates", dogdates_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
</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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="w-full"> | ||
<% if notice.present? %> | ||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p> | ||
<% end %> | ||
|
||
<div class="flex justify-between items-center"> | ||
<h1 class="font-bold text-4xl">Dogdates</h1> | ||
<%= link_to 'New dogdate', new_dogdate_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %> | ||
</div> | ||
|
||
<div id="dogdates" class="min-w-full"> | ||
<%= render @dogdates %> | ||
</div> | ||
</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 |
---|---|---|
@@ -0,0 +1 @@ | ||
json.array! @dogdates, partial: "dogdates/dogdate", as: :dogdate |
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,7 @@ | ||
<div class="mx-auto md:w-2/3 w-full"> | ||
<h1 class="font-bold text-4xl">New dogdate</h1> | ||
|
||
<%= render "form", dogdate: @dogdate %> | ||
|
||
<%= link_to 'Back to dogdates', dogdates_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
</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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div class="mx-auto md:w-2/3 w-full flex"> | ||
<div class="mx-auto"> | ||
<% if notice.present? %> | ||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p> | ||
<% end %> | ||
|
||
<%= render @dogdate %> | ||
|
||
<%= link_to 'Edit this dogdate', edit_dogdate_path(@dogdate), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
<div class="inline-block ml-2"> | ||
<%= button_to 'Destroy this dogdate', dogdate_path(@dogdate), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %> | ||
</div> | ||
<%= link_to 'Back to dogdates', dogdates_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
</div> | ||
</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 |
---|---|---|
@@ -0,0 +1 @@ | ||
json.partial! "dogdates/dogdate", dogdate: @dogdate |
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,37 @@ | ||
<div id="<%= dom_id dog %>"> | ||
<p class="my-5"> | ||
<strong class="block font-medium mb-1">Account:</strong> | ||
<%= dog.account_id %> | ||
</p> | ||
|
||
<p class="my-5"> | ||
<strong class="block font-medium mb-1">Name:</strong> | ||
<%= dog.name %> | ||
</p> | ||
|
||
<p class="my-5"> | ||
<strong class="block font-medium mb-1">Breed:</strong> | ||
<%= dog.breed %> | ||
</p> | ||
|
||
<p class="my-5"> | ||
<strong class="block font-medium mb-1">Bio:</strong> | ||
<%= dog.bio %> | ||
</p> | ||
|
||
<p class="my-5"> | ||
<strong class="block font-medium mb-1">Sociability:</strong> | ||
<%= dog.sociability %> | ||
</p> | ||
|
||
<p class="my-5"> | ||
<strong class="block font-medium mb-1">Img:</strong> | ||
<%= dog.img %> | ||
</p> | ||
|
||
<% if action_name != "show" %> | ||
<%= link_to "Show this dog", dog, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> | ||
<%= link_to 'Edit this dog', edit_dog_path(dog), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %> | ||
<hr class="mt-6"> | ||
<% end %> | ||
</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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
json.extract! dog, :id, :account_id, :name, :breed, :bio, :sociability, :img, :created_at, :updated_at | ||
json.url dog_url(dog, format: :json) |
Oops, something went wrong.