Explorar o código

#1142 Dashboard editor: protects from unwanted "exit" without saving the modifications:
- mark the dashboard as modified when a dashlet was added / moved / deleted
- prevent clicking on the hyperlinks inside the preview of the dashboard

Unrelated modification of the stylesheet to make "actions" buttons look nicer (no gap in the background color) when the displayed at a zoom level different from 100% (e.g. 90% or 75 %)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3739 a333f486-631f-4898-b8df-5754b55c2be0

dflaven %!s(int64=9) %!d(string=hai) anos
pai
achega
0f27470b79
Modificáronse 4 ficheiros con 25 adicións e 6 borrados
  1. 8 3
      css/light-grey.css
  2. 6 3
      css/light-grey.scss
  3. 10 0
      js/dashboard.js
  4. 1 0
      js/dashlet.js

+ 8 - 3
css/light-grey.css

@@ -340,7 +340,7 @@ a.small_action {
   padding-left: 5px;
   padding-top: 2px;
   padding-bottom: 2px;
-  background: url(../images/actions_left.png) no-repeat left;
+  background: #e87c1e url(../images/actions_left.png) no-repeat left;
 }
 
 
@@ -593,7 +593,7 @@ div.actions_menu > ul {
  */
 
   padding-left: 5px;
-  background: url(../images/actions_left.png) no-repeat top left;
+  background: #e87c1e url(../images/actions_left.png) no-repeat top left;
   cursor: pointer;
   margin: 0;
 }
@@ -1484,7 +1484,7 @@ img.first, img.last, img.next, img.prev {
 
 div.actions_button {
   float: right;
-  background: url("../images/actions_left.png") no-repeat scroll left top transparent;
+  background: #e87c1e url("../images/actions_left.png") no-repeat scroll left top transparent;
   padding-left: 5px;
   margin-top: 0;
   margin-right: 10px;
@@ -1522,6 +1522,11 @@ select#org_id {
 }
 
 
+.itop-dashboard a {
+  cursor: not-allowed;
+}
+
+
 .dragHover {
   background: url(./ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png);
 }

+ 6 - 3
css/light-grey.scss

@@ -272,7 +272,7 @@ a.small_action {
 	padding-left: 5px;
 	padding-top: 2px;
 	padding-bottom: 2px;
-	background: url(../images/actions_left.png) no-repeat left;
+	background: $highlight-color url(../images/actions_left.png) no-repeat left;
 }
 .actions_details span{
 	background: url(../images/actions_right.png) no-repeat right;
@@ -450,7 +450,7 @@ div.actions_menu > ul {
 	display:block;
 	nowidth:70px; /* Nasty work-around for IE... en attendant mieux */
 	padding-left: 5px;
-	background: url(../images/actions_left.png) no-repeat top left;
+	background: $highlight-color url(../images/actions_left.png) no-repeat top left;
 	cursor: pointer;
 	margin: 0;
 }
@@ -1105,7 +1105,7 @@ img.prev, img.first, img.next, img.last {
 }
 div.actions_button {
 	float:right;
-	background: url("../images/actions_left.png") no-repeat scroll left top transparent;
+	background: $highlight-color url("../images/actions_left.png") no-repeat scroll left top transparent;
 	padding-left: 5px;
 	margin-top: 0;
 	margin-right: 10px;
@@ -1134,6 +1134,9 @@ select#org_id {
 .itop-dashboard {
 	background-color: #fff;
 }
+.itop-dashboard a {
+	cursor: unquote("not-allowed");
+}
 .dragHover {
 	background: url(./ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png);
 }

+ 10 - 0
js/dashboard.js

@@ -39,6 +39,10 @@ $(function()
 			this.ajax_div = $('<div></div>');
 			this.element.after(this.ajax_div);
 			this._make_draggable();
+			
+			// Make sure we don't click on something we'll regret
+			$('.itop-dashboard').on('click', 'a', function(e) { e.preventDefault(); });
+
 		},
 	
 		// called when created, and later when changing options
@@ -318,7 +322,13 @@ $(function()
 			$.post(this.options.render_to, oParams, function(data){
 				me.ajax_div.html(data);
 				me.add_dashlet_finalize(options, sDashletId, sDashletClass);
+				me.mark_as_modified();
 			});
+		},
+		on_dashlet_moved: function(oDashlet, oReceiver, bRefresh)
+		{
+			this._superApply(arguments);
+			this.mark_as_modified();
 		}
 	});	
 });

+ 1 - 0
js/dashlet.js

@@ -130,6 +130,7 @@ $(function()
 			$('#dashlet_properties_'+iDashletId).remove();
 			this.element.remove();
 			$('#event_bus').trigger('dashlet-removed', {'dashlet_id': iDashletId, 'dashlet_class': sDashletClass, 'container': oContainer});
+			$('.itop-dashboard').trigger('mark_as_modified');
 		}
 	});	
 });