Pārlūkot izejas kodu

Merge branch 'master' of gitote.in:gitote/gitote

Yoginth 7 gadi atpakaļ
vecāks
revīzija
9735ddee11

+ 0 - 15
pkg/context/context.go

@@ -8,11 +8,9 @@ import (
 	"gitote/gitote/pkg/form"
 	"gitote/gitote/pkg/setting"
 	"gitote/gitote/pkg/template"
-	"gitote/gitote/pkg/tool"
 	"io"
 	"net/http"
 	"path"
-	"runtime"
 	"strings"
 	"time"
 
@@ -223,17 +221,6 @@ func (c *Context) ServeContent(name string, r io.ReadSeeker, params ...interface
 	http.ServeContent(c.Resp, c.Req.Request, name, modtime, r)
 }
 
-var sysStatus struct {
-	MemAllocated string
-}
-
-func updateSystemStatus() {
-	m := new(runtime.MemStats)
-	runtime.ReadMemStats(m)
-
-	sysStatus.MemAllocated = tool.FileSize(int64(m.Alloc))
-}
-
 // Contexter initializes a classic context for a request.
 func Contexter() macaron.Handler {
 	return func(ctx *macaron.Context, l i18n.Locale, cache cache.Cache, sess session.Store, f *session.Flash, x csrf.CSRF) {
@@ -249,14 +236,12 @@ func Contexter() macaron.Handler {
 			},
 			Org: &Organization{},
 		}
-		updateSystemStatus()
 
 		if strings.Title(macaron.Env) == "Development" {
 			c.Data["Lab"] = 1
 		} else {
 			c.Data["Lab"] = 0
 		}
-		c.Data["AdminBar"] = sysStatus
 		c.Data["Link"] = template.EscapePound(c.Link)
 		c.Data["PageStartTime"] = time.Now()
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
public/css/gitote.min.css


+ 20 - 0
public/expansion/expansion.js

@@ -0,0 +1,20 @@
+var nextWord = (function() {
+    var wordArray = [
+        'Gitote Is Tasty',
+        'Get In Touch',
+        'Get It Tested',
+        'GNU Interactive Tools',
+        'Goods In Transit',
+        'Geek In Training',
+        'Goddess In Training',
+        'Gentleman In Training',
+        'Geologist In Training',
+        'Geeks In Town',
+        'General Information Test'
+    ];
+    var copy;
+    return function() {
+        if (!copy || !copy.length) copy = wordArray.slice();
+        return copy.splice(Math.random() * copy.length | 0, 1);
+    }
+}());

+ 0 - 36
public/less/_admin.less

@@ -91,42 +91,6 @@
 	}
 }
 
-.adminbar {
-	&.main {
-		background-color: #2f363c;
-		border-bottom: 1px solid #454e57;
-		height: 41px;
-	}
-	&.text {
-		padding: @5 0 !important;
-		color: #fff !important;
-		font-size: 13px !important;
-	}
-	&.embed {
-		background: @primary;
-		padding: 3px @5;
-		border-radius: 4px;
-		margin: @5 3px;
-		font-size: 11px;
-	}
-	&.branch {
-		margin-left: -@5;
-	}
-	&.logo {
-		width: 13px !important;
-		margin-top: -1px !important;
-		margin-left: @5;
-		margin-right: 1px;
-	}
-	&.align {
-		margin-right: @5;
-	}
-	&.divider {
-		border-left: 1px solid #ababab;
-		margin-right: @10;
-	}
-}
-
 .admin-badge {
 	font-size: 10px !important;
 }

+ 47 - 0
public/less/_base.less

@@ -577,6 +577,53 @@ footer {
     margin-left: 8px !important;
 }
 
