define([
  'angular'
],
function (angular) {
  'use strict';

  angular
    .module('kibana.directives')
    .directive('configModal', function($modal,$q) {
      return {
        restrict: 'A',
        link: function(scope, elem) {

          // create a new modal. Can't reuse one modal unforunately as the directive will not
          // re-render on show.
          elem.bind('click',function(){

            var tmpScope = scope.$new();
            tmpScope.panel = angular.copy(scope.panel);

            tmpScope.editSave = function(panel) {
              scope.panel = panel;
            };

            var panelModal = $modal({
              template: './app/partials/paneleditor.html',
              persist: true,
              show: false,
              scope: tmpScope,
              keyboard: false
            });

            // and show it
            $q.when(panelModal).then(function(modalEl) {
              modalEl.modal('show');
            });
            scope.$apply();
          });
        }
      };
    });
});
@@ -13,16 +13,32 @@
 angular'
+,%0A  'underscore'
 %0A%5D,%0Afunc
@@ -50,16 +50,18 @@
 (angular
+,_
 ) %7B%0A  'u
@@ -412,16 +412,93 @@
 ion()%7B%0A%0A
+            // Create a temp scope so we can discard changes to it if needed%0A
         
@@ -633,24 +633,145 @@
 on(panel) %7B%0A
+              // Correctly set the top level properties of the panel object%0A              _.each(panel,function(v,k) %7B%0A  
             
@@ -787,16 +787,19 @@
 anel
+%5Bk%5D
  = panel
 ;%0A  
@@ -794,16 +794,37 @@
  = panel
+%5Bk%5D;%0A              %7D)
 ;%0A      

Fix saving of top level panel properties