<div class="container{{if viewingSelf ' viewing-self'}}">
  <section class='user-main'>
    <section class="{{if collapsedInfo 'collapsed-info'}} about {{if model.profileBackground 'has-background' 'no-background'}}"  style={{model.profileBackground}}>
    {{#unless collapsedInfo}}
    <div class='staff-counters'>
      {{#if model.number_of_flags_given}}
        <div><span class="helpful-flags">{{model.number_of_flags_given}}</span>&nbsp;{{i18n 'user.staff_counters.flags_given'}}</div>
      {{/if}}
      {{#if model.number_of_flagged_posts}}
        <div>
          {{#link-to 'user.flaggedPosts' model}}
            <span class="flagged-posts">{{model.number_of_flagged_posts}}</span>&nbsp;{{i18n 'user.staff_counters.flagged_posts'}}
          {{/link-to}}
        </div>
      {{/if}}
      {{#if model.number_of_deleted_posts}}
        <div>
          {{#link-to 'user.deletedPosts' model}}
            <span class="deleted-posts">{{model.number_of_deleted_posts}}</span>&nbsp;{{i18n 'user.staff_counters.deleted_posts'}}
          {{/link-to}}
        </div>
      {{/if}}
      {{#if model.number_of_suspensions}}
        <div><span class="suspensions">{{model.number_of_suspensions}}</span>&nbsp;{{i18n 'user.staff_counters.suspensions'}}</div>
      {{/if}}
      {{#if model.number_of_warnings}}
        <div><span class="warnings-received">{{model.number_of_warnings}}</span>&nbsp;{{i18n 'user.staff_counters.warnings_received'}}</div>
      {{/if}}
    </div>
    {{/unless}}

      <div class='profile-image'></div>
      <div class='details'>
        <div class='primary'>
          {{bound-avatar model "huge"}}
          <section class='controls'>
            <ul>
              {{#if model.can_send_private_message_to_user}}
              <li>
                <a class='btn btn-primary' {{action "composePrivateMessage" model}}>
                  {{fa-icon "envelope"}}
                  {{i18n 'user.private_message'}}
                </a>
              </li>
              {{/if}}
              {{#if currentUser.staff}}
                <li><a href={{model.adminPath}} class="btn">{{fa-icon "wrench"}}{{i18n 'admin.user.show_admin_profile'}}</a></li>
              {{/if}}
              {{plugin-outlet "user-profile-controls" tagName="li"}}

              {{#if collapsedInfo}}
              {{#if viewingSelf}}
              <li><a {{action "expandProfile"}} href class="btn">{{fa-icon "angle-double-down"}}{{i18n 'user.expand_profile'}}</a></li>
              {{/if}}
              {{/if}}

            </ul>
          </section>

          <div class="primary-textual">
            <h1 class="{{if nameFirst "full-name" "username"}}">{{if nameFirst model.name model.username}} {{user-status model currentUser=currentUser}}</h1>
            <h2 class="{{if nameFirst "username" "full-name"}}">{{#if nameFirst}}{{model.username}}{{else}}{{model.name}}{{/if}}</h2>
            {{#if model.title}}
              <h3>{{model.title}}</h3>
            {{/if}}
            {{plugin-outlet "user-post-names"}}
            <h3>
            {{#if model.location}}{{fa-icon "map-marker"}} {{model.location}}{{/if}}
            {{#if model.website_name}}
              {{fa-icon "globe"}}
              {{#if linkWebsite}}
                <a href={{model.website}} rel={{unless removeNoFollow 'nofollow'}} target="_blank">{{model.website_name}}</a>
              {{else}}
                <span title={{model.website}}>{{model.website_name}}</span>
              {{/if}}
            {{/if}}
            </h3>

            <div class='bio'>
              {{#if model.isSuspended}}
                <div class='suspended'>
                  {{fa-icon "ban"}}
                  <b>{{i18n 'user.suspended_notice' date=model.suspendedTillDate}}</b><br/>
                  <b>{{i18n 'user.suspended_reason'}}</b> {{model.suspend_reason}}
                </div>
              {{/if}}
              {{{model.bio_cooked}}}
            </div>

            {{#if publicUserFields}}
              <div class="public-user-fields">
                {{#each publicUserFields as |uf|}}
                  {{#if uf.value}}
                    <div class="public-user-field {{uf.field.dasherized_name}}">
                      <span class="user-field-name">{{uf.field.name}}</span>:
                      <span class="user-field-value">{{uf.value}}</span>
                    </div>
                  {{/if}}
                {{/each}}

                {{plugin-outlet "user-profile-public-fields"}}
              </div>
            {{/if}}

            {{plugin-outlet "user-profile-primary"}}

          </div>
        </div>
        <div style='clear: both'></div>
      </div>


      {{#unless collapsedInfo}}
      <div class='secondary'>
        <dl>
          {{#if model.created_at}}
            <dt>{{i18n 'user.created'}}</dt><dd>{{bound-date model.created_at}}</dd>
          {{/if}}
          {{#if model.last_posted_at}}
            <dt>{{i18n 'user.last_posted'}}</dt><dd>{{bound-date model.last_posted_at}}</dd>
          {{/if}}
          {{#if model.last_seen_at}}
            <dt>{{i18n 'user.last_seen'}}</dt><dd>{{bound-date model.last_seen_at}}</dd>
          {{/if}}
          <dt>{{i18n 'views'}}</dt><dd>{{model.profile_view_count}}</dd>
          {{#if model.invited_by}}
            <dt class="invited-by">{{i18n 'user.invited_by'}}</dt><dd class="invited-by">{{#link-to 'user' model.invited_by}}{{model.invited_by.username}}{{/link-to}}</dd>
          {{/if}}
          <dt class="trust-level">{{i18n 'user.trust_level'}}</dt><dd class="trust-level">{{model.trustLevel.name}}</dd>
          {{#if canCheckEmails}}
            <dt>{{i18n 'user.email.title'}}</dt>
            <dd title={{model.email}}>
              {{#if model.email}}
                {{model.email}}
              {{else}}
                {{d-button action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" class="btn-primary"}}
              {{/if}}
            </dd>
          {{/if}}
          {{#if model.displayGroups}}
            <dt class="groups">{{i18n 'groups.title' count=model.displayGroups.length}}</dt>
            <dd class='groups'>
              {{#each model.displayGroups as |group|}}
                <span>{{#link-to 'group' group class="group-link"}}{{group.name}}{{/link-to}}</span>
              {{/each}}
            </dd>
          {{/if}}
          {{#if canDeleteUser}}
            {{d-button action="adminDelete" icon="exclamation-triangle" label="user.admin_delete" class="btn-danger"}}
          {{/if}}
        </dl>
        {{plugin-outlet "user-profile-secondary"}}
      </div>
      {{/unless}}
    </section>

    {{#mobile-nav class='main-nav' desktopClass="nav nav-pills user-nav" currentPath=currentPath}}
      <li>{{#link-to 'userActivity'}}{{i18n 'user.activity_stream'}}{{/link-to}}</li>
      {{#if showNotificationsTab}}
        <li>
          {{#link-to 'userNotifications'}}
            {{fa-icon "comment" class="glyph"}}{{i18n 'user.notifications'}}
          {{/link-to}}
        </li>
      {{/if}}
      {{#if showPrivateMessages}}
        <li>{{#link-to 'userPrivateMessages'}}{{fa-icon "envelope-o"}}{{i18n 'user.private_messages'}}{{/link-to}}</li>
      {{/if}}
      {{#if canInviteToForum}}
        <li>{{#link-to 'userInvited'}}{{fa-icon "user-plus"}}{{i18n 'user.invited.title'}}{{/link-to}}</li>
      {{/if}}
      {{#if showBadges}}
        <li>{{#link-to 'user.badges'}}{{fa-icon "certificate"}}{{i18n 'badges.title'}}{{/link-to}}</li>
      {{/if}}
      <li>{{#link-to 'user.summary'}}{{i18n 'user.summary.title'}}{{/link-to}}</li>
      {{#if model.can_edit}}
        <li>{{#link-to 'preferences'}}{{fa-icon "cog"}}{{i18n 'user.preferences'}}{{/link-to}}</li>
      {{/if}}
    {{/mobile-nav}}

    <div class='user-table'>
      <div class='wrapper'>
        {{outlet}}
      </div>
    </div>

  </section>
</div>
