Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bw tabbed interface #55

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fe37efb
Installed Devise
Brian-Waddell Oct 23, 2023
9f02f9a
Added root route
Brian-Waddell Oct 23, 2023
1384ecb
generated users with devise
Brian-Waddell Oct 23, 2023
b59cdb0
Edited divise users
Brian-Waddell Oct 23, 2023
2d6ab8c
Added Photo table using scaffold
Brian-Waddell Oct 23, 2023
35f0c59
Created comments table scaffold
Brian-Waddell Oct 23, 2023
86c264f
added relations/db migrate
Brian-Waddell Oct 23, 2023
fe87578
generated FollowRequest
Brian-Waddell Oct 23, 2023
2bf104b
Generated likes table
Brian-Waddell Oct 23, 2023
b43a613
Indirect Associations Added
Brian-Waddell Oct 23, 2023
bf645d2
added validations
Brian-Waddell Oct 23, 2023
c5b2d74
Added Scopes for queires
Brian-Waddell Oct 23, 2023
3b3ad80
Added Enum to status column
Brian-Waddell Oct 24, 2023
f3d7a00
Creating faker users
Brian-Waddell Oct 24, 2023
9fdf4c7
Added sample user data
Brian-Waddell Oct 24, 2023
154c2ee
fixed vaildation error
Brian-Waddell Oct 24, 2023
9ccea76
added container and navbar
Brian-Waddell Oct 24, 2023
d23e246
Added cdn_Assets
Brian-Waddell Oct 24, 2023
4b39c6e
Navbar dropdown menu
Brian-Waddell Oct 25, 2023
a2bf9ad
added users
Brian-Waddell Oct 25, 2023
6f8821a
small additional fixes
Brian-Waddell Oct 25, 2023
92a7ea9
added dynamic user route
Brian-Waddell Oct 25, 2023
f6a8429
creater user controller
Brian-Waddell Oct 25, 2023
0552836
Added own photos to users#show
Brian-Waddell Oct 25, 2023
e5c15d7
added commenting to photos card
Brian-Waddell Oct 25, 2023
847ef15
replace the photo code in show with partial helper
Brian-Waddell Oct 26, 2023
a92ca6e
added routes for tab interface
Brian-Waddell Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ ruby "3.2.1"

gem "simple_form"

gem "devise"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.4", ">= 7.0.4.3"

Expand Down
14 changes: 14 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ GEM
appdev_support (0.2.1)
tabulo
awesome_print (1.9.2)
bcrypt (3.1.19)
better_errors (2.9.1)
coderay (>= 1.0.0)
erubi (>= 1.0.0)
Expand Down Expand Up @@ -108,6 +109,12 @@ GEM
irb (>= 1.5.0)
reline (>= 0.3.1)
debug_inspector (1.1.0)
devise (4.9.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
diff-lcs (1.5.0)
diffy (3.4.2)
domain_name (0.5.20190701)
Expand Down Expand Up @@ -213,6 +220,7 @@ GEM
faraday (>= 1, < 3)
sawyer (~> 0.9)
oj (3.13.23)
orm_adapter (0.5.0)
pg (1.4.6)
pry (0.14.2)
coderay (~> 1.1)
Expand Down Expand Up @@ -276,6 +284,9 @@ GEM
regexp_parser (2.8.0)
reline (0.3.3)
io-console (~> 0.5)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
Expand Down Expand Up @@ -355,6 +366,8 @@ GEM
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)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand Down Expand Up @@ -396,6 +409,7 @@ DEPENDENCIES
bootsnap
capybara
debug
devise
dotenv-rails
draft_matchers
faker
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
class ApplicationController < ActionController::Base

before_action :authenticate_user!
end
71 changes: 71 additions & 0 deletions app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
class CommentsController < ApplicationController
before_action :set_comment, only: %i[ show edit update destroy ]

# GET /comments or /comments.json
def index
@comments = Comment.all
end

# GET /comments/1 or /comments/1.json
def show
end

# GET /comments/new
def new
@comment = Comment.new
end

# GET /comments/1/edit
def edit
end

# POST /comments or /comments.json
def create
@comment = Comment.new(comment_params)
@comment.author = current_user

respond_to do |format|
if @comment.save
format.html { redirect_back fallback_location: root_path, notice: "Comment was successfully created." }
format.json { render :show, status: :created, location: @comment }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @comment.errors, status: :unprocessable_entity }
end
end
end

# PATCH/PUT /comments/1 or /comments/1.json
def update
respond_to do |format|
if @comment.update(comment_params)
format.html { redirect_to comment_url(@comment), notice: "Comment was successfully updated." }
format.json { render :show, status: :ok, location: @comment }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @comment.errors, status: :unprocessable_entity }
end
end
end

# DELETE /comments/1 or /comments/1.json
def destroy
@comment.destroy

respond_to do |format|
format.html { redirect_to comments_url, notice: "Comment was successfully destroyed." }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_comment
@comment = Comment.find(params[:id])
end

# Only allow a list of trusted parameters through.
def comment_params
params.require(:comment).permit(:author_id, :photo_id, :body)
end
end
70 changes: 70 additions & 0 deletions app/controllers/follow_requests_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
class FollowRequestsController < ApplicationController
before_action :set_follow_request, only: %i[ show edit update destroy ]

# GET /follow_requests or /follow_requests.json
def index
@follow_requests = FollowRequest.all
end

# GET /follow_requests/1 or /follow_requests/1.json
def show
end

# GET /follow_requests/new
def new
@follow_request = FollowRequest.new
end

# GET /follow_requests/1/edit
def edit
end

# POST /follow_requests or /follow_requests.json
def create
@follow_request = FollowRequest.new(follow_request_params)

respond_to do |format|
if @follow_request.save
format.html { redirect_to follow_request_url(@follow_request), notice: "Follow request was successfully created." }
format.json { render :show, status: :created, location: @follow_request }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @follow_request.errors, status: :unprocessable_entity }
end
end
end

# PATCH/PUT /follow_requests/1 or /follow_requests/1.json
def update
respond_to do |format|
if @follow_request.update(follow_request_params)
format.html { redirect_to follow_request_url(@follow_request), notice: "Follow request was successfully updated." }
format.json { render :show, status: :ok, location: @follow_request }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @follow_request.errors, status: :unprocessable_entity }
end
end
end

# DELETE /follow_requests/1 or /follow_requests/1.json
def destroy
@follow_request.destroy

respond_to do |format|
format.html { redirect_to follow_requests_url, notice: "Follow request was successfully destroyed." }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_follow_request
@follow_request = FollowRequest.find(params[:id])
end

# Only allow a list of trusted parameters through.
def follow_request_params
params.require(:follow_request).permit(:recipient_id, :sender_id, :status)
end
end
70 changes: 70 additions & 0 deletions app/controllers/likes_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
class LikesController < ApplicationController
before_action :set_like, only: %i[ show edit update destroy ]

# GET /likes or /likes.json
def index
@likes = Like.all
end

# GET /likes/1 or /likes/1.json
def show
end

# GET /likes/new
def new
@like = Like.new
end

# GET /likes/1/edit
def edit
end

# POST /likes or /likes.json
def create
@like = Like.new(like_params)

respond_to do |format|
if @like.save
format.html { redirect_to like_url(@like), notice: "Like was successfully created." }
format.json { render :show, status: :created, location: @like }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @like.errors, status: :unprocessable_entity }
end
end
end

# PATCH/PUT /likes/1 or /likes/1.json
def update
respond_to do |format|
if @like.update(like_params)
format.html { redirect_to like_url(@like), notice: "Like was successfully updated." }
format.json { render :show, status: :ok, location: @like }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @like.errors, status: :unprocessable_entity }
end
end
end

# DELETE /likes/1 or /likes/1.json
def destroy
@like.destroy

respond_to do |format|
format.html { redirect_to likes_url, notice: "Like was successfully destroyed." }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_like
@like = Like.find_by(params[:username])
end

# Only allow a list of trusted parameters through.
def like_params
params.require(:like).permit(:fan_id, :photo_id)
end
end
70 changes: 70 additions & 0 deletions app/controllers/photos_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
class PhotosController < ApplicationController
before_action :set_photo, only: %i[ show edit update destroy ]

# GET /photos or /photos.json
def index
@photos = Photo.all
end

# GET /photos/1 or /photos/1.json
def show
end

# GET /photos/new
def new
@photo = Photo.new
end

# GET /photos/1/edit
def edit
end

# POST /photos or /photos.json
def create
@photo = Photo.new(photo_params)

respond_to do |format|
if @photo.save
format.html { redirect_to photo_url(@photo), notice: "Photo was successfully created." }
format.json { render :show, status: :created, location: @photo }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @photo.errors, status: :unprocessable_entity }
end
end
end

# PATCH/PUT /photos/1 or /photos/1.json
def update
respond_to do |format|
if @photo.update(photo_params)
format.html { redirect_to photo_url(@photo), notice: "Photo was successfully updated." }
format.json { render :show, status: :ok, location: @photo }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @photo.errors, status: :unprocessable_entity }
end
end
end

# DELETE /photos/1 or /photos/1.json
def destroy
@photo.destroy

respond_to do |format|
format.html { redirect_to photos_url, notice: "Photo was successfully destroyed." }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_photo
@photo = Photo.find(params[:id])
end

# Only allow a list of trusted parameters through.
def photo_params
params.require(:photo).permit(:image, :comments_count, :likes_count, :caption, :owner_id)
end
end
25 changes: 25 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class UsersController < ApplicationController
def show

@user = User.find_by!(username: params.fetch(:username))

end

def liked
@user = User.find_by!(username: params.fetch(:username))
end
def followers
@user = User.find_by!(username: params.fetch(:username))

end

def following
@user = User.find_by!(username: params.fetch(:username))

end

def feed

end

end
Loading