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

Add seach component to all other pages #105

Merged
merged 6 commits into from Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 6 additions & 23 deletions app/views/courses/index.html.erb
@@ -1,39 +1,22 @@
<% content_for :hero do %>
<%= render "shared/page_title", title: "Courses about Ruby and Ruby on Rails", description: "Our collection of Ruby and Ruby on Rails courses cover everything from the basics to advanced topics like metaprogramming and web scraping. Courses will show you how to build powerful, production-ready web applications with this popular framework. Best of all, you can find courses for free. Ready to get started?", count: "#{Course.count} courses" %>
<% end %>

<% content_for :content do %>
<% if params[:search_term].present? %>
<div class="pb-12">
<strong>Search Term: </strong><%= params[:search_term] %>
</div>
<% end %>

<div class="flex flex-wrap justify-between mb-8 xl:mb-16 gap-x-8 gap-y-2 md:gap-8">
<span>
<h2 class="h2 mb-8">All Courses</h2>
</span>

<span>
<%= form_tag(courses_path, method: "get", id: 'search_form', remote: true) do %>
<div class="input-group">
<span class="input-group-append">
<%= text_field_tag(:search_term, nil, placeholder: 'Search name', class: 'form-control', value: html_escape(params[:search_term])) %>
</span>
<span class="input-group-append">
<button type="submit" class="btn btn-primary button-rounded", id="submit-search-btn", title="Search Courses">Search</button>
<%= link_to courses_path, type: :submit, class: "btn btn-warning", id: "clear-search-btn", title: "Reset", style: "margin-left: 10px; color: black" do %> X <% end %>
</span>
</div>
<% end %>
</span>
<div>
<h2 class="mb-8 h2">All Courses</h2>
</div>
<div>
<%= render(SearchComponent.new(path: courses_path, search_term: params[:search_term])) %>
</div>
</div>

<div class="mb-8">
<%= render partial: "courses/list", locals: { list: @courses } %>
</div>
<%== pagy_nav(@pagy) %>
<% end %>



26 changes: 6 additions & 20 deletions app/views/newsletters/index.html.erb
@@ -1,33 +1,19 @@
<% content_for :hero do %>
<%= render "shared/page_title", title: "Newsletters about Ruby and Ruby on Rails", description: "Get the latest news, tips, and tricks delivered right to your inbox. Read about interesting articles and blog posts about life and programming.", count: "#{Newsletter.count} newsletters" %>
<% end %>

<% content_for :content do %>
<% if params[:search_term].present? %>
<div class="pb-12">
<strong>Search Term: </strong><%= params[:search_term] %>
</div>
<% end %>

<div class="flex flex-wrap justify-between mb-8 xl:mb-16 gap-x-8 gap-y-2 md:gap-8">
<span>
<h2 class="h2 mb-8">All Newsletters</h2>
</span>

<span>
<%= form_tag(newsletters_path, method: "get", id: 'search_form', remote: true) do %>
<div class="input-group">
<span class="input-group-append">
<%= text_field_tag(:search_term, nil, placeholder: 'Search name', class: 'form-control', value: html_escape(params[:search_term])) %>
</span>
<span class="input-group-append">
<button type="submit" class="btn btn-primary button-rounded", id="submit-search-btn", title="Search Newletter">Search</button>
<%= link_to newsletters_path, type: :submit, class: "btn btn-warning", id: "clear-search-btn", title: "Reset", style: "margin-left: 10px; color: black" do %> X <% end %>
</span>
</div>
<% end %>
</span>
<div>
<h2 class="mb-8 h2">All Newsletters</h2>
</div>
<div>
<%= render SearchComponent.new(path: newsletters_path, search_term: params[:search_term]) %>
</div>
</div>

<%= render partial: "newsletters/list", locals: { list: @newsletters } %>
<% end %>
27 changes: 6 additions & 21 deletions app/views/screencasts/index.html.erb
@@ -1,34 +1,19 @@
<% content_for :hero do %>
<%= render "shared/page_title", title: "Screencasts about Ruby and Ruby on Rails", description: "If you're looking for some helpful resources on learning Ruby and Ruby on Rails development, I recommend checking out some screencast tutorials. There's a lot of great information out there that can help you get started and become a better developer. Happy learning!", count: "#{Screencast.count} courses" %>
<% end %>

<% content_for :content do %>
<% if params[:search_term].present? %>
<div class="pb-12">
<strong>Search Term: </strong><%= params[:search_term] %>
</div>
<% end %>

<div class="flex flex-wrap justify-between mb-8 xl:mb-16 gap-x-8 gap-y-2 md:gap-8">
<span>
<h2 class="h2 mb-8">All Screencasts</h2>
</span>

