Skip to content

Commit

Permalink
Add seller link to article previews
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Altmann committed Dec 1, 2015
1 parent e7d2aef commit 7657622
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/views/articles/shared/_articles_grid.html.slim
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
- with_admin_section = true unless local_assigns.has_key?(:with_admin_section)
- show_seller = true unless local_assigns.has_key?(:show_seller)

.Grid
- articles.each do |article|
.Grid-item
= render '/articles/shared/show_article', article: article
= render '/articles/shared/show_article', article: article, show_seller: show_seller

- if with_admin_section && User.is_admin?(current_user)
.Grid-admin
Expand Down
11 changes: 10 additions & 1 deletion app/views/articles/shared/_show_article.html.slim
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
- show_seller = true unless local_assigns.has_key? :show_seller
- show_extra = (local_assigns.has_key? :extra) && extra

.Article
- cache_if (article.title_image_url_thumb != ArticleImage::PROCESSING_IMAGE_URL && !show_extra), ["articles", article.id, "tile"] do
figure.Article-image
= link_to image_tag(article.title_image_url_thumb), article_path(article.slug), data: { push: true }

.Article-info
h3= link_to truncate(article.title, :length => 65), article_path(article.slug), :title => article.title, data: { push: true }
h3= link_to truncate(article.title, :length => 65), article_path(article.slug),
:title => article.title, data: { push: true }

- if show_seller
.Article-seller
= 'von '
= link_to article.seller_nickname, user_path(article.seller_id)

.Article-price= humanize_money_or_cents article.price

= render "articles/show/basic_price", article: article
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
- else
/ Show user's articles for other visitors
.articles
= render '/articles/shared/articles_grid', articles: @articles
= render '/articles/shared/articles_grid', articles: @articles, show_seller: false
= paginate @articles, param_name: 'active_articles_page'

0 comments on commit 7657622

Please sign in to comment.