<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,4 @@
+  * Added Template Paths for grids and custom template for grid [Ragunalth]
   * Added German Translations [Peter]
   * Aliased Methods named_scope search to ext_search and paginate to ext_paginate to avoid conflicts.
   * Updated the Readme</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -14,8 +14,14 @@ module Lipsiadmin#:nodoc:
     # 
     #   Component.new(&quot;Ext.grid.GroupingView&quot;, { :forceFit =&gt; true });
     # 
+    # If you want to override our default templates you can do easly with:
+    # 
+    #   Lipsiadmin::Ext::Component.template_paths.unshift(&quot;/path/to/my/js/templates&quot;)
+    # 
     class Component      
-
+      @@template_paths = [&quot;#{File.dirname(__FILE__)}/templates&quot;, &quot;#{Rails.root}/app/views/backend&quot;]
+      cattr_accessor :template_paths
+      
       def initialize(klass, options={}, &amp;block)#:nodoc:
         @klass  = klass
         @prefix = options.delete(:prefix)
@@ -191,7 +197,9 @@ module Lipsiadmin#:nodoc:
       private
         def render_javascript(template, assigns)
           assigns.each { |key, value| instance_variable_set(&quot;@#{key}&quot;, value) }
-          template = File.read(&quot;#{File.dirname(__FILE__)}/templates/#{template}.js.erb&quot;)
+          path = template_paths.find { |f| File.exist?(File.join(f, &quot;#{template}.js.erb&quot;)) }
+          raise_error &quot;Sorry but we didn't found the template #{template}.js.erb in your template_paths&quot; unless path
+          template = File.read(File.join(path, &quot;#{template}.js.erb&quot;))
           return ERB.new(template).result(binding)
         end
         </diff>
      <filename>lib/view/helpers/ext/component.rb</filename>
    </modified>
    <modified>
      <diff>@@ -59,6 +59,7 @@ module Lipsiadmin
         viewConfig            :forceFit =&gt; true
         border                false
         bodyBorder            false
+        template              :default
         clicksToEdit          1
         region                &quot;center&quot;
         sm                    :checkbox
@@ -203,8 +204,29 @@ module Lipsiadmin
         add_object(:cm, cm)
       end
       
+      # Define the template to use for build grid functions (add/delete/edit)
+      # 
+      # Default we use:
+      # 
+      #   /path/to/lipsiadmin/lib/view/helpers/ext/templates/grid_functions.js.erb
+      # 
+      # But you can easy add your own paths like:
+      #   
+      #   Lipsiadmin::Ext::Component.template_paths.unshift(&quot;/path/to/my/js/templates&quot;)
+      # 
+      # Or direct by grid:
+      #   
+      #   # products/show.rjs
+      #   page.grid :editable =&gt; true do |grid|
+      #     grid.id &quot;grid-products&quot;
+      #     grid.template &quot;products/grid_functions&quot;
+      #   ...
+      # 
+      def template(value)
+        @template = value == :default ? :grid_functions : value
+      end
       
-      # Define if the grid need to be added to
+      # Define if the grid need to be added to contentDynamic
       #   
       #   Backend.app.addItem(#{get_var});
       # 
@@ -275,7 +297,7 @@ module Lipsiadmin
           raise_error &quot;You must provide the store.&quot;                                                if config[:store].blank?
         end
         
-        after &lt;&lt; render_javascript(:grid_functions, :var =&gt; get_var, :store =&gt; config[:store], :sm =&gt; config[:sm], :tbar =&gt; config[:tbar], :editable =&gt; @editable, :un =&gt; @un)
+        after &lt;&lt; render_javascript(@template, :var =&gt; get_var, :store =&gt; config[:store], :sm =&gt; config[:sm], :tbar =&gt; config[:tbar], :editable =&gt; @editable, :un =&gt; @un)
         
         if @render
           after &lt;&lt; &quot;Backend.app.addItem(#{get_var});&quot; if @render</diff>
      <filename>lib/view/helpers/ext/grid.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>75edefb04afeb5cbc00ba3e57194160edf76651c</id>
    </parent>
  </parents>
  <author>
    <name>Davide D'Agostino</name>
    <email>DAddYE@MacBook.local</email>
  </author>
  <url>http://github.com/Lipsiasoft/lipsiadmin/commit/792ccae259bf72da2968ca5f3a63332064dcbd37</url>
  <id>792ccae259bf72da2968ca5f3a63332064dcbd37</id>
  <committed-date>2009-11-05T13:34:52-08:00</committed-date>
  <authored-date>2009-11-05T13:34:52-08:00</authored-date>
  <message>Added Template Paths for grids and custom template for grid [Ragunalth]</message>
  <tree>19730844b710591976e968b0bc077828ab7da1af</tree>
  <committer>
    <name>Davide D'Agostino</name>
    <email>DAddYE@MacBook.local</email>
  </committer>
</commit>
