Permalink
Browse files

stop loading additional rows from disk to prevent CORS problems

  • Loading branch information...
1 parent 16dcb2a commit c4a36264f3c34a5aa0a65bbb5e7766d6b770e0f2 @seancaffery committed Sep 5, 2012
Showing with 64 additions and 54 deletions.
  1. +1 −1 lib/stepdown/html_reporter.rb
  2. +34 −9 public/step_down.js
  3. +29 −44 templates/index.html.erb
@@ -10,7 +10,7 @@ def output_overview()
FileUtils.mkdir_p(Stepdown.output_directory)
copy_files()
- ["index", "_empty", "_unused", "_grouping", "_usages"].each { |template| write_html_from_erb(template) }
+ write_html_from_erb('index')
puts "\nReport output to #{Stepdown.output_directory}/index.html" unless Stepdown.quiet
end
View
@@ -1,4 +1,7 @@
-
+var usages = 11;
+var unused = 11;
+var empty = 11;
+var grouping = 11;
$(document).ready(function(){
$("#use_filter").change(function(){
@@ -10,20 +13,42 @@ $(document).ready(function(){
});
$("a[class*=g]").click(function() {
- $('.' + this.getAttribute("class")).show();
+ $('div.' + this.getAttribute("class")).toggle();
+ $('.' + this.getAttribute("class") + ' tr').show();
+ return false;
+ });
+
+ $('#usages tr').hide();
+ $('#unused tr').hide();
+ $('#empty tr').hide();
+ $('#grouping tr').hide();
+
+ $("#usages").next(".more").click(function(e){
+ $('#usages tr:lt('+ usages +')').show();
+ usages += 10;
+ return false;
+ });
+
+ $("#unused").next(".more").click(function(e){
+ $('#unused tr:lt('+ unused +')').show();
+ unused += 10;
+ return false;
+ });
+
+ $("#empty").next(".more").click(function(e){
+ $('#empty tr:lt('+ empty +')').show();
+ empty += 10;
return false;
});
- $(".more").click(function(e){
- link = $(this);
- partial = link.attr("partial");
- $.get('_' + partial + '.html',function(data){
- link.parents("tr").before(data);
- link.parents("tr").remove();
- }, 'html');
+ $("#grouping").next(".more").click(function(e){
+ $('#grouping tr.grouping_row:lt('+ grouping +')').show();
+ grouping += 10;
return false;
});
+ $(".more").click();
+
});
@@ -123,21 +123,17 @@
<th> Use per scenario</th>
</tr>
- <% usages_top(10).each do |use| %>
+ <% usages.each do |use| %>
<tr>
<td><%= use.step.regex.inspect %></td>
<td><%= use.total_usage %></td>
<td><%= use.number_scenarios %></td>
<td><%= use.use_scenario %></td>
</tr>
<% end %>
- <tr>
- <td colspan='4'>
- <a href="#" class="more" partial='usages'>See all</a>
- </td>
- </tr>
</tbody>
</table>
+ <p class="more"><a href="#">Show more</a></p>
<h2>
<a name='unused'> Unused steps</a>
@@ -146,37 +142,31 @@
<tbody>
<th> Step</th>
- <% unused_top(10).each do |use| %>
+ <% unused.each do |use| %>
<tr>
<td><%= use.step.regex.inspect %></td>
</tr>
<% end %>
- <tr>
- <td colspan='4'>
- <a href="#" class="more" partial='unused'>See all</a>
- </td>
- </tr>
</tbody>
</table>
+ <p class="more"><a href="#">Show more</a></p>
+
<h2>
<a name='empty'> Empty scenarios</a>
</h2>
<table id='empty' class='table table-condensed table-bordered'>
<tbody>
<th> Scenarios</th>
- <% empty_top(10).each do |scen| %>
+ <% empty.each do |scen| %>
<tr>
<td><%= scen.name %></td>
</tr>
<% end %>
- <tr>
- <td colspan='4'>
- <a href="#" class="more" partial='empty'>See all</a>
- </td>
- </tr>
</tbody>
</table>
+ <p class="more"><a href="#">Show more</a></p>
+
<h2>
<a name='grouping'> Step grouping</a>
</h2>
@@ -185,42 +175,37 @@
<th> Step</th>
<th> Total step associations</th>
- <% groupings_top(10).each_with_index do |grouping, i|
+ <% groupings.each_with_index do |grouping, i|
next if grouping.use_count == 0 %>
- <tr>
+ <tr class='grouping_row'>
<td>
<%= grouping.regex.inspect %>
<br />
- <a href='#' class="g<%=i %>">Show associated steps</a>
+ <a href='#' class="g<%=i %>">Associated steps</a>
+ <br />
+ <div class="assoc_steps g<%=i %>" style='display:none;'>
+ <table class='table table-condensed table-bordered'>
+ <tbody>
+ <tr>
+ <th> Association count</th>
+ <th> Step</th>
+ </tr>
+ <% grouping.step_collection.each do |step| %>
+ <tr>
+ <td><%= step.count %></td>
+ <td><%= CGI.escapeHTML(step.regex.inspect) %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
</td>
<td><%= grouping.use_count %></td>
</tr>
- <tr class="g<%= i %>" style="display: none;">
- <td colspan='2'>
- <table class='table table-condensed table-bordered'>
- <tr>
- <th> Association count</th>
- <th> Step</th>
- </tr>
- <tbody>
- <% grouping.step_collection.each do |step| %>
- <tr>
- <td><%= step.count %></td>
- <td><%= CGI.escapeHTML(step.regex.inspect) %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
- </td>
- </tr>
<% end %>
- <tr>
- <td colspan="4">
- <a href="#" class="more" partial='grouping'>See all</a>
- </td>
- </tr>
</tbody>
</table>
+ <p class="more"><a href="#">Show more</a></p>
<script src='stepdown.js'></script>
</body>
</html>

0 comments on commit c4a3626

Please sign in to comment.