From: Dobrica Pavlinusic Date: Tue, 29 Jun 2010 14:06:00 +0000 (+0200) Subject: use eval_console for items and facets X-Git-Url: http://git.rot13.org/?p=MojoFacets.git;a=commitdiff_plain;h=8bc6f7efc346f5d57bf9076331886adda4b398a4 use eval_console for items and facets This allows us to reuse JavaScript code for console on both screens --- diff --git a/public/js/eval_console.js b/public/js/eval_console.js new file mode 100644 index 0000000..bcddf2c --- /dev/null +++ b/public/js/eval_console.js @@ -0,0 +1,43 @@ +$(document).ready( function(){ + + $('form#eval textarea').each( function() { + console.debug('grow',this); + + var rows = this.rows; + console.debug( 'textarea_grow', rows, this ); + var grow = function(ta) { + var lines = ta.value.split('\n').length; + if ( lines != rows ) { + ta.rows = lines; + rows = lines; + console.debug('keyup', lines, rows, ta ); + } + }; + grow(this); + this.onkeyup = function() { grow(this) }; + }); + + $('input#close').click( function(){ + console.debug( 'close console' ); + $.post( document.location, { code: '' } ); + $(this).parent().hide(); + }); + + var $out = $('pre#out'); + if ( $out.height() > ( $(window).height() / 3 * 2 ) ) { + $out.height( $(window).height() / 3 * 2 ).css({ overflow: 'auto' }); + } + + $('a#console').click( function() { + console.debug('open console'); + var $f = $('form#eval'); + if ( $f.is(':visible') ) { + $f.hide(); + } else { + $f.show(); + } + return false; + }).show(); + +}); + diff --git a/templates/data/facet.html.ep b/templates/data/facet.html.ep index 20b91da..9038396 100644 --- a/templates/data/facet.html.ep +++ b/templates/data/facet.html.ep @@ -55,7 +55,7 @@ First <%= $max_facets %> shown -
+
Eval code on each facet $value and $count @@ -71,7 +71,8 @@ $checked = 1 if $count > 10; - + + % if ( $#$facet_names < 5000 ) { @@ -80,10 +81,13 @@ $checked = 1 if $count > 10; @@ -91,3 +95,5 @@ $(document).ready( function(){
<%#= dumper $facet %>
% } + + diff --git a/templates/data/items/table.html.ep b/templates/data/items/table.html.ep index c1fcad6..0b77366 100644 --- a/templates/data/items/table.html.ep +++ b/templates/data/items/table.html.ep @@ -95,37 +95,6 @@ filter - - - +