[ARVADOS] updated: e9e3b56acfa9024f46b76c51858f8d6fb30f61df

git at public.curoverse.com git at public.curoverse.com
Fri Feb 7 10:23:07 EST 2014


Summary of changes:
 .../workbench/app/assets/javascripts/provenance.js |   64 --------------------
 apps/workbench/app/assets/javascripts/sizing.js    |   30 +++++++++
 .../app/assets/stylesheets/application.css.scss    |    7 +-
 .../app/assets/stylesheets/badges.css.scss         |   18 ++++--
 .../app/views/application/_content.html.erb        |    5 ++
 .../app/views/application/_svg_div.html.erb        |    8 +--
 .../collections/_show_provenance_graph.html.erb    |    6 --
 .../app/views/collections/_show_used_by.html.erb   |    6 --
 8 files changed, 54 insertions(+), 90 deletions(-)
 delete mode 100644 apps/workbench/app/assets/javascripts/provenance.js
 create mode 100644 apps/workbench/app/assets/javascripts/sizing.js

       via  e9e3b56acfa9024f46b76c51858f8d6fb30f61df (commit)
      from  991ff5eadf234141ddaa274c17c0262944e5d6ae (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e9e3b56acfa9024f46b76c51858f8d6fb30f61df
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Feb 7 10:24:04 2014 -0500

    Fixed/refactored "smart-sizing" to adjust the content area to the size of the window so that the content area scrolls but the page as a whole shouldn't scroll.

diff --git a/apps/workbench/app/assets/javascripts/provenance.js b/apps/workbench/app/assets/javascripts/provenance.js
deleted file mode 100644
index 53e2d19..0000000
--- a/apps/workbench/app/assets/javascripts/provenance.js
+++ /dev/null
@@ -1,64 +0,0 @@
-function provenance_sizing_fixup(divId, svgId) {
-    var a = document.getElementById(divId);
-    var b = document.getElementById("_" + divId + "_padding");
-    var c = document.getElementById("_" + divId + "_center");
-    var g = document.getElementById(svgId);
-    
-    var h = window.innerHeight - a.getBoundingClientRect().top - 2;
-    var max = window.innerHeight - 100;
-    var gh = parseFloat(g.getAttribute("height"));
-    //var sh = (a.scrollTopMax > 0) ? a.scrollHeight : 0;
-    //gh = (gh > sh) ? gh : sh;
-    gh += 25;
-    if (h < 0) { h = max; }
-    var height;
-    if (gh < h) {
-        if (gh > max) { gh = max; }
-        height = String(gh) + "px";
-    }
-    else {
-        if (h > max) { h = max; }
-        height = String(h) + "px";
-    }
-    a.style.height = height;
-
-    if (gh < max) {
-        b.style.paddingTop = String(gh) + "px";
-    }
-    else {
-        b.style.paddingTop = String(max) + "px";
-    }
-
-    /*
-    w = window.innerWidth - 25;
-    a.style.width = String(w) + "px";
-    gw = parseFloat(g.getAttribute("width"));
-    if (gw < w) {
-        c.style.paddingLeft = String((w - gw)/2.0) + "px";
-    }
-    else {
-        c.style.paddingLeft = "0px";
-    }*/
-}
-
-function graph_zoom(divId, svgId, scale) {
-    var pg = document.getElementById(divId);
-    vcenter = (pg.scrollTop + (pg.scrollHeight - pg.scrollTopMax)/2.0) / pg.scrollHeight;
-    hcenter = (pg.scrollLeft + (pg.scrollWidth - pg.scrollLeftMax)/2.0) / pg.scrollWidth;
-    var g = document.getElementById(svgId);
-    g.setAttribute("height", parseFloat(g.getAttribute("height")) * scale);
-    g.setAttribute("width", parseFloat(g.getAttribute("width")) * scale);
-    pg.scrollTop = (vcenter * pg.scrollHeight) - (pg.scrollHeight - pg.scrollTopMax)/2.0;
-    pg.scrollLeft = (hcenter * pg.scrollWidth) - (pg.scrollWidth - pg.scrollLeftMax)/2.0;
-    provenance_sizing_fixup(divId, svgId);
-}
-
-$(window).on('load resize', function () {
-    var s = document.getElementsByClassName("smart-scroll");
-    for (var i = 0; i < s.length; i++) {
-        a = s[i];
-        var h = window.innerHeight - a.getBoundingClientRect().top - 20;
-        height = String(h) + "px";
-        a.style.height = height;
-    }
-});
diff --git a/apps/workbench/app/assets/javascripts/sizing.js b/apps/workbench/app/assets/javascripts/sizing.js
new file mode 100644
index 0000000..388f727
--- /dev/null
+++ b/apps/workbench/app/assets/javascripts/sizing.js
@@ -0,0 +1,30 @@
+function graph_zoom(divId, svgId, scale) {
+    var pg = document.getElementById(divId);
+    vcenter = (pg.scrollTop + (pg.scrollHeight - pg.scrollTopMax)/2.0) / pg.scrollHeight;
+    hcenter = (pg.scrollLeft + (pg.scrollWidth - pg.scrollLeftMax)/2.0) / pg.scrollWidth;
+    var g = document.getElementById(svgId);
+    g.setAttribute("height", parseFloat(g.getAttribute("height")) * scale);
+    g.setAttribute("width", parseFloat(g.getAttribute("width")) * scale);
+    pg.scrollTop = (vcenter * pg.scrollHeight) - (pg.scrollHeight - pg.scrollTopMax)/2.0;
+    pg.scrollLeft = (hcenter * pg.scrollWidth) - (pg.scrollWidth - pg.scrollLeftMax)/2.0;
+    smart_scroll_fixup();
+}
+
+function smart_scroll_fixup(s) {
+    console.log(s);
+    if (s != null && s.type == 'shown.bs.tab') {
+        s = [s.target];
+    }
+    else {
+        s = $(".smart-scroll");
+    }
+    console.log(s);
+    for (var i = 0; i < s.length; i++) {
+        a = s[i];
+        var h = window.innerHeight - a.getBoundingClientRect().top - 20;
+        height = String(h) + "px";
+        a.style.height = height;
+    }
+}
+
+$(window).on('load resize scroll', smart_scroll_fixup);
diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index feba5c6..f236af5 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -107,21 +107,20 @@ ul.arvados-nav li ul li {
     padding-left: 1em;
 }
 
-.badge.badge-alert {
-    background: red;
-}
-
 .dax {
     max-width: 10%;
     margin-right: 1em;
     float: left
 }
+
 .smart-scroll {
     overflow: auto;
 }
+
 .inline-progress-container div.progress {
     margin-bottom: 0;
 }
+
 .inline-progress-container {
     width: 100px;
     display:inline-block;
diff --git a/apps/workbench/app/assets/stylesheets/badges.css.scss b/apps/workbench/app/assets/stylesheets/badges.css.scss
index b3d3da3..82c4ab0 100644
--- a/apps/workbench/app/assets/stylesheets/badges.css.scss
+++ b/apps/workbench/app/assets/stylesheets/badges.css.scss
@@ -3,18 +3,26 @@
  * Bootstrap 3.0 removed contexts for badges, we re-introduce them, based on what is done for labels
  */
 
-.badge-error {
+.badge.badge-error {
   background-color: #b94a48;
 }
-.badge-warning {
+
+.badge.badge-warning {
   background-color: #f89406;
 }
-.badge-success {
+
+.badge.badge-success {
   background-color: #468847;
 }
-.badge-info {
+
+.badge.badge-info {
   background-color: #3a87ad;
 }
-.badge-inverse {
+
+.badge.badge-inverse {
   background-color: #333333;
 }
+
+.badge.badge-alert {
+    background: red;
+}
diff --git a/apps/workbench/app/views/application/_content.html.erb b/apps/workbench/app/views/application/_content.html.erb
index 3235e7c..02efdf9 100644
--- a/apps/workbench/app/views/application/_content.html.erb
+++ b/apps/workbench/app/views/application/_content.html.erb
@@ -24,3 +24,8 @@
 
 <% end %>
 
+<% content_for :js do %>
+  $(window).on('load', function() {
+    $('ul.nav-tabs > li > a').on('shown.bs.tab', smart_scroll_fixup);
+   });
+<% end %>
diff --git a/apps/workbench/app/views/application/_svg_div.html.erb b/apps/workbench/app/views/application/_svg_div.html.erb
index 6b3f959..ddbbf20 100644
--- a/apps/workbench/app/views/application/_svg_div.html.erb
+++ b/apps/workbench/app/views/application/_svg_div.html.erb
@@ -20,9 +20,7 @@ stroke-linecap: round;
 
 <%= content_for :js do %>
     $(window).on('load', function() {
-      var fn = function () { graph_zoom("<%= divId %>", "<%=svgId %>", 1) };
-      $(window).on('resize', fn);
-      $(window).on('scroll', fn);
+      $(window).on('load resize scroll', function () { graph_zoom("<%= divId %>","<%=svgId %>", 1) } );
     });
 <% end %>
 
@@ -32,8 +30,8 @@ stroke-linecap: round;
     <a style="cursor: pointer"><span class="glyphicon glyphicon-zoom-in" onclick="graph_zoom('<%= divId %>', '<%= svgId %>', 1./.9)"></span></a>
   </div>
 
-  <div id="<%= divId %>">
-    <span id="_<%= divId %>_center" style="padding-left: 300px"></span>
+  <div id="<%= divId %>" class="smart-scroll">
+    <span id="_<%= divId %>_center" style="padding-left: 0px"></span>
     <%= raw(svg) %>
   </div>
   <div id="_<%= divId %>_padding" style="padding-bottom: 1em"></div>
diff --git a/apps/workbench/app/views/collections/_show_provenance_graph.html.erb b/apps/workbench/app/views/collections/_show_provenance_graph.html.erb
index d127f4f..977265a 100644
--- a/apps/workbench/app/views/collections/_show_provenance_graph.html.erb
+++ b/apps/workbench/app/views/collections/_show_provenance_graph.html.erb
@@ -1,9 +1,3 @@
-<% content_for :js do %>
-  $(window).on('load',
-    $(function() {
-      $('#provenance_graph-tab').on('shown', function() { graph_zoom("provenance_graph_div", "provenance_svg", 1); });
-    }))
-<% end %>
 <%= render partial: 'application/svg_div', locals: {
     divId: "provenance_graph_div", 
     svgId: "provenance_svg", 
diff --git a/apps/workbench/app/views/collections/_show_used_by.html.erb b/apps/workbench/app/views/collections/_show_used_by.html.erb
index 837f30f..a26b100 100644
--- a/apps/workbench/app/views/collections/_show_used_by.html.erb
+++ b/apps/workbench/app/views/collections/_show_used_by.html.erb
@@ -1,9 +1,3 @@
- <% content_for :js do %>
-  $(window).on('load',
-    $(function() {
-      $('#used_by-tab').on('shown', function() { graph_zoom("used_by_graph", "used_by_svg", 1); });
-    }))
-<% end %>
 <%= render partial: 'application/svg_div', locals: {
     divId: "used_by_graph", 
     svgId: "used_by_svg", 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list