public
Description: All the extra stuff you could want for the Mack Framework.
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack-more.git
Deprecated the model_text_field, model_password_field, and model_textarea 
methods. [#19]
markbates (author)
Fri Aug 15 08:23:26 -0700 2008
commit  27c345da851775cf2443b5813890c4ae0bf64809
tree    287b5127c560fbdb91bd13e4a0f15641af149faa
parent  b4a3fe55fa83a1c70c93e591063fe9569b4e48b7
...
23
24
25
26
 
27
28
 
29
30
31
32
 
33
34
 
35
36
37
...
23
24
25
 
26
27
 
28
29
30
31
 
32
33
 
34
35
36
37
0
@@ -23,15 +23,15 @@ module Mack
0
         # 
0
         # Examples:
0
         #   Mack::Generator::ColumnObject.new("user", "username:string").form_field 
0
-        #     => "<%= model_text_field(@user, :username) %>"
0
+        #     => "<%= :user.text_field :username %>"
0
         #   Mack::Generator::ColumnObject.new("Post", "body:text").form_field
0
-        #     => "<%= model_textarea(@user, :username) %>"
0
+        #     => "<%= :post.text_area :body %>"
0
         def form_field
0
           case self.column_type
0
           when "text"
0
-            %{<%= model_textarea(@#{self.model_name}, :#{self.column_name}) %>}
0
+            %{<%= :#{self.model_name}.text_area :#{self.column_name} %>}
0
           else
0
-            %{<%= model_text_field(@#{self.model_name}, :#{self.column_name}) %>}
0
+            %{<%= :#{self.model_name}.text_field :#{self.column_name} %>}
0
           end
0
         end
0
       
...
2
3
4
5
6
7
8
9
 
 
 
10
11
 
12
13
14
15
16
17
18
19
 
 
 
 
 
20
21
22
 
 
 
23
24
 
25
26
27
...
2
3
4
 
 
 
 
 
5
6
7
8
 
9
10
11
 
 
 
 
 
 
12
13
14
15
16
17
18
 
19
20
21
22
 
23
24
25
26
0
@@ -2,26 +2,25 @@ module Mack
0
   module ViewHelpers # :nodoc:
0
     module OrmHelpers
0
       
0
-      # Generates a text input tag for a given model and field
0
-      # 
0
-      # Example:
0
-      # model_text_field(@user, :username) # => <input id="user_username" name="user[username]" type="text" value="<@user.username's value>" />
0
-      def model_text_field(model, property, options = {})
0
+      # DEPRECATED: Use Mack::ViewHelpers::FormHelpers text_field instead.
0
+      def model_text_field(model, property, options = {}) # :nodoc:
0
+        deprecate_method(:model_text_field, :text_field, '0.7.0')
0
         m_name = model.class.to_s.underscore
0
-        non_content_tag(:input, {:type => :text, :name => "#{m_name}[#{property}]", :id => "#{m_name}_#{property}", :value => model.send(property)}.merge(options))
0
+        text_field(model.class.to_s.underscore, property, options)
0
       end
0
       
0
-      # Generates a password input tag for a given model and field
0
-      # 
0
-      # Example:
0
-      # model_password_field(@user, :password) # => <input id="user_username" name="user[username]" type="password" value="<@user.username's value>" />
0
-      def model_password_field(model, property, options = {})
0
-        model_text_field(model, property, {:type => :password}.merge(options))
0
+      # DEPRECATED: Use Mack::ViewHelpers::FormHelpers password_field instead.
0
+      def model_password_field(model, property, options = {}) # :nodoc:
0
+        deprecate_method(:model_password_field, :password_field, '0.7.0')
0
+        m_name = model.class.to_s.underscore
0
+        password_field(model.class.to_s.underscore, property, options)
0
       end
0
       
0
-      def model_textarea(model, property, options = {})
0
+      # DEPRECATED: Use Mack::ViewHelpers::FormHelpers text_area instead.
0
+      def model_textarea(model, property, options = {}) # :nodoc:
0
+        deprecate_method(:model_textarea, :text_area, '0.7.0')
0
         m_name = model.class.to_s.underscore
0
-        content_tag(:textarea, {:name => "#{m_name}[#{property}]", :id => "#{m_name}_#{property}", :cols => 60, :rows => 20}.merge(options), model.send(property))
0
+        text_area(model.class.to_s.underscore, property, options)
0
       end
0
       
0
     end # OrmHelpers

Comments