app/views/authors/show.haml
%section.row
.cell.well.well--l
.g
.g-b.g-b--m--1of3
.card.card--b.tac.mbs.has-card-section
= image_tag @author.image, class: 'mbm ra', width: 160, height: 160
%h1.tsl
= @author.name
- unless @author.active
%span.db.tss (Inactive)
- if current_user == @author
.form
= simple_form_for @author.object, url: author_path( @author ), method: :patch do | f |
%fieldset.form-field
- if @author == current_user
= f.text_area :shtick, required: false, placeholder: 'What do you do?',
class: 'form-input form-input--textarea'
- else
= f.text_area :shtick, required: false, placeholder: 'What do they do?',
class: 'form-input form-input--textarea'
= f.submit 'Update', class: 'button button--b'
- else
%p.mbxs= @author.shtick
%p= @author.email
- if @author == current_user
= @author.toggle_email_privacy
.card-section.card-section--row
%h2.mbs Contributions
%p.mbxs.tss Created #{ pluralize( @author.articles.count, 'article' ) }
%p.mbf.tss Edited #{ pluralize( @author.edits.count, 'article' ) }
.tac.mbm
= link_to 'Toggle Status', author_toggle_status_path( @author ), method: :put
.g-b.g-b--m--2of3
%h2.mbs Created Articles
- if @author.articles.count > 0
- # TODO: Apply signal classes unique to Article decorator
%ul.list.list--xs.mbl
- @author.articles.each do | article |
%li.card.list-item.article{ class: ( 'has-article-footer' if article.tags.any? ) }
= link_to article.title, article, class: 'article-title'
- else
- if current_user == @author
%p
Hey, everyone has to start somewhere.
= link_to 'Create an article', new_article_url, class: 'dib'
- else
%p #{ @author.first_name } hasn't created any articles yet.
%h2.mbs Edited Articles
- if @author.edits.count > 0
%ul.list.list--xs.mbl
- @author.edits.each do | article |
%li.card.list-item.article{ class: ( 'has-article-footer' if article.tags.any? ) }
= link_to article.title, article, class: 'article-title'
- else
%p #{ @author.first_name } hasn't edited any articles yet.
%h2.mbs Article Subscriptions
- if @author.subscribed_articles.count > 0
%ul.list.list--xs
- @author.subscribed_articles.each do | article |
%li.card.list-item.article{ class: ( 'has-article-footer' if article.tags.any? ) }
= link_to article.title, article, class: 'article-title'
- else
%p #{ @author.first_name } isn't subscribed to any articles yet.