Guest User

Untitled

a guest
Aug 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. <section class="flex h-64 hero-banner p-4">
  2. <section class="flex items-center mx-auto">
  3. <h2 class="uppercase">
  4. <%= @course.title %>
  5. </h2>
  6. </section>
  7. </section>
  8.  
  9. <section class="pt-4 px-4">
  10. <section class="w-full">
  11. <section class="rounded overflow-hidden shadow">
  12. <section style="padding: 56.25% 0 0 0; position: relative;">
  13. <iframe src="https://player.vimeo.com/video/<%= @course.trailer %>" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
  14. </section>
  15. </section>
  16. </section>
  17.  
  18. <section class="flex flex-wrap -mx-4">
  19. <section class="w-full lg:w-3/4 p-4">
  20. <section class="bg-grey-lightest shadow text-grey-darker p-4">
  21. <h2 class="font-normal mb-4">Course description</h2>
  22. <p class="font-normal whitespace-pre-wrap"><%= @course.description %></p>
  23. </section>
  24. </section>
  25. <section class="w-full lg:w-1/4 p-4">
  26. <section class="bg-grey-lightest shadow text-grey-darker p-4 mb-4">
  27. <h3 class="font-normal mb-4">Course Price</h3>
  28. <p class="font-bold text-3xl text-green">£<%= @course.price %></p>
  29. </section>
  30.  
  31. <%= button_to "Buy now", "#", class: "bg-blue hover:bg-blue-dark w-full text-white font-semibold py-3 px-4 border-2 rounded-sm border-blue-dark shadow outline-none" %>
  32.  
  33. <section class="bg-grey-lightest shadow text-grey-darker py-4 px-4 mt-4">
  34. <h3 class="font-normal mb-4">Course Modules</h3>
  35. <% @course_modules.each do |course_module| %>
  36. <section class="py-2 border-b-2 border-light modules">
  37. <%= course_module.title %>
  38. </section>
  39. <% end %>
  40. </section>
  41. </section>
  42. </section>
  43. </section>
  44.  
  45. def show
  46. @course_modules = CourseModule.all
  47. end
  48.  
  49. class Course < ApplicationRecord
  50. has_many :course_modules
  51.  
  52. validates :title, :summary, :description, :trailer, :price, presence: true
  53. end
  54.  
  55. class CourseModule < ApplicationRecord
  56. belongs_to :course
  57. end
  58.  
  59. create_table "course_modules", force: :cascade do |t|
  60. t.string "title"
  61. t.integer "course_id"
  62. t.datetime "created_at", null: false
  63. t.datetime "updated_at", null: false
  64. t.index ["course_id"], name: "index_course_modules_on_course_id"
  65. end
  66.  
  67. create_table "courses", force: :cascade do |t|
  68. t.string "title"
  69. t.text "summary"
  70. t.text "description"
  71. t.string "trailer"
  72. t.integer "price"
  73. t.datetime "created_at", null: false
  74. t.datetime "updated_at", null: false
  75. end
Add Comment
Please, Sign In to add comment