<span>
<%= form_tag(screencasts_path, method: "get", id: 'search_form', remote: true) do %>
<div class="input-group">
<span class="input-group-append">
<%= text_field_tag(:search_term, nil, placeholder: 'Search name', class: 'form-control', value: html_escape(params[:search_term])) %>
</span>
<span class="input-group-append">
<button type="submit" class="btn btn-primary button-rounded", id="submit-search-btn", title="Search Screencast">Search</button>
<%= link_to screencasts_path, type: :submit, class: "btn btn-warning", id: "clear-search-btn", title: "Reset", style: "margin-left: 10px; color: black" do %> X <% end %>
</span>
</div>
<% end %>
</span>
<div>
<h2 class="mb-8 h2">All Screencasts</h2>
</div>
<div>
<%= render SearchComponent.new(path: screencasts_path, search_term: params[:search_term]) %>
</div>
</div>

<%= render partial: "screencasts/list", locals: { list: @screencasts } %>
<% end %>

26 changes: 4 additions & 22 deletions app/views/tags/index.html.erb
@@ -1,37 +1,19 @@
<% content_for :hero do %>
<%= render "shared/page_title", title: "What would you like to learn more about? ", description: "If you're looking to learn more about programming, we've got a few resources that might interest you. Whatever your interest, we're sure we can find a book or course that's perfect for you.", count: "#{Tag.count} topics" %>
<% end %>

<% content_for :content do %>
<% if params[:search_term].present? %>
<div class="pb-12">
<strong>Search Term: </strong><%= params[:search_term] %>
</div>
<% end %>

<div class="flex flex-wrap justify-between mb-8 xl:mb-16 gap-x-8 gap-y-2 md:gap-8">
<span>
<h2 class="h2 mb-8">All Topics</h2>
</span>

<span>
<%= form_tag(tags_path, method: "get", id: 'search_form', remote: true) do %>
<div class="input-group">
<span class="input-group-append">
<%= text_field_tag(:search_term, nil, placeholder: 'Search name', class: 'form-control', value: html_escape(params[:search_term])) %>
</span>
<span class="input-group-append">
<button type="submit" class="btn btn-primary button-rounded", id="submit-search-btn", title="Search Tags">Search</button>
<%= link_to tags_path, type: :submit, class: "btn btn-warning", id: "clear-search-btn", title: "Reset", style: "margin-left: 10px; color: black" do %> X <% end %>
</span>
</div>
<% end %>
<h2 class="mb-8 h2">All Topics</h2>
</span>
<div>
<%= render(SearchComponent.new(path: tags_path, search_term: params[:search_term])) %>
</div>
</div>

<%= render partial: "tags/list", locals: { list: @tags } %>
<% end %>




27 changes: 6 additions & 21 deletions app/views/youtubes/index.html.erb
@@ -1,34 +1,19 @@
<% content_for :hero do %>
<%= render "shared/page_title", title: "YouTube Courses about Ruby and Ruby on Rails", description: "If you're interested in learning Ruby or Ruby on Rails, or if you want to brush up on your testing skills or learn more about other themes, you're in luck. There are plenty of free and paid books available on these topics. Whether you're a beginner or an expert, you're sure to find something that interests you.", count: "#{Youtube.count} YouTube Courses" %>
<% end %>

<% content_for :content do %>
<% if params[:search_term].present? %>
<div class="pb-12">
<strong>Search Term: </strong><%= params[:search_term] %>
</div>
<% end %>

<div class="flex flex-wrap justify-between mb-8 xl:mb-16 gap-x-8 gap-y-2 md:gap-8">
<span>
<h2 class="h2 mb-8">All YouTube Courses</h2>
</span>

<span>
<%= form_tag(youtubes_path, method: "get", id: 'search_form', remote: true) do %>
<div class="input-group">
<span class="input-group-append">
<%= text_field_tag(:search_term, nil, placeholder: 'Search name', class: 'form-control', value: html_escape(params[:search_term])) %>
</span>
<span class="input-group-append">
<button type="submit" class="btn btn-primary button-rounded", id="submit-search-btn", title="Search Youtube Courses">Search</button>
<%= link_to youtubes_path, type: :submit, class: "btn btn-warning", id: "clear-search-btn", title: "Reset", style: "margin-left: 10px; color: black" do %> X <% end %>
</span>
</div>
<% end %>
</span>
<div>
<h2 class="mb-8 h2">All YouTube Courses</h2>
</div>
<div>
<%= render SearchComponent.new(path: youtubes_path, search_term: params[:search_term]) %>
</div>
</div>

<%= render "youtubes/list" %>
<% end %>