cleaning some shit
This commit is contained in:
parent
2a0067da77
commit
e643860c4a
6 changed files with 97 additions and 50 deletions
|
|
@ -5,11 +5,29 @@ def index
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
id = params.extract_value(:id)
|
#id = params.extract_value(:id)
|
||||||
@category = Category.find_by_id(id)
|
|
||||||
@forum_topics = @category.forum_topics
|
|
||||||
end
|
|
||||||
|
|
||||||
|
# @category = Category.find_by(id: params[:category_id])
|
||||||
|
#@forum_topics = @categories.forum_topics.find_by(params[:forum_topic_id])
|
||||||
|
|
||||||
|
#@forum_threads = @categories.forum_topics.forum_threads.find_by(params[:forum_thread_id])
|
||||||
|
|
||||||
|
#end
|
||||||
|
@forum_topics = ForumTopic.all
|
||||||
|
@category = Category.find_by(id: params[:id])
|
||||||
|
|
||||||
|
#@forum_topics = @category&.forum_topics&.find_by(id: params[:forum_topic_id])
|
||||||
|
|
||||||
|
@forum_threads = @category&.forum_topics
|
||||||
|
&.find_by(id: params[:forum_topic_id])
|
||||||
|
&.forum_threads
|
||||||
|
&.find_by(id: params[:forum_thread_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def category_params
|
||||||
|
params.require(:title, :description)
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
class ForumThreadsController < ApplicationController
|
class ForumThreadsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@threads = ForumThread.all
|
end
|
||||||
end
|
|
||||||
def show
|
def show
|
||||||
id = params.extract_value(:id)
|
id = params.extract_value(:id)
|
||||||
@thread = ForumThread.find_by_id(id)
|
@category = Category.find(params[:category_id])
|
||||||
|
@forum_topic = @category.forum_topics.find(params[:forum_topic_id])
|
||||||
|
@forum_thread = @category.forum_topics.forum_threads.find(params[:forum_thread_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
class ForumTopicsController < ApplicationController
|
class ForumTopicsController < ApplicationController
|
||||||
def show
|
|
||||||
id = params.extract_value(:id)
|
|
||||||
@thread = ForumThread.find_by_id(id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
|
|
@ -10,9 +6,18 @@ def index
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
id = params.extract_value(:id)
|
|
||||||
@forum_topics = ForumTopic.find_by_id(id)
|
@category = Category.find(params[:category_id])
|
||||||
@threads = ForumThread.all
|
#@forum_topics = ForumTopic.all
|
||||||
@thread = ForumThread.find_by_id(id)
|
#@forum_thread = @category&.forum_topics&.forum_thread(params[:forum_thread_id])
|
||||||
end
|
@forum_topic = @category.forum_topics.find(params[:id])
|
||||||
|
|
||||||
|
@forum_threads = @forum_topic.forum_threads
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
private
|
||||||
|
def params
|
||||||
|
params.require(:forum_topic, :title).permit( :description)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
<section class="threadindex"><% @categories.each do | category | %>
|
<center><h1>SILLYFORUMZ!</h1>
|
||||||
|
<h3>welcome to the worst forum site on the web <3 </h3>
|
||||||
|
<hr>
|
||||||
|
<h2>Forum Categories</h2></center>
|
||||||
|
<br><section class="threadindex"><% @categories.each do | category | %>
|
||||||
<section class="threadtitle"> <h4><%= category.title %> <%= link_to 'Show', category_path(category) %></h4></section>
|
<section class="threadtitle"> <h4><%= category.title %> <%= link_to 'Show', category_path(category) %></h4></section>
|
||||||
<article><%= category.description %></article><hr>
|
<article><%= category.description %></article><hr>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<section class="threadindex">
|
<section class="threadindex">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<h1><%= @forum_topics.title %></h1>
|
<h1><%= @forum_topic.title %></h1>
|
||||||
<% @threads.each do |thread| %><section class="forumtopic">
|
<% @forum_threads.each do |forum_thread| %><section class="forumtopic">
|
||||||
<%= thread.title %> <br><%= truncate(@thread.body, length: 200) %> <br></section><br>
|
<%= forum_thread.title %> | <%= link_to 'Show', category_forum_topic_forum_thread_path(@category, @forum_topic, forum_thread) %> <br><%= truncate(forum_thread.body, length: 200) %> <br></section><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
71
db/seeds.rb
71
db/seeds.rb
|
|
@ -1,37 +1,52 @@
|
||||||
|
|
||||||
user = User.create!(
|
user = User.create!(
|
||||||
email: "nahlebiscanon@alexkurtzman.com",
|
email: "nahlebiscanon@alexkurtzman.com",
|
||||||
password: "password",
|
password: "password",
|
||||||
password_confirmation: "password"
|
password_confirmation: "password"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cat1 = Category.create!(title: "Femslash Creations", description: "This is a description")
|
||||||
|
cat2 = Category.create!(title: "Toxic Yuri Creations", description: "This is a description")
|
||||||
|
cat3 = Category.create!(title: "Yuricest Creations", description: "This is a description")
|
||||||
|
|
||||||
|
|
||||||
|
topic1 = ForumTopic.create!(
|
||||||
|
title: "Writing - WIP",
|
||||||
|
description: "For sharing writing works in progress and such.",
|
||||||
|
category: cat1
|
||||||
|
)
|
||||||
|
|
||||||
|
topic2 = ForumTopic.create!(
|
||||||
|
title: "Art - WIP",
|
||||||
|
description: "For sharing visual art works in progress.",
|
||||||
|
category: cat1
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
thread1 = ForumThread.create!(
|
||||||
|
title: "NAHLEB TRANSFEM CALEB",
|
||||||
|
body: "lorem ipsum text",
|
||||||
|
forum_topic: topic1
|
||||||
|
)
|
||||||
|
|
||||||
|
thread2 = ForumThread.create!(
|
||||||
|
title: "samjett rights",
|
||||||
|
body: "can you be a sugar mommy in a post-scarcity world",
|
||||||
|
forum_topic: topic2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
2.times do
|
2.times do
|
||||||
category = Category.create!(
|
Reply.create!(
|
||||||
title: "Femslash Creations",
|
body: "nahleb is canon brother",
|
||||||
description: "This is a description"
|
thread_id: thread1.id,
|
||||||
|
user: user
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
2.times do
|
||||||
|
Reply.create!(
|
||||||
|
body: "nahleb is canon brother",
|
||||||
|
thread_id: thread2.id,
|
||||||
|
user: user
|
||||||
)
|
)
|
||||||
|
|
||||||
2.times do
|
|
||||||
topic = ForumTopic.create!(
|
|
||||||
title: "Sample Topic",
|
|
||||||
description: "This is a topic description",
|
|
||||||
category: category
|
|
||||||
)
|
|
||||||
|
|
||||||
2.times do
|
|
||||||
thread = ForumThread.create!(
|
|
||||||
title: "Thread title",
|
|
||||||
body: "Thread body",
|
|
||||||
forum_topic: topic
|
|
||||||
)
|
|
||||||
|
|
||||||
2.times do
|
|
||||||
Reply.create!(
|
|
||||||
body: "nahleb is canon brother",
|
|
||||||
thread_id: thread.id,
|
|
||||||
user: user
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue