فهرست منبع

Another cache header fix

Torkel Ödegaard 11 سال پیش
والد
کامیت
7919d79347
4فایلهای تغییر یافته به همراه30 افزوده شده و 2 حذف شده
  1. 2 2
      pkg/cmd/web.go
  2. 8 0
      src/app/features/dashboard/rowCtrl.js
  3. 8 0
      src/app/partials/dashboard.html
  4. 12 0
      src/css/less/panel.less

+ 2 - 2
pkg/cmd/web.go

@@ -66,12 +66,12 @@ func newMacaron() *macaron.Macaron {
 
 func mapStatic(m *macaron.Macaron, dir string, prefix string) {
 	headers := func(c *macaron.Context) {
-		c.Resp.Header().Set("Cache-Control", "public max-age: 3600")
+		c.Resp.Header().Set("Cache-Control", "public, max-age: 3600")
 	}
 
 	if setting.Env == setting.DEV {
 		headers = func(c *macaron.Context) {
-			c.Resp.Header().Set("Cache-Control", "max-age: 0")
+			c.Resp.Header().Set("Cache-Control", "max-age: 0, must-revalidate")
 		}
 	}
 

+ 8 - 0
src/app/features/dashboard/rowCtrl.js

@@ -168,4 +168,12 @@ function (angular, app, _, config) {
     };
   });
 
+  module.directive('panelGhostPanel', function() {
+    return function(scope, element) {
+      var dropZoneSpan = 12 - scope.dashboard.rowSpan(scope.row);
+      element.find('.panel-container').css('height', scope.row.height);
+      element[0].style.width = ((dropZoneSpan / 1.2) * 10) + '%';
+    };
+  });
+
 });

+ 8 - 0
src/app/partials/dashboard.html

@@ -86,6 +86,14 @@
 						<panel-loader type="panel.type" class="panel-margin"></panel-loader>
 					</div>
 
+					<div panel-ghost-panel class="panel ghost-panel panel-margin">
+						<div class="panel-container">
+							<div style="text-align: center">
+								<h2>Add panel</h2>
+							</div>
+						</div>
+					</div>
+
 					<div panel-drop-zone class="panel panel-drop-zone"
 							 ui-on-drop="onDrop($data, row)"
 							 data-drop="true">

+ 12 - 0
src/css/less/panel.less

@@ -169,6 +169,18 @@
   }
 }
 
+.ghost-panel {
+  &:hover {
+    .panel-container {
+      visibility: visible;
+    }
+  }
+  .panel-container {
+    visibility: hidden;
+    border: 1px solid @grayDark;
+  }
+}
+
 .panel-time-info {
   font-weight: bold;
   float: right;