fablabbcn/fablabs

View on GitHub
app/views/users/show.html.haml

Summary

Maintainability
Test Coverage
- if current_user
  = render "backstage/header"

.container.mt-3
  .d-block
    = image_tag @user.avatar_url, class: 'avatar big', style: 'margin-left:30px'
    .ml-3.mt-2
      = title @user
      %em.d-block
        Joined #{time_ago_in_words(@user.created_at)} ago.
      - if current_user&.has_role? :superadmin
        = link_to 'Edit on /admin', admin_user_url(@user), class: 'text-secondary d-block'
      - if current_or_null_user == @user
        = link_to settings_path, class: 'button tiny' do
          = icon "edit", "Edit Profile"
        %br
        = link_to password_path, class: 'button tiny' do
          = icon "key", "Change Password"

      .my-3
        - if @user.bio?
          - if @user.passed_spam_period?
            %h5 Bio
            = simple_format @user.bio
          - else
            .alert.alert-warning{:role => "alert"}
              %p Because of high amount of spam users, the biography will only be shown after the user has been a memeber for two months.

      = render "links", links: @user.links if @user.passed_spam_period?

      - if @user.employees.with_approved_state.any?
        %h5.border-bottom Works at:
        %ul.list-unstyled
          - @user.employees.with_approved_state.each do |employee|
            = content_tag_for :li, employee do
              = link_to employee.lab, employee.lab
              \-
              = employee.job_title

  - if @user.created_projects.any? or @user.projects.any?
    .text-large.text-left.text-lg-center
      Contributions
    = render @user.created_projects | @user.projects
  .my-2
    .text-large.text-left.text-lg-center
      Activity
    .activity.vertical-timeline
      = puts @user.activities
      = render @user.activities

  - if false #@user.username.present? #hide discourse iframe for now
    .row
      %iframe{src: @user.discourse_profile_url,
      frameborder: "0",
      width:       '100%',
      scrolling:   'yes',
      height:      1500,
      style:       'border: none'}