Paired-With: Randall Hansen

Signed-off-by: Pieter van de Bruggen <[email protected]>
---
Local-branch: tickets/next/6989
 app/views/layouts/application.html.haml |    2 +-
 app/views/reports/_report.html.haml     |   13 ++++++++++++-
 lib/registry.rb                         |    2 ++
 public/javascripts/jquery-tabify.min.js |    1 +
 4 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 public/javascripts/jquery-tabify.min.js

diff --git a/app/views/layouts/application.html.haml 
b/app/views/layouts/application.html.haml
index 4ae18e4..3749cea 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -12,7 +12,7 @@
       $.noConflict();
 
     = stylesheet_link_tag 'reset', 'layout', 'forms', 'tables', 
'jquery.ui.custom', 'jquery.ui.combobox', 'typography', 'links', 
'token-input-facebook', 'tipsy', 'application', 'colorbox', :cache => 'all'
-    = javascript_include_tag 'prototype', 'jquery-ui.min', 
'jquery.tokeninput', 'excanvas.min', 'raphael-min', 'grafico.min', 
'jquery.form', 'jquery.placeholders', 'jquery.ui.combobox', 
'jquery.colorbox.js', 'jquery.tipsy', 'search', 'application', :cache => 'all'
+    = javascript_include_tag 'prototype', 'jquery-ui.min', 
'jquery.tokeninput', 'excanvas.min', 'raphael-min', 'grafico.min', 
'jquery.form', 'jquery.placeholders', 'jquery.ui.combobox', 
'jquery.colorbox.js', 'jquery.tipsy', 'jquery-tabify.min', 'search', 
'application', :cache => 'all'
 
   - body_classes = [ "#{controller.controller_name}_controller", 
"#{controller.controller_name}_#{controller.action_name}_action" ]
   - body_classes << "#{controller.controller_name}_form_action" if %w[new 
create edit update].include?(controller.action_name)
diff --git a/app/views/reports/_report.html.haml 
b/app/views/reports/_report.html.haml
index 7e2cb7c..6a50e9f 100644
--- a/app/views/reports/_report.html.haml
+++ b/app/views/reports/_report.html.haml
@@ -8,5 +8,16 @@
       %li= link_to 'Destroy', report, :confirm => 'Are you sure?', :method => 
:delete, :class => "delete button"
 
 .item
+  %ul#report-tabs
+    - Registry.each_callback :core, :report_view_widgets do |widget|
+      %li
+        %a{ :href => "##{widget.name}" }
+          = widget.name
   - Registry.each_callback :core, :report_view_widgets do |widget|
-    = widget.call self, report
+    %div(id="#{widget.name}")
+      = widget.call self, report
+  :javascript
+    jQuery(function() {
+      jQuery('#report-tabs li:first').addClass("active");
+      jQuery('#report-tabs').tabify();
+    });
diff --git a/lib/registry.rb b/lib/registry.rb
index 09f6d0b..bf94f37 100644
--- a/lib/registry.rb
+++ b/lib/registry.rb
@@ -15,6 +15,8 @@ class Registry
         raise "Cannot redefine callback 
[#{feature_name.inspect},#{hook_name.inspect},#{callback_name}]"
       end
 
+      (class << block; self; end).send(:define_method, :name) { callback_name }
+
       @registry[feature_name][hook_name][callback_name] = value || block
     end
   end
diff --git a/public/javascripts/jquery-tabify.min.js 
b/public/javascripts/jquery-tabify.min.js
new file mode 100644
index 0000000..7be2f09
--- /dev/null
+++ b/public/javascripts/jquery-tabify.min.js
@@ -0,0 +1 @@
+(function(a){a.fn.extend({tabify:function(e){function 
c(b){hash=a(b).find("a").attr("href");return 
hash=hash.substring(0,hash.length-4)}function 
f(b){a(b).addClass("active");a(c(b)).show();a(b).siblings("li").each(function(){a(this).removeClass("active");a(c(this)).hide()})}return
 this.each(function(){function 
b(){location.hash&&a(d).find("a[href="+location.hash+"]").length>0&&f(a(d).find("a[href="+location.hash+"]").parent())}var
 d=this,g={ul:a(d)};a(this).find("li a").each(function(){a(this).attr("href", 
a(this).attr("href")+"-tab")});location.hash&&b();setInterval(b,100);a(this).find("li").each(function(){a(this).hasClass("active")?a(c(this)).show():a(c(this)).hide()});e&&e(g)})}})})(jQuery);
\ No newline at end of file
-- 
1.7.4.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to