<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/mack/view_helpers/form_helpers.rb</filename>
    </added>
    <added>
      <filename>lib/mack/view_helpers/link_helpers.rb</filename>
    </added>
    <added>
      <filename>test/unit/view_helpers/form_helpers_spec.rb</filename>
    </added>
    <added>
      <filename>test/unit/view_helpers/link_helpers_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,5 @@
+* [#85] Refactored out Mack::ViewHelpers::HtmlHelpers into Mack::ViewHelpers::HtmlHelpers, Mack::ViewHelpers::FormHelpers and
+        Mack::ViewHelpers::linkHelpers
 * [#84] Added Mack::Distributed.lookup(url) to retrieve specific distributed services.
 * [#83] Added mail_to HTML helper.
 * [#82] Added ACL support to mack-distributed</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -2,59 +2,6 @@ module Mack
   module ViewHelpers # :nodoc:
     module HtmlHelpers
       
-      # This is just an alias to 
-      # 
-      # Examples:
-      #   &lt;%= link_to(&quot;http://www.mackframework.com&quot;) %&gt; # =&gt; &lt;a href=&quot;http://www.mackframework.com&quot;&gt;http://www.mackframework.com&lt;/a&gt;
-      #   &lt;%= link_to(&quot;Mack&quot;, &quot;http://www.mackframework.com&quot;) %&gt; # =&gt; &lt;a href=&quot;http://www.mackframework.com&quot;&gt;Mack&lt;/a&gt;
-      #   &lt;%= link_to(&quot;Mack&quot;, &quot;http://www.mackframework.com&quot;, :target =&gt; &quot;_blank&quot;) %&gt; # =&gt; &lt;a href=&quot;http://www.mackframework.com&quot; target=&quot;_blank&quot;&gt;Mack&lt;/a&gt;
-      #   &lt;%= link_to(&quot;Mack&quot;, &quot;http://www.mackframework.com&quot;, :target =&gt; &quot;_blank&quot;, :rel =&gt; :nofollow) %&gt; # =&gt; &lt;a href=&quot;http://www.mackframework.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Mack&lt;/a&gt;
-      # If you pass in :method as an option it will be a JavaScript form that will post to the specified link with the 
-      # methd specified.
-      #   &lt;%= link_to(&quot;Mack&quot;, &quot;http://www.mackframework.com&quot;, :method =&gt; :delete) %&gt;
-      # If you use the :method option you can also pass in a :confirm option. The :confirm option will generate a 
-      # javascript confirmation window. If 'OK' is selected the the form will submit. If 'cancel' is selected, then
-      # nothing will happen. This is extremely useful for 'delete' type of links.
-      #   &lt;%= link_to(&quot;Mack&quot;, &quot;http://www.mackframework.com&quot;, :method =&gt; :delete, :confirm =&gt; &quot;Are you sure?&quot;) %&gt;
-      def link_to(link_text, url = link_text, html_options = {})
-        options = {:href =&gt; url}.merge(html_options)
-        a(link_text, options)
-      end
-      
-      # Used in views to create href links. It takes link_text, url, and a Hash that gets added
-      # to the href as options.
-      # 
-      # Examples:
-      #    a(&quot;http://www.mackframework.com&quot;) # =&gt; &lt;a href=&quot;http://www.mackframework.com&quot;&gt;http://www.mackframework.com&lt;/a&gt;
-      #    a(&quot;Mack&quot;, :href =&gt; &quot;http://www.mackframework.com&quot;) # =&gt; &lt;a href=&quot;http://www.mackframework.com&quot;&gt;Mack&lt;/a&gt;
-      #    a(&quot;Mack&quot;, :href =&gt; &quot;http://www.mackframework.com&quot;, :target =&gt; &quot;_blank&quot;) # =&gt; &lt;a href=&quot;http://www.mackframework.com&quot; target=&quot;_blank&quot;&gt;Mack&lt;/a&gt;
-      #    a(&quot;Mack&quot;, :href =&gt; &quot;http://www.mackframework.com&quot;, :target =&gt; &quot;_blank&quot;, :rel =&gt; :nofollow) # =&gt; &lt;a href=&quot;http://www.mackframework.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Mack&lt;/a&gt;
-      # If you pass in :method as an option it will be a JavaScript form that will post to the specified link with the 
-      # methd specified.
-      #    a(&quot;Mack&quot;, :href =&gt; &quot;http://www.mackframework.com&quot;, :method =&gt; :delete)
-      # If you use the :method option you can also pass in a :confirm option. The :confirm option will generate a 
-      # javascript confirmation window. If 'OK' is selected the the form will submit. If 'cancel' is selected, then
-      # nothing will happen. This is extremely useful for 'delete' type of links.
-      #    a(&quot;Mack&quot;, :href =&gt; &quot;http://www.mackframework.com&quot;, :method =&gt; :delete, :confirm =&gt; &quot;Are you sure?&quot;)
-      def a(link_text, options = {})
-        options = {:href =&gt; link_text}.merge(options)
-        if options[:method]
-          meth = nil
-          confirm = nil
-        
-          meth = %{var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', '_method'); s.setAttribute('value', '#{options[:method]}'); f.appendChild(s);f.submit()}
-          options.delete(:method)
-        
-          if options[:confirm]
-            confirm = %{if (confirm('#{options[:confirm]}'))}
-            options.delete(:confirm)
-          end
-        
-          options[:onclick] = (confirm ? (confirm + &quot; { &quot;) : &quot;&quot;) &lt;&lt; meth &lt;&lt; (confirm ? (&quot; } &quot;) : &quot;&quot;) &lt;&lt; &quot;;return false;&quot;
-        end
-        content_tag(:a, options, link_text)
-      end
-      
       # Builds an HTML tag.
       # 
       # Examples:
@@ -84,74 +31,12 @@ module Mack
         non_content_tag(:img, {:src =&gt; image_src}.merge(options))
       end
       
-      # Builds an HTML submit tag
-      def submit_tag(value = &quot;Submit&quot;, options = {})
-        non_content_tag(:input, {:type =&gt; :submit, :value =&gt; value}.merge(options))
-      end
-      
-      # Wraps an image tag with a link tag.
-      # 
-      # Examples:
-      #   &lt;%= link_image_to(&quot;/images/foo.jpg&quot;, &quot;#&quot; %&gt; # =&gt; &lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;/images/foo.jpg&quot;&gt;&lt;/a&gt;
-      def link_image_to(image_url, url, image_options = {}, html_options = {})
-        link_to(img(image_url, image_options), url, html_options)
-      end
-      
       # Example:
       #   &lt;%= rss_tag(posts_index_url(:format =&gt; :xml)) %&gt;
       def rss_tag(url)
         &quot;&lt;link rel=\&quot;alternate\&quot; type=\&quot;application/rss+xml\&quot; title=\&quot;RSS\&quot; href=\&quot;#{url}\&quot;&gt;&quot;
       end
       
-      def form(action, options = {}, &amp;block)
-        options = {:method =&gt; :post, :action =&gt; action}.merge(options)
-        if options[:id]
-          options = {:class =&gt; options[:id]}.merge(options)
-        end
-        if options[:multipart]
-          options = {:enctype =&gt; &quot;multipart/form-data&quot;}.merge(options)
-          options.delete(:multipart)
-        end
-        meth = nil
-        unless options[:method] == :get || options[:method] == :post
-          meth = &quot;&lt;input name=\&quot;_method\&quot; type=\&quot;hidden\&quot; value=\&quot;#{options[:method]}\&quot; /&gt;\n&quot;
-          options[:method] = :post
-        end
-        concat(&quot;&lt;form#{build_options(options)}&gt;\n&quot;, block.binding)
-        concat(meth, block.binding) unless meth.blank?
-        yield
-        concat(&quot;&lt;/form&gt;&quot;, block.binding)
-        # content_tag(:form, options, &amp;block)
-      end
-      
-      # Builds a mailto href. By default it will generate 
-      # JavaScript to help prevent phishing. To turn this off
-      # pass in the option :format =&gt; :plain
-      # 
-      #   mail_to(&quot;Saul Frami&quot;, &quot;frami.saul@klocko.ca&quot;) # =&gt; 
-      #   &lt;script&gt;document.write(String.fromCharCode(60,97,32,104,114,101,
-      #   102,61,34,109,97,105,108,116,111,58,102,114,97,109,105,46,115,97,117,
-      #   108,64,107,108,111,99,107,111,46,99,97,34,62,83,97,117,108,32,70,114,97,109,105,60,47,97,62));&lt;/script&gt;
-      def mail_to(text, email_address = nil, options = {})
-        email_address = text if email_address.blank?
-        options = {:format =&gt; :js}.merge(options)
-        format = options[:format]
-        options - [:format]
-        link = link_to(text, &quot;mailto:#{email_address}&quot;, options)
-        if format == :js
-          y = ''
-          link.size.times {y &lt;&lt; 'a'}
-          js_link = &quot;&lt;script&gt;&quot;
-          c_code = []
-          link.each_byte {|c| c_code &lt;&lt; c}
-          js_link &lt;&lt; &quot;document.write(String.fromCharCode(#{c_code.join(&quot;,&quot;)}));&quot;
-          js_link &lt;&lt; &quot;&lt;/script&gt;&quot;
-          return js_link
-        else
-          return link
-        end
-      end
-      
       private
       def build_options(options)
         opts = &quot;&quot;</diff>
      <filename>lib/mack/view_helpers/html_helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,17 +1,8 @@
 require 'pathname'
 require Pathname(__FILE__).dirname.expand_path.parent.parent + 'spec_helper'
 
-module HTMLSpecHelpers
-  include Mack::ViewHelpers::HtmlHelpers
-  
-  def my_url
-    return &quot;http://www.mackframework.com&quot;
-  end
-  
-end
-
 describe Mack::ViewHelpers::HtmlHelpers do
-  include HTMLSpecHelpers
+  include Mack::ViewHelpers
   
   describe &quot;mail_to&quot; do
     
@@ -29,62 +20,6 @@ describe Mack::ViewHelpers::HtmlHelpers do
     
   end
   
-  describe &quot;submit_tag&quot; do
-    
-    it &quot;should build a simple submit tag&quot; do
-      submit_tag.should == %{&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt;}
-    end
-    
-    it &quot;should allow you to change the value&quot; do
-      submit_tag(&quot;Login&quot;).should == %{&lt;input type=&quot;submit&quot; value=&quot;Login&quot; /&gt;}
-    end
-    
-    it &quot;should take options&quot; do
-      submit_tag(&quot;Login&quot;, {:class =&gt; :foo}).should == %{&lt;input class=&quot;foo&quot; type=&quot;submit&quot; value=&quot;Login&quot; /&gt;}
-    end
-    
-  end
-  
-  describe &quot;a&quot; do
-    
-    it &quot;should return content when a(...) is called&quot; do
-      link_to(my_url).should_not be_nil
-      link_to(my_url).should_not be_empty
-    end
-    
-    it &quot;should return proper html when called without options&quot; do
-      a(my_url).should == %{&lt;a href=&quot;#{my_url}&quot;&gt;#{my_url}&lt;/a&gt;}
-    end
-    
-    it &quot;should return proper html when called with options&quot; do
-      a(&quot;Mack&quot;, :href =&gt; my_url).should == %{&lt;a href=&quot;#{my_url}&quot;&gt;Mack&lt;/a&gt;}
-      a(&quot;Mack&quot;, :href =&gt; my_url, :target =&gt; &quot;_blank&quot;).should == %{&lt;a href=&quot;#{my_url}&quot; target=\&quot;_blank&quot;&gt;Mack&lt;/a&gt;}
-      
-      result = %{&lt;a href=&quot;#{my_url}&quot; onclick=&quot;var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', '_method'); s.setAttribute('value', 'delete'); f.appendChild(s);f.submit();return false;&quot;&gt;Mack&lt;/a&gt;}
-      a(&quot;Mack&quot;, :href =&gt; my_url, :method =&gt; :delete).should == result
-             
-      result = %{&lt;a href=&quot;#{my_url}&quot; onclick=&quot;if (confirm('Are you sure?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', '_method'); s.setAttribute('value', 'update'); f.appendChild(s);f.submit() } ;return false;&quot;&gt;Mack&lt;/a&gt;}
-      link = a(&quot;Mack&quot;, :href =&gt; my_url, :method =&gt; :update, :confirm =&gt; &quot;Are you sure?&quot;)
-      link.should == result
-    end
-  end
-  
-  describe &quot;link_to&quot; do
-    it &quot;should return content when link_to(...) is called&quot; do
-      a(my_url).should_not be_nil
-      a(my_url).should_not be_empty
-    end
-    
-    it &quot;should return proper html when link_to(...) is called&quot; do
-      link_to(my_url).should == a(my_url)
-      link_to(&quot;Mack&quot;, my_url).should == a(&quot;Mack&quot;, :href =&gt; my_url)
-      link_to(&quot;Mack&quot;, my_url, :target =&gt; &quot;_blank&quot;).should == a(&quot;Mack&quot;, :href =&gt; my_url, :target =&gt; &quot;_blank&quot;)
-      link_to(&quot;Mack&quot;, my_url, :method =&gt; :delete).should == a(&quot;Mack&quot;, :href =&gt; my_url, :method =&gt; :delete)
-      link_to(&quot;Mack&quot;, my_url, :method =&gt; :update, :confirm =&gt; &quot;Are you sure?&quot;).should ==  
-            a(&quot;Mack&quot;, :href =&gt; my_url, :method =&gt; :update, :confirm =&gt; &quot;Are you sure?&quot;)
-    end
-  end
-  
   describe &quot;rss_tag&quot; do
     it &quot;should return content when rss() is called&quot; do
       rss_tag(&quot;foo_bar&quot;).should_not be_nil</diff>
      <filename>test/unit/view_helpers/html_helpers_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e773d47ce14b37d1bb8dded88c3944328fb2f8e0</id>
    </parent>
  </parents>
  <author>
    <name>Mark Bates</name>
    <email>mark@markbates.com</email>
  </author>
  <url>http://github.com/markbates/mack/commit/727e04e0c5dae38476648eeac6641c72cd7ebd5a</url>
  <id>727e04e0c5dae38476648eeac6641c72cd7ebd5a</id>
  <committed-date>2008-08-08T12:16:13-07:00</committed-date>
  <authored-date>2008-08-08T12:16:13-07:00</authored-date>
  <message>Refactored out Mack::ViewHelpers::HtmlHelpers into Mack::ViewHelpers::HtmlHelpers, Mack::ViewHelpers::FormHelpers and Mack::ViewHelpers::linkHelpers [#85 state:resolved]</message>
  <tree>d954e8094a576508e1afd8ab67a66a7d73ecb9fe</tree>
  <committer>
    <name>Mark Bates</name>
    <email>mark@markbates.com</email>
  </committer>
</commit>
