{{template "base/head" .}}
{{template "base/navbar" .}}
<div id="body-nav">
    <div class="container">
        <div class="btn-group pull-left" id="dashboard-switch">
            <button type="button" class="btn btn-default">
                <img src="{{.ContextUser.AvatarLink}}?s=28" alt="user-avatar" title="username">
                {{.ContextUser.Name}}
            </button>
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                <span class="caret"></span>
            </button>
            <div class="dropdown-menu clone-group-btn no-propagation">
                <ul id="dashboard-switch-menu" class="list-unstyled">
                    <li{{if not .PageIsOrgDashboard}} class="checked"{{end}}>
                        <a href="/">
                            <i class="fa fa-check"></i>
                            <img src="{{.SignedUser.AvatarLink}}?s=28" alt="user-avatar" title="username">
                            {{.SignedUser.Name}}
                        </a>
                    </li>
                    {{range .Orgs}}
                    <li{{if eq $.ContextUser.Id .Id}} class="checked"{{end}}>
                        <a href="/org/{{.Name}}/dashboard">
                            <i class="fa fa-check"></i>
                            <img src="{{.AvatarLink}}?s=28" alt="user-avatar" title="username">
                            {{.Name}}
                        </a>
                    </li>
                    {{end}}
                    <li>
                        <a href="/org/create">Create organization</a>
                    </li>
                </ul>
            </div>
        </div>
        <ul class="nav nav-pills pull-right">
            <li class="active"><a href="/{{if .PageIsOrgDashboard}}org/{{.ContextUser.Name}}/dashboard{{end}}">News Feed</a></li>
            <li><a href="/{{if .PageIsOrgDashboard}}org/{{.ContextUser.Name}}/dashboard/{{end}}issues">Issues</a></li>
            {{if .PageIsOrgDashboard}}<li><a href="/org/{{.ContextUser.Name}}/settings">Settings</a></li>{{end}}
            <!-- <li><a href="/pulls">Pull Requests</a></li>
            <li><a href="/stars">Stars</a></li> -->
        </ul>
    </div>
</div>

<div id="body" class="container" data-page="user">
    {{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}}
    <div id="feed-left" class="col-md-8">
        <ul class="list-unstyled activity-list">
        {{range .Feeds}}
            <li>
                <i class="icon fa fa-{{ActionIcon .OpType}}"></i>
                <div class="info"><span class="meta">{{TimeSince .Created}}</span><br>{{ActionDesc . | str2html}}</div>
                <span class="clearfix"></span>
            </li>
        {{else}}
            <li>Oh. Looks like there isn't any activity here yet. Get Busy!</li>
        {{end}}
        </ul>
    </div>
    <div id="feed-right" class="col-md-4">
        <div class="panel panel-default repo-panel">
            <div class="panel-heading">{{if not .PageIsOrgDashboard}}Your {{end}}Repositories
                <div class="btn-group pull-right" id="user-dashboard-repo-new">
                    <button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus-square"></i>New</button>
                    <div class="dropdown-menu dropdown-menu-right">
                       <ul class="list-unstyled">
                           <li><a href="/repo/create"><i class="fa fa-book"></i>Repository</a></li>
                           <li><a href="/repo/migrate"><i class="fa fa-clipboard"></i>Migration</a></li>
                           <!-- <li><a href="#"><i class="fa fa-users"></i>Organization</a></li> -->
                       </ul>
                    </div>
                </div>
            </div>
            
            <div class="panel-body">
                <ul class="list-group">{{range .MyRepos}}
                    <li class="list-group-item"><a href="/{{$.ContextUser.Name}}/{{.Name}}">
                        <!-- <span class="stars pull-right"><i class="fa fa-star"></i>{{.NumStars}}</span> -->
                        <i class="fa fa-book"></i>{{.Name}}{{if .IsPrivate}} <span class="label label-default">Private</span>{{end}}</a>
                    </li>{{end}}
                </ul>
            </div>
        </div>
        
        {{if not .PageIsOrgDashboard}}
        <div class="panel panel-default repo-panel">
            <div class="panel-heading">Collaborative Repositories</div>
            <div class="panel-body">
                <ul class="list-group">{{range .CollaborativeRepos}}
                    <li class="list-group-item"><a href="/{{.Owner.Name}}/{{.Name}}">
                        <!-- <span class="stars pull-right"><i class="fa fa-star"></i>{{.NumStars}}</span> -->
                        <i class="fa fa-book"></i>{{.Name}}{{if .IsPrivate}} <span class="label label-default">Private</span>{{end}}</a>
                    </li>{{end}}
                </ul>
            </div>
        </div>
        {{end}}
    </div>
</div>
{{template "base/footer" .}}
