nitweb: add user menu
authorAlexandre Terrasa <alexandre@moz-code.org>
Sun, 14 Aug 2016 17:35:06 +0000 (13:35 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 15 Aug 2016 04:59:32 +0000 (00:59 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

share/nitweb/directives/user/user-menu.html [new file with mode: 0644]
share/nitweb/index.html
share/nitweb/stylesheets/nitweb.css

diff --git a/share/nitweb/directives/user/user-menu.html b/share/nitweb/directives/user/user-menu.html
new file mode 100644 (file)
index 0000000..8d1f7bf
--- /dev/null
@@ -0,0 +1,19 @@
+<ul class='nav navbar-nav'>
+       <li ng-if='!user'>
+               <a href='/login'>
+                       Login
+                       <span class='octicon octicon-mark-github'></span>
+               </a>
+       </li>
+       <li class="dropdown" ng-if='user'>
+               <a class="btn btn-link dropdown-toggle" type="button" data-toggle="dropdown">
+                       {{user.login}}
+                       <img class='avatar avatar-icon' ng-src='{{user.avatar_url}}' />
+               </a>
+               <ul class="dropdown-menu dropdown-menu-right">
+                       <li><a href="/user">Profile</a></li>
+                       <li role="separator" class="divider"></li>
+                       <li><a href="/logout">Logout</a></li>
+               </ul>
+       </li>
+</ul>
index 7454ce5..ffd2733 100644 (file)
@@ -14,6 +14,9 @@
                <link href='//cdnjs.cloudflare.com/ajax/libs/angular-loading-bar/0.9.0/loading-bar.min.css'
                        type='text/css' rel='stylesheet' media='all'>
 
+               <link href='https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.css'
+                       type='text/css' rel='stylesheet'>
+
 
                <link href='/stylesheets/nitweb_bootstrap.css' rel='stylesheet'>
                <link href='/stylesheets/nitweb.css' rel='stylesheet'>
@@ -47,6 +50,9 @@
                                                </div>
                                        </form>
                                </div>
+                               <div class='col-xs-2'>
+                                       <user-menu />
+                               </div>
                        </div>
                </nav>
                <div ng-view></div>
index 0fcff6c..0fd2db9 100644 (file)
@@ -252,6 +252,11 @@ entity-list:hover .btn-filter {
        border-radius: 2px;
 }
 
+.avatar-icon {
+       width: 18px;
+       height: 18px;
+}
+
 /*
  * Code Highlighting
  */