]> jspc29.x-matter.uni-frankfurt.de Git - mvd_epics.git/commitdiff
DASH: move common style/js into static files
authorPhilipp Klaus <philipp.klaus@gmail.com>
Sat, 23 Sep 2017 03:24:24 +0000 (11:24 +0800)
committerPhilipp Klaus <philipp.klaus@gmail.com>
Sat, 23 Sep 2017 03:24:24 +0000 (11:24 +0800)
python_suite/dashboard/static/css/style.css
python_suite/dashboard/static/js/script.js
python_suite/dashboard/views/pv_overview_bootstrap.jinja2

index b0170fed7364c6c4ecb8ae08f45badce3d810ff2..55bf30116e2cf70ad1797dc2edb463554d98aa8a 100644 (file)
@@ -206,3 +206,24 @@ div.error {
 #heartbeat.warning {
   background-color: #f44;
 }
+
+.pv-block {
+  border-radius: 10px;
+  border: 1.5px solid #ddd;
+  margin-bottom: 20px;
+  padding: 10px;
+}
+.icon {
+  width: 16px;
+  height: 16px;
+  padding: 0;
+  margin: 0;
+  vertical-align: middle;
+  color: #000;
+  fill: currentColor;
+  display: inline-block;
+  vertical-align: text-top;
+}
+.btn-copy {
+  cursor: pointer;
+}
index c63e9c26f4bbc2546cf4ff0546bd83d3f81cbb57..c05890b3a326be0f11a2acc1f2669a025c8df35a 100644 (file)
@@ -20,3 +20,33 @@ function updateSparklines() {
     sparklineChart();  // render the chart
   });
 };
+
+
+function copyToClipboard(text, el) {
+  // COPY TO CLIPBOARD
+  // Attempts to use .execCommand('copy') on a created text field
+  // Falls back to a selectable alert if not supported
+  // Attempts to display status in Bootstrap tooltip
+  // ------------------------------------------------------------------------------
+  var copyTest = document.queryCommandSupported('copy');
+  var elOriginalText = el.attr('data-original-title');
+
+  if (copyTest === true) {
+    var copyTextArea = document.createElement("textarea");
+    copyTextArea.value = text;
+    document.body.appendChild(copyTextArea);
+    copyTextArea.select();
+    try {
+      var successful = document.execCommand('copy');
+      var msg = successful ? 'Copied!' : 'Whoops, not copied!';
+      el.attr('data-original-title', msg).tooltip('show');
+    } catch (err) {
+      console.log('Oops, unable to copy');
+    }
+    document.body.removeChild(copyTextArea);
+    el.attr('data-original-title', elOriginalText);
+  } else {
+    // Fallback if browser doesn't support .execCommand('copy')
+    window.prompt("Copy to clipboard: Ctrl+C or Command+C, Enter", text);
+  }
+}
index 18d5f81e32a56c715fcbe2bd886b6e6847820c8c..96ccfcf2853359f17e299f77062570822394f8db 100644 (file)
@@ -7,28 +7,6 @@
 <link rel="stylesheet" href="/static/css/sparkline.css">
 <script src="https://d3js.org/d3.v4.min.js"></script>
 <script src="/static/js/sparkline.js"></script>
-<style>
-.pv-block {
-  border-radius: 10px;
-  border: 1.5px solid #ddd;
-  margin-bottom: 20px;
-  padding: 10px;
-}
-.icon {
-  width: 16px;
-  height: 16px;
-  padding: 0;
-  margin: 0;
-  vertical-align: middle;
-  color: #000;
-  fill: currentColor;
-  display: inline-block;
-  vertical-align: text-top;
-}
-.btn-copy {
-  cursor: pointer;
-}
-</style>
 {% endblock %}
 
 {% block content %}
 
 
 {% block js_end_of_page %}
-/*
 $(function() {
-  // on page load
-  updateSparklines();
-});
-*/
-updateSparklines();
-
-function copyToClipboard(text, el) {
-  // COPY TO CLIPBOARD
-  // Attempts to use .execCommand('copy') on a created text field
-  // Falls back to a selectable alert if not supported
-  // Attempts to display status in Bootstrap tooltip
-  // ------------------------------------------------------------------------------
-  var copyTest = document.queryCommandSupported('copy');
-  var elOriginalText = el.attr('data-original-title');
+  /* on page load */
 
-  if (copyTest === true) {
-    var copyTextArea = document.createElement("textarea");
-    copyTextArea.value = text;
-    document.body.appendChild(copyTextArea);
-    copyTextArea.select();
-    try {
-      var successful = document.execCommand('copy');
-      var msg = successful ? 'Copied!' : 'Whoops, not copied!';
-      el.attr('data-original-title', msg).tooltip('show');
-    } catch (err) {
-      console.log('Oops, unable to copy');
-    }
-    document.body.removeChild(copyTextArea);
-    el.attr('data-original-title', elOriginalText);
-  } else {
-    // Fallback if browser doesn't support .execCommand('copy')
-    window.prompt("Copy to clipboard: Ctrl+C or Command+C, Enter", text);
-  }
-}
-
-$(document).ready(function() {
-  // Initialize
-  // ---------------------------------------------------------------------
+  // create sparklines
+  updateSparklines();
 
-  // Tooltips
-  // Requires Bootstrap 3 for functionality
+  // Tooltips (requires Bootstrap >3)
   $('.js-tooltip').tooltip();
 
   // Copy to clipboard
-  // Grab any text in the attribute 'data-copy' and pass it to the 
-  // copy function
   $('.js-copy').click(function() {
     var text = $(this).attr('data-copy');
     var el = $(this);