<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,10 +1,10 @@
-The navigation generator creates a sample navigation partial.
-      
-invoke with:  ./script/generate navigation &lt;name&gt;
-         es:  ./script/generate navigation main
-
-Usage:
-    Customize your generated partial (es: views/widgets/_main_navigation.rhtml)
-    then insert in your .rhtml pages one of this snippet:
-
-    &lt;%= navigation :main %&gt;
+The navigation generator creates a sample navigation partial.
+      
+invoke with:  ./script/generate navigation &lt;name&gt;
+         es:  ./script/generate navigation main
+
+Usage:
+    Customize your generated partial (es: views/widgets/_main_navigation.rhtml)
+    then insert in your .rhtml pages one of this snippet:
+
+    &lt;%= navigation :main %&gt;</diff>
      <filename>generators/navigation/USAGE</filename>
    </modified>
    <modified>
      <diff>@@ -1,28 +1,28 @@
-class NavigationGenerator &lt; Rails::Generator::Base
-  attr_accessor :name
-
-  def initialize(*runtime_args)
-    super(*runtime_args)
-    if args[0].nil? 
-      puts banner
-    else
-      @name = args[0].underscore
-    end
-  end
-  
-  def manifest
-    record do |m|
-      if @name 
-        m.directory File.join('app/views/widgets')
-        m.template 'navigation.rhtml', File.join('app/views/widgets', &quot;_#{@name}_navigation.rhtml&quot;)
-      end
-    end
-  end
-  
-  protected 
-  
-  def banner
-    IO.read File.expand_path(File.join(File.dirname(__FILE__), 'USAGE')) 
-  end
-  
-end
\ No newline at end of file
+class NavigationGenerator &lt; Rails::Generator::Base
+  attr_accessor :name
+
+  def initialize(*runtime_args)
+    super(*runtime_args)
+    if args[0].nil? 
+      puts banner
+    else
+      @name = args[0].underscore
+    end
+  end
+  
+  def manifest
+    record do |m|
+      if @name 
+        m.directory File.join('app/views/widgets')
+        m.template 'navigation.rhtml', File.join('app/views/widgets', &quot;_#{@name}_navigation.rhtml&quot;)
+      end
+    end
+  end
+  
+  protected 
+  
+  def banner
+    IO.read File.expand_path(File.join(File.dirname(__FILE__), 'USAGE')) 
+  end
+  
+end</diff>
      <filename>generators/navigation/navigation_generator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,26 +1,36 @@
-&lt;%%  
-# this partial renders a navigation bar, you can call it in your views with:
-#   &lt;%% navigation :&lt;%=name%&gt; % &gt; 
-#
-# you can pass render_navigation a few options:
-#   :generate_css =&gt; true|false #=&gt; generates a default inline css for the tabnav, defaults to false
-#   :html =&gt; aHash #=&gt; sets html options for the tabnav's div (es :html =&gt; {:class=&gt; 'myCssClass', :id=&gt;'myCssId'}) 
-#  
-render_navigation :&lt;%=name%&gt;, :generate_css =&gt; true do 
-    add_item :name =&gt; 'home', 
-             :link =&gt; {:controller =&gt; 'main'}
-    add_item :name =&gt; 'www.seesaw.it', 
-             :link =&gt; 'http://www.seesaw.it'
-    add_item :name =&gt; 'blog.seesaw.it', 
-             :link =&gt; 'http://blog.seesaw.it' 
-
-    # you can pass add_item a block to just like the tabnav!
-    #  
-    # add_item do |i|
-    #   i.html = {:id =&gt; 'logout_link'}
-    #   i.named 'logout', 
-    #   i.links_to :action =&gt; 'logout'
-    # end
-    #
-end 
-%&gt;
\ No newline at end of file
+&lt;%%  
+# this partial renders a navigation bar, you can call it in your views with:
+#   &lt;%% navigation :&lt;%=name%&gt; % &gt; 
+#
+# you can pass render_navigation a few options:
+#   :generate_css =&gt; true|false #=&gt; generates a default inline css for the tabnav, defaults to false
+#   :html =&gt; aHash #=&gt; sets html options for the tabnav's div (es :html =&gt; {:class=&gt; 'myCssClass', :id=&gt;'myCssId'}) 
+#  
+render_navigation :&lt;%=name%&gt;, :generate_css =&gt; true do 
+    add_item do |i|
+      i.named 'welcome to the rails-widgets'
+      i.disable!
+    end
+    
+    add_item do |i|
+      # i.html = {:id =&gt; 'logout_link'}
+      i.named 'github' 
+      i.links_to &quot;http://github.com/paolodona/rails-widgets&quot;
+    end
+
+    add_item do |i|
+      i.named 'wiki' 
+      i.titled 'contribute to the wiki!'
+      i.links_to &quot;http://github.com/paolodona/rails-widgets/wiki&quot;
+    end
+    
+    # you can pass add_item a block to just like the tabnav!
+    #  
+    # add_item do |i|
+    #   i.html = {:id =&gt; 'logout_link'}
+    #   i.named 'logout', 
+    #   i.links_to :action =&gt; 'logout'
+    # end
+    #
+end 
+%&gt;</diff>
      <filename>generators/navigation/templates/navigation.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -2,21 +2,15 @@ module Widgets
   # Utility module for widgets that need to create a default CSS
   # you have to include it inside a Widget to add css_generation capability
   module CssTemplate
-    # render and cache the default css 
-    def default_css
-      @default_css if @default_css
-      # if not cache read and evaluate the template
-      css_template = ERB.new IO.read(File.join(File.dirname(__FILE__), css_template_filename))
-      @default_css = css_template.result(binding)
-    end
     
-    # return the name of the erb to parse for the default css generation
-    # (removes namespaces if present)
-    # es: in Tabnav #=&gt; 'tabnav.css.erb'
-    #        Foo::Bar #=&gt; 'bar.css.erb'
-    def css_template_filename
-      self.class.name.downcase.gsub(/.*::/,'') &lt;&lt; '.css.erb' 
-    end
+    def render_css(name)
+      @_widgets_css_templates ||= {}
+      return @_widgets_css_templates[name] if @_widgets_css_templates[name] # return the cached copy if possible
+      # if not cached read and evaluate the template
+      css_template_filename = &quot;#{name}.css.erb&quot; 
+      css_template = ERB.new IO.read(File.join(File.dirname(__FILE__), css_template_filename))
+      @_widgets_css_templates[name] = css_template.result(binding)
+    end 
     
     # should the helper generate a css for this widget?
     def generate_css?</diff>
      <filename>lib/widgets/css_template.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 &lt;style&gt;
 .&lt;%=html[:class]%&gt; {
-  margin: 3px 5px 0px auto;
+  margin: 0px 5px 0px auto;
   float:right;
 }
 
@@ -36,4 +36,4 @@
 .&lt;%=html[:class]%&gt; a.active {
   font-weight: bold;
 }
-&lt;/style&gt;
\ No newline at end of file
+&lt;/style&gt;</diff>
      <filename>lib/widgets/navigation.css.erb</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@ module Widgets
       @_navigation = Navigation.new(name, opts)
       @_binding = proc.binding # the binding of calling page
       instance_eval(&amp;proc)
-      out @_navigation.default_css if @_navigation.generate_css?
+      out @_navigation.render_css('navigation') if @_navigation.generate_css?
       out tag('div',@_navigation.html ,true)
       render_navigation_items
       out '&lt;/div&gt;'</diff>
      <filename>lib/widgets/navigation_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,7 +22,7 @@ module Widgets
       end 
 
       html = &quot;&quot;
-      html &lt;&lt; default_css if options[:generate_css] == true
+      html &lt;&lt; render_css('progressbar') if options[:generate_css] == true
       html &lt;&lt; '&lt;div class=&quot;progressbar&quot;&gt;'          
       values.dup.each_with_index do |value, index|
         if total == 0
@@ -35,9 +35,5 @@ module Widgets
       end 
       html &lt;&lt; &quot;&lt;/div&gt;&quot; 
     end
-    
-    def css_template_filename
-      'progressbar.css.erb' 
-    end
   end
 end</diff>
      <filename>lib/widgets/progressbar_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,95 +1,90 @@
-module Widgets
-  module ShowhideHelper
-    include CssTemplate
-
-    def show_box_for record, opts={}
-      name = opts[:name] || 'details'
-      link_name = opts[:link_name] || 'show details'
-      detail_box_id = opts[:detail_box_id] || dom_detail_id(record,name)
-
-      html = opts[:html] || {} # setup default html options
-      html[:id] ||= dom_show_id(record,name)
-      html[:class] ||= &quot;#{name}_show_link&quot;
-
-      link_to_function link_name, nil, html do |page|
-        page[detail_box_id].show
-        page[html[:id]].hide
-      end
-    end
-
-    def hide_box_for record, opts={}
-      name = opts[:name] || 'details'
-      link_name = opts[:link_name] || 'hide details'
-      detail_box_id = opts[:detail_box_id] || dom_detail_id(record,name)
-      show_link_id = opts[:show_link_id] || dom_show_id(record,name)
-
-      html = opts[:html] || {} # setup default html options
-      html[:id] ||= dom_hide_id(record,name)
-      html[:class] ||= &quot;#{name}_hide_link&quot;
-
-      link_to_function link_name, nil, html do |page|
-        page[detail_box_id].hide
-        page[show_link_id].show
-      end
-    end
-
-    def detail_box_for record, opts={}, &amp;block
-      raise ArgumentError, 'Missing block in showhide.detail_box_for call' unless block_given?
-      name = opts[:name] || 'details'
-      @generate_css = opts[:generate_css] || false
-
-      html = opts[:html] || {} # setup default html options
-      html[:id] ||= dom_detail_id(record,name)
-      html[:class] ||= &quot;#{name}_for_#{normalize_class_name(record)}&quot;
-      html[:style] = 'display:none;'
-      @css_class = html[:class]
-      concat(default_css, block.binding) if generate_css?
-      # Taken from ActionView::Helpers::RecordTagHelper
-      concat content_tag(:div, capture(&amp;block), html), block.binding
-      nil
-    end
-
-    private
-
-    # return the name of the erb to parse for the default css generation
-    def css_template_filename
-      'showhide.css.erb'
-    end
-
-    def dom_detail_id record, name
-      normalize_dom_id(record, name.to_s)
-    end
-
-    def dom_show_id record, name
-      normalize_dom_id(record, &quot;show_#{name}&quot;)
-    end
-
-    def dom_hide_id record, name
-      normalize_dom_id(record, &quot;hide_#{name}&quot;)
-    end
-
-    def normalize_dom_id object, prefix
-      if object.kind_of?(ActiveRecord::Base)
-        dom_id(object, &quot;#{prefix}_for#{object.id ? '' : '_new'}&quot;)
-      else
-        [ prefix, 'for', normalize_class_name(object) ].compact * '_'
-      end
-    end
-
-    def normalize_class_name object
-      if object.kind_of?(ActiveRecord::Base)
-        ActionController::RecordIdentifier.singular_class_name(object)
-      else
-        object.to_s
-      end
-    end
-
-    # content_tag_for creates an HTML element with id and class parameters
-    # that relate to the specified Active Record object.
-    #
-    # Taken from ActionView::Helpers::RecordTagHelper
-    def content_box_for(tag_name, *args, &amp;block)
-      concat content_tag(tag_name, capture(&amp;block), args), block.binding
-    end
-  end
-end
+module Widgets
+  module ShowhideHelper
+    include CssTemplate
+
+    def show_box_for record, opts={}
+      name = opts[:name] || 'details'
+      link_name = opts[:link_name] || 'show details'
+      detail_box_id = opts[:detail_box_id] || dom_detail_id(record,name)
+
+      html = opts[:html] || {} # setup default html options
+      html[:id] ||= dom_show_id(record,name)
+      html[:class] ||= &quot;#{name}_show_link&quot;
+
+      link_to_function link_name, nil, html do |page|
+        page[detail_box_id].show
+        page[html[:id]].hide
+      end
+    end
+
+    def hide_box_for record, opts={}
+      name = opts[:name] || 'details'
+      link_name = opts[:link_name] || 'hide details'
+      detail_box_id = opts[:detail_box_id] || dom_detail_id(record,name)
+      show_link_id = opts[:show_link_id] || dom_show_id(record,name)
+
+      html = opts[:html] || {} # setup default html options
+      html[:id] ||= dom_hide_id(record,name)
+      html[:class] ||= &quot;#{name}_hide_link&quot;
+
+      link_to_function link_name, nil, html do |page|
+        page[detail_box_id].hide
+        page[show_link_id].show
+      end
+    end
+
+    def detail_box_for record, opts={}, &amp;block
+      raise ArgumentError, 'Missing block in showhide.detail_box_for call' unless block_given?
+      name = opts[:name] || 'details'
+      @generate_css = opts[:generate_css] || false
+
+      html = opts[:html] || {} # setup default html options
+      html[:id] ||= dom_detail_id(record,name)
+      html[:class] ||= &quot;#{name}_for_#{normalize_class_name(record)}&quot;
+      html[:style] = 'display:none;'
+      @css_class = html[:class]
+      concat(render_css('showhide'), block.binding) if generate_css?
+      # Taken from ActionView::Helpers::RecordTagHelper
+      concat content_tag(:div, capture(&amp;block), html), block.binding
+      nil
+    end
+
+    private
+
+    def dom_detail_id record, name
+      normalize_dom_id(record, name.to_s)
+    end
+
+    def dom_show_id record, name
+      normalize_dom_id(record, &quot;show_#{name}&quot;)
+    end
+
+    def dom_hide_id record, name
+      normalize_dom_id(record, &quot;hide_#{name}&quot;)
+    end
+
+    def normalize_dom_id object, prefix
+      if object.kind_of?(ActiveRecord::Base)
+        dom_id(object, &quot;#{prefix}_for#{object.id ? '' : '_new'}&quot;)
+      else
+        [ prefix, 'for', normalize_class_name(object) ].compact * '_'
+      end
+    end
+
+    def normalize_class_name object
+      if object.kind_of?(ActiveRecord::Base)
+        ActionController::RecordIdentifier.singular_class_name(object)
+      else
+        object.to_s
+      end
+    end
+
+    # content_tag_for creates an HTML element with id and class parameters
+    # that relate to the specified Active Record object.
+    #
+    # Taken from ActionView::Helpers::RecordTagHelper
+    def content_box_for(tag_name, *args, &amp;block)
+      concat content_tag(tag_name, capture(&amp;block), args), block.binding
+    end
+  end
+end</diff>
      <filename>lib/widgets/showhide_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -34,7 +34,7 @@ module Widgets
       html[:id] ||= @name.to_s.underscore &lt;&lt; '_table'
       html[:class] ||= html[:id]
       
-      _out = generate_css? ? default_css : ''
+      _out = generate_css? ? render_css('table') : ''
       _out &lt;&lt; tag('table', {:id =&gt; html[:id], :class =&gt; html[:class]}, true) 
       _out &lt;&lt; tag('tbody', nil, true) 
       _out &lt;&lt; tag('tr', nil, true)
@@ -63,12 +63,6 @@ module Widgets
       nil # avoid duplication if called with &lt;%= %&gt;
     end
     
-    private
-    
-    # return the name of the erb to parse for the default css generation
-    def css_template_filename
-      'table.css.erb' 
-    end
   end
   
-end
\ No newline at end of file
+end</diff>
      <filename>lib/widgets/table_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -42,7 +42,7 @@ module Widgets
       @_binding = proc.binding # the binding of calling page
 
       instance_eval(&amp;proc)
-      out @_tabnav.default_css if @_tabnav.generate_css?
+      out @_tabnav.render_css('tabnav') if @_tabnav.generate_css?
       out tag('div',@_tabnav.html ,true)
       @_tabnav.sort! if opts[:sort] == true
       render_tabnav_tabs</diff>
      <filename>lib/widgets/tabnav_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,7 +28,7 @@ module Widgets
     def tooltip_css
       unless @_tooltip_css_done
         @_tooltip_css_done = true
-        return default_css
+        return render_css('tooltip')
       else
         ''
       end
@@ -60,13 +60,5 @@ module Widgets
       html &lt;&lt; '&lt;/div&gt;&lt;/div&gt;' 
       html
     end
-    
-    private
-    
-    # return the name of the erb to parse for the default css generation
-    def css_template_filename
-      'tooltip.css.erb' 
-    end
-    
   end
 end</diff>
      <filename>lib/widgets/tooltip_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,28 @@
-# desc &quot;Explaining what the task does&quot;
-# task :widgets do
-#   # Task goes here
-# end
\ No newline at end of file
+def copy(file_name, from_dir, to_dir)
+  FileUtils.mkdir to_dir unless File.exist?(File.expand_path(to_dir))   
+  from = File.expand_path(File.join(from_dir,file_name))
+  to = File.expand_path(File.join(to_dir, file_name))
+  puts &quot;  creating: #{to}&quot;
+  FileUtils.cp from, to unless File.exist?(to)
+end
+
+def copy_image(file_name)
+  plugin_images = File.join(File.dirname(__FILE__), '..', 'images')
+  app_images = File.join(RAILS_ROOT, 'public/images/widgets')
+  copy file_name, plugin_images, app_images 
+end
+
+def copy_javascript(file_name)
+  plugin_javascripts = File.join(File.dirname(__FILE__), '..', 'javascripts')
+  app_javascripts = File.join(RAILS_ROOT, 'public/javascripts/widgets')
+  copy file_name, plugin_javascripts, app_javascripts 
+end
+
+desc &quot;Copies the widgets assets (images and javascripts) to the public folder&quot;
+namespace :widgets do
+  task :setup do
+    copy_image      'tooltip_arrow.gif'
+    copy_image      'tooltip_image.gif'
+    copy_javascript 'tooltip.js'
+  end
+end</diff>
      <filename>tasks/widgets_tasks.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1d0dccc0a998a282d58a616ff739bac5697868b9</id>
    </parent>
  </parents>
  <author>
    <name>Paolo Dona</name>
    <email>paolo.dona@gmail.com</email>
  </author>
  <url>http://github.com/paolodona/rails-widgets/commit/62c24009b187cb51b94bc7a83763a7179d8f5900</url>
  <id>62c24009b187cb51b94bc7a83763a7179d8f5900</id>
  <committed-date>2008-10-30T16:58:59-07:00</committed-date>
  <authored-date>2008-10-30T16:58:59-07:00</authored-date>
  <message>added rake task widgets:setup and fixed css generation problem in tooltip and progressbar (the cache was shared across the widgets)</message>
  <tree>5875b3c9324a1fcb2074c355060f63eb913bcc7d</tree>
  <committer>
    <name>Paolo Dona</name>
    <email>paolo.dona@gmail.com</email>
  </committer>
</commit>
