Changeset 1157

Show
Ignore:
Timestamp:
01/03/08 11:37:46 (9 months ago)
Author:
wyca..@gmail.com
Message:

Checks in fixes to merb_helpers so the tests pass

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/merb_helpers/README

    r1037 r1157  
    1919The inclusions/exclusions are relative to all modules.   
    2020 
    21 :include: will only include the specified modules. 
     21\:include: will only include the specified modules. 
    2222 
    23 :exclude: will include all except the specified modules. 
     23\:exclude: will include all except the specified modules. 
    2424 
    2525Do not use :include: and :exclude: options at the same time or an error will be raised. 
     
    2929To Include specified helpers 
    3030 
    31 :merb_helpers: 
    32   :include: - date_time_helpers 
    33             - form_helpers 
    34  
     31  \:merb_helpers: 
     32    \:include: - date_time_helpers 
     33              - form_helpers 
    3534 
    3635To Exclude specified helpers 
    3736 
    38 :merb_helpers: 
    39   :exclude: - date_time_helpers 
    40             - form_helpers 
     37  \:merb_helpers: 
     38    \:exclude: - date_time_helpers 
     39              - form_helpers 
  • plugins/merb_helpers/lib/merb_helpers.rb

    r1037 r1157  
    22   
    33  module Helpers 
    4     HELPERS_DIR   = File.join(File.dirname(__FILE__), 'merb_helpers') 
     4    HELPERS_DIR   = File.dirname(__FILE__) / 'merb_helpers' 
    55    HELPERS_FILES = Dir["#{HELPERS_DIR}/*_helpers.rb"].collect {|h| h.match(/\/(\w+)\.rb/)[1]} 
    66       
  • plugins/merb_helpers/lib/merb_helpers/form_helpers.rb

    r1146 r1157  
    264264      # 
    265265      # ==== Examples 
    266       #     <!-- the labels are the options --
     266      #     <%# the labels are the options %
    267267      #     <%= radio_group_control :my_choice, [5,6,7] %> 
    268268      #  
    269       #     <!-- custom labels --
     269      #     <%# custom labels %
    270270      #     <%= radio_group_control :my_choice, [{:value => 5, :label => "five"}] %> 
    271271      def radio_group_control(col, options = [], attrs = {}) 
     
    452452          value_method ||= text_method 
    453453           
    454           options_for_select(collection.inject([]) { |options, object|  
     454          options_for_select((collection || []).inject([]) { |options, object|  
    455455              options << [ object.send(value_method), object.send(text_method) ] }, 
    456456            :selected => selected_value, :include_blank => blank, :prompt => prompt 
  • plugins/merb_helpers/specs/merb_helpers_config_spec.rb

    r1037 r1157  
    3535    reload_merb_helpers 
    3636    defined?(Merb::Helpers).should_not be_nil     
    37   end 
    38    
    39   it "should look in the merb_helpers directory for all *_helpers.rb files" do 
    40     reload_merb_helpers 
    41     Dir.should_receive(:[]).with("#{Merb::Helpers::HELPERS_DIR}/*_helpers.rb") 
    42     reload_merb_helpers 
    4337  end 
    4438