[ARVADOS] created: bf74325bd7f166a7fe1c02aca47a03bc7443ac8b
git at public.curoverse.com
git at public.curoverse.com
Sat Feb 15 18:14:08 EST 2014
at bf74325bd7f166a7fe1c02aca47a03bc7443ac8b (commit)
commit bf74325bd7f166a7fe1c02aca47a03bc7443ac8b
Author: Tom Clegg <tom at curoverse.com>
Date: Sat Feb 15 15:13:38 2014 -0800
Move HeaderRowFixer out to application.js and application.css.scss
refs #2180
diff --git a/apps/workbench/app/assets/javascripts/application.js b/apps/workbench/app/assets/javascripts/application.js
index bb988d7..927e7ae 100644
--- a/apps/workbench/app/assets/javascripts/application.js
+++ b/apps/workbench/app/assets/javascripts/application.js
@@ -48,4 +48,30 @@ jQuery(function($){
on('ajax:complete', function(e, status) {
$('.loading').fadeOut('fast', 0);
});
+
+ HeaderRowFixer = function(selector) {
+ var tables = $(selector);
+ this.duplicateTheadTr = function() {
+ $('>tbody', tables).each(function(){
+ $(this).prepend($('thead>tr', this).clone().css('opacity:0'));
+ });
+ }
+ this.fixThead = function() {
+ tables.each(function() {
+ var widths = [];
+ $('> tbody > tr:eq(1) > td', this).each( function(i,v){
+ widths.push($(v).width());
+ });
+ for(i=0;i<widths.length;i++) {
+ $('thead th:eq('+i+')', this).width(widths[i]);
+ }
+ });
+ }
+ }
+ var fixer = new HeaderRowFixer('.table-fixed-header-row');
+ fixer.fixThead();
+ fixer.duplicateTheadTr();
+ $(window).resize(function(){
+ fixer.fixThead();
+ });
})(jQuery);
diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index 9a6e4c2..5ada51a 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -143,3 +143,18 @@ li.notification {
.arvados-nav-active a {
color: white;
}
+
+// See HeaderRowFixer in application.js
+table.table-fixed-header-row {
+ width: 100%;
+ border-spacing: 0px;
+ margin:0;
+}
+table.table-fixed-header-row thead {
+ position:fixed;
+ background: #fff;
+}
+table.table-fixed-header-row tbody {
+ position:relative;
+ top:1.5em;
+}
diff --git a/apps/workbench/app/views/collections/_show_recent.html.erb b/apps/workbench/app/views/collections/_show_recent.html.erb
index e0afb9c..125f413 100644
--- a/apps/workbench/app/views/collections/_show_recent.html.erb
+++ b/apps/workbench/app/views/collections/_show_recent.html.erb
@@ -40,45 +40,9 @@
</table>
</div>
-<% content_for :css do %>
-table.table-fixed-header-row {width: 100%;border-spacing: 0px;margin:0;}
-table.table-fixed-header-row thead {position:fixed; background: #fff;}
-table.table-fixed-header-row tbody {position:relative; top:1.5em;}
-<% end %>
<% content_for :footer_js do %>
$(document).on('click', 'form[data-remote] input[type=submit]', function() {
$('table#collections-index tbody').fadeTo(200, 0.3);
return true;
});
-HeaderRowFixer = function(selector) {
- settings = {
- tables: $(selector),
- thead: []
- };
-
- this.duplicateTheadTr = function() {
- $('>tbody', settings.tables).each(function(){
- $(this).prepend($('thead>tr', this).clone().css('opacity:0'));
- });
- }
- this.fixThead = function() {
- settings.tables.each(function() {
- var widths = [];
- $('> tbody > tr:eq(1) > td', this).each( function(i,v){
- widths.push($(v).width());
- });
- for(i=0;i<widths.length;i++) {
- $('thead th:eq('+i+')', this).width(widths[i]);
- }
- });
- }
-}
-$(function(){
- var fixer = new HeaderRowFixer('.table-fixed-header-row');
- fixer.fixThead();
- fixer.duplicateTheadTr();
- $(window).resize(function(){
- fixer.fixThead();
- });
-});
<% end %>
commit 16d4aaa4520d2179e6f3f6af9173470463e13714
Author: Tom Clegg <tom at curoverse.com>
Date: Sat Feb 15 15:08:12 2014 -0800
Prevent table headings from scrolling out of view on collections index
table.
closes #2180
diff --git a/apps/workbench/app/views/collections/_show_recent.html.erb b/apps/workbench/app/views/collections/_show_recent.html.erb
index 71b762a..e0afb9c 100644
--- a/apps/workbench/app/views/collections/_show_recent.html.erb
+++ b/apps/workbench/app/views/collections/_show_recent.html.erb
@@ -15,7 +15,7 @@
<div style="padding-right: 1em">
-<table id="collections-index" class="topalign table table-condensed table-fixedlayout">
+<table id="collections-index" class="topalign table table-condensed table-fixedlayout table-fixed-header-row">
<colgroup>
<col width="10%" />
<col width="36%" />
@@ -40,9 +40,45 @@
</table>
</div>
-<% content_for :js do %>
+<% content_for :css do %>
+table.table-fixed-header-row {width: 100%;border-spacing: 0px;margin:0;}
+table.table-fixed-header-row thead {position:fixed; background: #fff;}
+table.table-fixed-header-row tbody {position:relative; top:1.5em;}
+<% end %>
+<% content_for :footer_js do %>
$(document).on('click', 'form[data-remote] input[type=submit]', function() {
$('table#collections-index tbody').fadeTo(200, 0.3);
return true;
});
+HeaderRowFixer = function(selector) {
+ settings = {
+ tables: $(selector),
+ thead: []
+ };
+
+ this.duplicateTheadTr = function() {
+ $('>tbody', settings.tables).each(function(){
+ $(this).prepend($('thead>tr', this).clone().css('opacity:0'));
+ });
+ }
+ this.fixThead = function() {
+ settings.tables.each(function() {
+ var widths = [];
+ $('> tbody > tr:eq(1) > td', this).each( function(i,v){
+ widths.push($(v).width());
+ });
+ for(i=0;i<widths.length;i++) {
+ $('thead th:eq('+i+')', this).width(widths[i]);
+ }
+ });
+ }
+}
+$(function(){
+ var fixer = new HeaderRowFixer('.table-fixed-header-row');
+ fixer.fixThead();
+ fixer.duplicateTheadTr();
+ $(window).resize(function(){
+ fixer.fixThead();
+ });
+});
<% end %>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list