+
+.infobar {
+	color: @white;
+	
+	&.align {
+		margin-right: 18px;
+	}
+	&.admin-align {
+		margin-right: 5px;
+	}
+	&.heart {
+		font-size: 12px;
+    	margin-right: 5px;
+	}
+	&.expansion {
+		cursor: pointer;
+	    letter-spacing: .2px;
+	    user-select: none;
+	    display: inline-block;
+	    position: relative;
+	    z-index: 1;
+	    padding: 1em;
+	    margin: -1em;
+	}
+	&.main {
+		background-color: #2f363c;
+		border-bottom: 1px solid #454e57;
+		height: 41px;
+	}
+	&.embed {
+		background: @primary;
+		padding: 3px @5;
+		border-radius: 4px;
+		margin: @5 3px;
+		font-size: 11px;
+	}
+	&.text {
+		padding: @5 0 !important;
+		color: #fff !important;
+		font-size: 13px !important;
+	}
+	&.divider {
+		border-left: 1px solid #ababab;
+		margin-right: @10;
+	}
+}
+
 @media only screen and (max-width: 991px) and (min-width: 768px) {
 	.ui.container {
 		width: 95%;

+ 3 - 2
templates/base/head.tmpl

@@ -75,6 +75,7 @@
 
 	<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.1/semantic.min.js"></script>
 	<script src="https://cdn.jsdelivr.net/npm/gitote@1.3.2/js/gitote.min.js?v={{MD5 AppVer}}"></script>
+	<script src="{{AppURL}}expansion/expansion.js?v={{MD5 AppVer}}"></script>
 
 	{{if not .IsLogged}}
 		{{if .PageIsHome}}
@@ -95,8 +96,8 @@
 		{{if not .PageIsInstall}}
 		{{if not .PageIsSuspended}}
 			<div class="following bar light" style="{{if not .IsLogged}}padding-top:5px;padding-bottom:5px{{end}}">
-				{{if or .IsAdmin .IsStaff .IsIntern}}
-					{{template "misc/admin_bar" .}}
+				{{if .IsLogged}}
+					{{template "base/info_bar" .}}
 				{{end}}
 				<div class="navbar container">
 					<div class="ui grid">

+ 55 - 0
templates/base/info_bar.tmpl

@@ -0,0 +1,55 @@
+<div class="navbar container infobar main">
+    <div class="ui grid">
+        <div class="column">
+            <div class="ui left floated header infobar text">
+                {{if or .IsAdmin .IsStaff .IsIntern}}
+                    <span class="infobar admin-align hide-mobile">
+                        Version <span class="infobar embed">{{AppVer}}</span>
+                    </span>
+                    
+                    <span class="infobar admin-align hide-mobile">
+                        Render
+                        <span class="infobar embed">{{LoadTimes .PageStartTime}}</span>
+                    </span>
+                {{end}}
+                <span class="infobar align">
+                    <span class="infobar heart">❤</span>
+                    <span 
+                        id="expansion" 
+                        class="infobar expansion" 
+                        onclick="document.getElementById('expansion').innerHTML = nextWord();" >
+                        Get It Together
+                    </span>
+                </span>
+            </div>
+            <div class="ui right floated header infobar text">
+                {{if or .IsAdmin .IsStaff .IsIntern}}
+                    <div class="ui dropdown">
+                        {{if .Lab}}<i class="octicon octicon-pulse"></i>
+                        {{else}}<i class="octicon octicon-squirrel"></i>
+                        {{end}}
+                    </div>
+                    <span class="infobar admin-align hide-mobile">
+                        {{if .Lab}}Gitote:Lab{{else}}Gitote:Prod{{end}}
+                    </span>
+                    
+                    <span class="infobar divider hide-mobile"></span>
+
+                    <span class="infobar align hide-mobile">{{GoVer}}</span>
+                {{end}}
+                <a href="{{AppURL}}about">
+                    <span class="infobar align hide-mobile">About</span>
+                </a>
+                <a href="{{AppURL}}features">
+                    <span class="infobar align hide-mobile">Features</span>
+                </a>
+                <a href="https://help.gitote.in">
+                    <span class="infobar align hide-mobile">Docs</span>
+                </a>
+                <a href="{{AppURL}}contact">
+                    <span class="infobar">Support</span>
+                </a>
+            </div>
+        </div>
+    </div>
+</div>

+ 0 - 52
templates/misc/admin_bar.tmpl

@@ -1,52 +0,0 @@
-<div class="navbar container adminbar main">
-    <div class="ui grid">
-        <div class="column">
-            <div class="ui left floated header adminbar text">
-                <span class="adminbar align">
-                    Version <span class="adminbar embed">{{AppVer}}</span>
-                </span>
-                
-                <span class="adminbar align hide-mobile">
-                    Render
-                    <span class="adminbar embed">{{LoadTimes .PageStartTime}}</span>
-                </span>
-
-                <span class="adminbar align hide-mobile">
-                    Browser
-                    <span class="adminbar embed" id="browser"><span>···</span></span>
-                </span>
-            </div>
-            <div class="ui right floated header adminbar text">
-                <div class="ui dropdown">
-                    {{if .Lab}}<i class="octicon octicon-pulse"></i>
-                    {{else}}<i class="octicon octicon-squirrel"></i>
-                    {{end}}
-                </div>
-
-                <span class="adminbar align hide-mobile">
-                    {{if .Lab}}Gitote:Lab{{else}}Gitote:Prod{{end}}
-                </span>
-                <span class="adminbar divider hide-mobile"></span>
-
-                <span class="adminbar align hide-mobile">
-                    Current Memory
-                    <span class="adminbar embed">{{.AdminBar.MemAllocated}}</span>
-                </span>
-
-                <span>{{GoVer}}</span>
-
-                <a href="{{AppURL}}admin">
-                    <span style="font-size:12px;color:white;margin-left:10px" class="octicon octicon-rocket"></span>
-                </a>
-            </div>
-        </div>
-    </div>
-</div>
-
-<script>
-var renderStart = new Date().getTime();
-window.onload = function() { 
-    var elapsed = new Date().getTime() - renderStart;
-    $('#browser').html(elapsed + 'ms');
-}
-</script>