Преглед изворни кода

Removed AdminBar from Context

Yoginth пре 7 година
родитељ
комит
8b1dc5e121
2 измењених фајлова са 0 додато и 33 уклоњено
  1. 0 15
      pkg/context/context.go
  2. 0 18
      templates/base/admin_bar.tmpl

+ 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()
 

+ 0 - 18
templates/base/admin_bar.tmpl

@@ -10,11 +10,6 @@
                     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">
@@ -28,21 +23,8 @@
                 </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>
             </div>
         </div>
     </div>
 </div>
-
-<script>
-var renderStart = new Date().getTime();
-window.onload = function() { 
-    var elapsed = new Date().getTime() - renderStart;
-    $('#browser').html(elapsed + 'ms');
-}
-</script>