Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Commit

Permalink
Added youtube_url for experts
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshtrivedi committed Jan 23, 2021
1 parent 419933d commit 712d74a
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
@@ -1 +1 @@
2.7.2
3.0.0
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Expand Up @@ -2,6 +2,4 @@

Our discussions happen in the #meta channel of our community Slack which you can join here: https://learnawesome.org/join_slack

LearnAwesome is a web application built with Ruby, Rails, PostgreSQL, and TailwindCSS.

You can pick any issue labeled with `good first issue` or `Hacktoberfest` and send a PR. For anything else, we recommend starting a discussion on either the issue or in Slack first.
LearnAwesome is a web application built with Ruby 3.0, Rails 6.1.1, PostgreSQL, and TailwindCSS 2.0.
4 changes: 4 additions & 0 deletions app/controllers/people_controller.rb
Expand Up @@ -38,6 +38,8 @@ def wikidata
@person.website = data[:website]
@person.goodreads = data[:goodreads] unless @person.goodreads.present?
@person.twitter = data[:twitter]
@person.wikipedia_url = data[:wikipedia_url]
@person.youtube_url = data[:youtube_url]

render 'edit'
end
Expand All @@ -56,6 +58,8 @@ def update
@person.twitter = params[:person][:twitter]
@person.goodreads = params[:person][:goodreads]
@person.image_url = params[:person][:image_url]
@person.wikipedia_url = data[:wikipedia_url]
@person.youtube_url = data[:youtube_url]
@person.kind = params[:person][:kind]

if @person.save
Expand Down
10 changes: 10 additions & 0 deletions app/views/people/_form.html+tailwind.erb
Expand Up @@ -35,6 +35,16 @@
<%= form.text_field :goodreads, class: "w-full mt-1 px-4 py-2 block rounded bg-gray-200 text-gray-800 border border-gray-300 focus:outline-none focus:bg-white" %>
</div>

<div class="mb-4">
<%= form.label :wikipedia_url, class: "text-gray-700" %>
<%= form.url_field :wikipedia_url, class: "w-full mt-1 px-4 py-2 block rounded bg-gray-200 text-gray-800 border border-gray-300 focus:outline-none focus:bg-white" %>
</div>

<div class="mb-4">
<%= form.label :youtube_url, class: "text-gray-700" %>
<%= form.url_field :youtube_url, class: "w-full mt-1 px-4 py-2 block rounded bg-gray-200 text-gray-800 border border-gray-300 focus:outline-none focus:bg-white" %>
</div>

<div class="mb-4">
<%= form.label :image_url, class: "text-gray-700" %>
<%= form.text_field :image_url, class: "w-full mt-1 px-4 py-2 block rounded bg-gray-200 text-gray-800 border border-gray-300 focus:outline-none focus:bg-white" %>
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20210123134411_add_you_tube_to_people.rb
@@ -0,0 +1,5 @@
class AddYouTubeToPeople < ActiveRecord::Migration[6.1]
def change
add_column :people, :youtube_url, :string
end
end
6 changes: 4 additions & 2 deletions db/structure.sql
Expand Up @@ -911,7 +911,8 @@ CREATE TABLE public.people (
image_url character varying,
kind character varying,
second_kind character varying,
wikipedia_url character varying
wikipedia_url character varying,
youtube_url character varying
);


Expand Down Expand Up @@ -2485,6 +2486,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20201018233116'),
('20201019010226'),
('20201230145346'),
('20210116203058');
('20210116203058'),
('20210123134411');


18 changes: 17 additions & 1 deletion lib/tasks/mrb.rake
Expand Up @@ -23,4 +23,20 @@ namespace :mrb do
end
end
end
end
end

=begin
// /_next/data/OobI_r5osFBZZ3qHQV04X/experts.json
let experts = window.__NEXT_DATA__.props.pageProps.data.topRecommenders;
// /mike-rowe-books
let recos = Array.from(document.querySelectorAll('div#maincontent div.tab-pane')[0].querySelectorAll('li')).map((li) => ({
cover: li.querySelector('img').src,
genius_link: li.querySelector('a').href,
title: li.querySelector('h3').innerText,
author: li.querySelector('h4').innerText,
review: li.querySelector('p').innerText.replace("Source:",""),
source: li.querySelector('p a').href
}));
=end

0 comments on commit 712d74a

Please sign in to comment.