Changeset 222

Show
Ignore:
Timestamp:
09/24/2007 20:20:22 (14 months ago)
Author:
zimbatm
Message:

Removed #errors_for after a usage study on the following projects :
YurtCMS, Feedchamp, Cushion, MouseHole?, Rudebo, TentSteak?, JuneBug?, Buggy,
Rusksack, Reststop and httpauth. Only Cushion uses it, in a specialized form.

camping.rb : 3969 octets... the 4k bar has been passed !

Location:
trunk/lib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/camping-unabridged.rb

    r221 r222  
    200200    end 
    201201 
    202     # Shows AR validation errors for the object passed.  
    203     # There is no output if there are no errors. 
    204     # 
    205     # An example might look like: 
    206     # 
    207     #   errors_for @post 
    208     # 
    209     # Might (depending on actual data) render something like this in Markaby: 
    210     # 
    211     #   ul.errors do 
    212     #     li "Body can't be empty" 
    213     #     li "Title must be unique" 
    214     #   end 
    215     # 
    216     # Add a simple ul.errors {color:red; font-weight:bold;} CSS rule and you 
    217     # have built-in, usable error checking in only one line of code. :-) 
    218     # 
    219     # See AR validation documentation for details on validations. 
    220     def errors_for(o); ul.errors { o.errors.each_full { |er| li er } } if o.errors.any?; end 
    221202    # Simply builds a complete path from a path +p+ within the app.  If your application is  
    222203    # mounted at <tt>/blog</tt>: 
  • trunk/lib/camping.rb

    r221 r222  
    11%w[active_support markaby tempfile uri].map{|l|require l};module Camping;C=self 
    2 S=IO.read(__FILE__)rescue nil;P="Cam\ping Problem!";H=HashWithIndifferentAccess;class 
    3 H;def method_missing m,*a;m.to_s=~/=$/?self[$` 
    4 ]=a[0]:a==[]?self[m]:super end;alias u regular_update;end;module Helpers 
    5 def R c,*g;p,h=/\(.+?\)/,g.grep(Hash);(g-=h).inject(c.urls.find{|x|x.scan(p). 
    6 size==g.size}.dup){|s,a|s.sub p,C.escape((a[a.class.primary_key]rescue a))}+( 
    7 h.any?? "?"+h[0].map{|x|x.map{|z|C.escape z}*"="}*"&": "")end;def errors_for o 
    8 ul.errors{o.errors.each_full{|er|li er}}if o.errors.any?end;def /(p);p[/^\//]? 
    9 @root+p:p end;def URL c='/',*a;c=R(c,*a)if c.respond_to?:urls;c=self/c;c="//"+ 
     2S=IO.read(__FILE__)rescue nil;P="Cam\ping Problem!";H=HashWithIndifferentAccess 
     3class H;def method_missing m,*a;m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m]:super 
     4end;alias u regular_update;end;module Helpers def R c,*g;p,h=/\(.+?\)/,g. 
     5grep(Hash);(g-=h).inject(c.urls.find{|x|x.scan(p).size==g.size}.dup){|s,a|s. 
     6sub p,C.escape((a[a.class.primary_key]rescue a))}+(h.any?? "?"+h[0]. 
     7map{|x|x.map{|z|C.escape z}*"="}*"&": "")end;def /(p);p[/^\//]?@root+p:p 
     8end;def URL c='/',*a;c=R(c,*a)if c.respond_to?:urls;c=self/c;c="//"+ 
    109@env.HTTP_HOST+c if c[/^\//];URI(c) end end;module Base;attr_accessor:input, 
    1110:cookies,:env,:headers,:body,:status,:root;Z="\r\n";def method_missing*a,&b;a.