fix view source on dashbard4
authorAlan Knowles <alan@roojs.com>
Wed, 25 Nov 2020 10:03:25 +0000 (18:03 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 25 Nov 2020 10:03:25 +0000 (18:03 +0800)
docs/Roo.docs.ViewSource.bjs
docs/Roo.docs.ViewSource.js
examples/bootstrap/dashboard4.bjs
examples/bootstrap/dashboard4.js
examples/bootstrap4/dashboard4.html

index 0829563..08da87d 100644 (file)
@@ -2,7 +2,7 @@
  "name" : "Roo.docs.ViewSource",
  "parent" : "",
  "title" : "",
- "path" : "/home/alan/gitlive/roojs1/docs2/Roo.docs.ViewSource.bjs",
+ "path" : "/home/alan/gitlive/roojs1/docs/Roo.docs.ViewSource.bjs",
  "permname" : "",
  "modOrder" : "001",
  "strings" : {
@@ -12,7 +12,7 @@
  "items" : [
   {
    "listeners" : {
-    "show" : "function (_self)\n{\n  //  if(_this.data.buttonText){\n    //    _this.acceptBtn.setText(_this.data.buttonText);\n   // }\n    \n      _this.body_ctr.el.dom.innerHTML = _this.data.source;\n     _this.body_ctr.el.dom.scrollTop = 0;\n     _this.dialog.setTitle(\"View Source: \" + _this.data.fname);\n    _this.dialog.el.setStyle('zIndex', '10002');\n    \n}"
+    "show" : "function (_self)\n{\n  //  if(_this.data.buttonText){\n    //    _this.acceptBtn.setText(_this.data.buttonText);\n   // }\n    \n    if (typeof( _this.data.source) == 'undefined') {\n        Roo.Ajax.request({\n            url : _this.data.src,\n            method : 'GET',\n            success : function(res, o)\n            {\n                Roo.docs.ViewSource.show({\n                    source : String.format(\"<PRE>{0}</PRE>\",res.responseText),\n                    fname : _this.data.src.split('/').pop()\n                });\n                \n            },\n            scope : this\n        });\n        \n    \n        return;\n    }\n     \n  _this.body_ctr.el.dom.innerHTML = _this.data.source;\n _this.body_ctr.el.dom.scrollTop = 0;\n _this.dialog.setTitle(\"View Source: \" + _this.data.fname);\n    _this.dialog.el.setStyle('zIndex', '10002');\n    \n}"
    },
    "xtype" : "Modal",
    "Boolean fitwindow" : true,
index 6c131db..2785c6f 100644 (file)
@@ -47,9 +47,28 @@ Roo.apply(Roo.docs.ViewSource.prototype, {
           //    _this.acceptBtn.setText(_this.data.buttonText);
          // }
           
-            _this.body_ctr.el.dom.innerHTML = _this.data.source;
-           _this.body_ctr.el.dom.scrollTop = 0;
-           _this.dialog.setTitle("View Source: " + _this.data.fname);
+          if (typeof( _this.data.source) == 'undefined') {
+              Roo.Ajax.request({
+                  url : _this.data.src,
+                  method : 'GET',
+                  success : function(res, o)
+                  {
+                      Roo.docs.ViewSource.show({
+                          source : String.format("<PRE>{0}</PRE>",res.responseText),
+                          fname : _this.data.src.split('/').pop()
+                      });
+                      
+                  },
+                  scope : this
+              });
+              
+          
+              return;
+          }
+           
+        _this.body_ctr.el.dom.innerHTML = _this.data.source;
+       _this.body_ctr.el.dom.scrollTop = 0;
+       _this.dialog.setTitle("View Source: " + _this.data.fname);
           _this.dialog.el.setStyle('zIndex', '10002');
           
       }
index becdfe7..60b7285 100644 (file)
@@ -7,6 +7,7 @@
  "modOrder" : "001",
  "strings" : {
   "098f6bcd4621d373cade4e832627b4f6" : "test",
+  "9c1ab57e621c2bb257798752dbbe6f14" : "view source",
   "e93b3fa481be3932aa08bd68c3deee70" : "example 1",
   "60ee66eb2cd31823032664c2e9a79fd5" : "body goes here",
   "fb66f41b81f5973740bbfed019aa5d7d" : "Upload Images or Documents",
      "$ xns" : "Roo.bootstrap",
      "items" : [
       {
+       "listeners" : {
+        "click" : "function (btn, e)\n{\n    // assumes installed as /roojs1.\n  Roo.docs.ViewSource.show({\n      src: '/roojs1/examples/bootstrap/dashboard4.js'\n  });\n}"
+       },
        "xtype" : "Button",
-       "$ xns" : "Roo.bootstrap"
+       "$ xns" : "Roo.bootstrap",
+       "String html" : "view source"
       },
       {
        "xtype" : "Row",
index 5ea667c..573920b 100644 (file)
@@ -6,6 +6,7 @@ dashboard4 = new Roo.XComponent({
 
  _strings : {
   '098f6bcd4621d373cade4e832627b4f6' :"test",
+  '9c1ab57e621c2bb257798752dbbe6f14' :"view source",
   'e93b3fa481be3932aa08bd68c3deee70' :"example 1",
   '60ee66eb2cd31823032664c2e9a79fd5' :"body goes here",
   'fb66f41b81f5973740bbfed019aa5d7d' :"Upload Images or Documents",
@@ -38,6 +39,16 @@ dashboard4 = new Roo.XComponent({
      items  : [
       {
        xtype : 'Button',
+       html : _this._strings['9c1ab57e621c2bb257798752dbbe6f14'] /* view source */,
+       listeners : {
+        click : function (btn, e)
+         {
+             // assumes installed as /roojs1.
+           Roo.docs.ViewSource.show({
+               src: '/roojs1/examples/bootstrap/dashboard4.js'
+           });
+         }
+       },
        xns : Roo.bootstrap,
        '|xns' : 'Roo.bootstrap'
       },
index 8dc05d8..6ac4310 100644 (file)
@@ -18,7 +18,8 @@
 <script type="text/javascript" src="../../Roo/bootstrap/CardFooter.js"></script>
        <script type="text/javascript" src="../../Roo/bootstrap/CardUploader.js"></script>
 
+  <script type="text/javascript" src="../../docs/Roo.docs.ViewSource.js"></script>
+
          
    
      <script type="text/javascript">