This file contains hidden or 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
<!doctype html> | |
<html amp> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="canonical" href="self.html" /> | |
<link href="https://fonts.googleapis.com/css?family=Crimson+Text|Fredoka+One" rel="stylesheet"> | |
<meta name="viewport" content="width=device-width,minimum-scale=1"> | |
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style |
This file contains hidden or 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
<div class="mui-row"> | |
<div class="mui-col-md-12"> | |
<h1>Create a new course</h1> | |
<form method="post" action="/courses" class="mui-form"> | |
<legend>Course name</legend> | |
<div class="mui-textfield"> | |
<input type="text" name="name" id="name" required/> | |
</div> | |
<legend>Course icon</legend> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>📚 Online Course Management</title> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link href="//cdn.muicss.com/mui-0.9.18/css/mui.min.css" rel="stylesheet" type="text/css" /> | |
<script src="//cdn.muicss.com/mui-0.9.18/js/mui.min.js"></script> | |
<style> |
This file contains hidden or 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
class Product < ActiveRecord::Base | |
belongs_to :wishlist | |
belongs_to :category | |
# Validations | |
validates :name, :price, :url, :image_link, presence: true | |
validates :url, uniqueness: true | |
validates :name, length: {minimum: 2} | |
#Scope methods |
This file contains hidden or 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
require 'nokogiri' | |
require 'open-uri' | |
require 'pry' | |
class Scraper | |
def get_page(url_str) | |
html = open(url_str) | |
doc = Nokogiri::HTML(html) | |
doc |
This file contains hidden or 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
Rails.application.routes.draw do | |
post '/wishlists/:id/toggle_product' => 'wishlists#toggle_product', as: :toggle_wishlist_product | |
resources :users do | |
resources :wishlists | |
end | |
resources :sessions | |
resources :products do |
This file contains hidden or 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
<!-- Button to show Next Product using AJAX GET request--> | |
<button class="js-next" data-id="<%= @product.id %>">Next product</button> | |
<br> | |
<!-- Product square --> | |
<div class="product-square"> | |
<h1 class="name"><%= @product.name%></h1> | |
<p class="category">Category: <%= @product.category.name%></p> | |
<p class="price">Price: <%= "#{number_to_currency(@product.price)}" %></p> |
This file contains hidden or 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
<!-- Wishlist square --> | |
<div class="wishlist-info"> | |
<h1>Wishlist: <%= @wishlist.name%></h1> | |
<p>Created on: <%= @wishlist.date_created%></p> | |
<p>Budget: <%= number_to_currency(@wishlist.budget)%></p> | |
<p>Notes: <%= @wishlist.notes%></p> | |
<% if display_edit_delete_link %> | |
<%= link_to("Edit wishlist", edit_user_wishlist_path(@user, @wishlist)) %><br><br> |
This file contains hidden or 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
<h1>Create a new wishlist</h1> | |
<!-- Form for creating a new Wishlist --> | |
<%= form_for([user, wishlist]) do |f|%> | |
<p> | |
<%= f.label :name %> | |
<%= f.text_field :name %><br> | |
<%= f.label :budget %> | |
<%= f.number_field :budget, value: number_to_currency(f.object.budget.to_f, delimiter: '', unit: ''), step: :any %><br> |
OlderNewer