From 15938ae7bf251d43b97313767ea4fe92bb639bfc Mon Sep 17 00:00:00 2001
From: Vadim Venediktov
Date: Fri, 19 Jan 2018 20:38:08 +0300
Subject: [PATCH] User Profile: Course cards from user reviews
---
app/assets/stylesheets/custom.scss | 19 +++++++++++++++++++
app/controllers/users_controller.rb | 1 +
app/views/layouts/application.html.erb | 4 ++--
app/views/partials/_navbar.html.erb | 2 +-
app/views/users/show.html.erb | 25 +++++++++++++++++++++++++
config/locales/en.yml | 1 +
6 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/app/assets/stylesheets/custom.scss b/app/assets/stylesheets/custom.scss
index d295fa0..5318fa9 100644
--- a/app/assets/stylesheets/custom.scss
+++ b/app/assets/stylesheets/custom.scss
@@ -36,3 +36,22 @@ body {
margin-top: -0.1em;
}
+.text-bg-primary {
+ background: rgba($gray-100, 0.9);
+ padding: .075em;
+}
+
+.text-limit {
+ position: relative;
+}
+
+$text-limit-line-height: 1.25em;
+
+.text-limit-4-inner {
+ position: relative;
+ display: inline-block;
+ word-wrap: break-word;
+ overflow: hidden;
+ line-height: $text-limit-line-height;
+ max-height: $text-limit-line-height * 4;
+}
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 36fbae5..3d6581c 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -3,6 +3,7 @@ class UsersController < ApplicationController
before_action :set_user
def show
+ @reviews = @user.reviews
end
def edit
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 772b7b6..792411e 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -1,7 +1,7 @@
- Allcourses
+ <%= t 'app_name' %>
@@ -23,7 +23,7 @@
diff --git a/app/views/partials/_navbar.html.erb b/app/views/partials/_navbar.html.erb
index c04c045..e824a77 100644
--- a/app/views/partials/_navbar.html.erb
+++ b/app/views/partials/_navbar.html.erb
@@ -1,6 +1,6 @@
<% end %>
+
+
+ <% @reviews.each do |review| %>
+ <% course = review.course %>
+
+
+
+
![[Logo]](https://placeimg.com/300/200/tech?t=<%= rand(10000) %>)
+
+
+
+
+ <%= course.title %>
+
+
+
<%= course.genre %>
+
+
+
+
+
+ <% end %>
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 6e63f1e..57fd3cf 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -30,6 +30,7 @@
# available at http://guides.rubyonrails.org/i18n.html.
en:
+ app_name: AllCourses
time:
formats:
date: '%d %B %Y'