config/initializers/simple_captcha.rb in enjoy_cms-0.3.7.4 vs config/initializers/simple_captcha.rb in enjoy_cms-0.4.0.beta3

- old
+ new

@@ -1,29 +1,38 @@ -module SimpleCaptcha #:nodoc - module ViewHelper #:nodoc - def show_simple_captcha(options={}) - key = simple_captcha_key(options[:object]) - options[:field_value] = set_simple_captcha_data(key, options) +if defined?(SimpleCaptcha) - defaults = { - :image => simple_captcha_image(key, options), - :label => options[:label] || I18n.t('simple_captcha.label'), - :field => simple_captcha_field(options), - :error_messages => options[:error_messages] - } + module SimpleCaptcha #:nodoc + module ViewHelper #:nodoc + def show_simple_captcha(options={}) + key = simple_captcha_key(options[:object]) + options[:field_value] = set_simple_captcha_data(key, options) - render :partial => 'simple_captcha/simple_captcha', :locals => { :simple_captcha_options => defaults } + defaults = { + :image => simple_captcha_image(key, options), + :label => options[:label] || I18n.t('simple_captcha.label'), + :field => simple_captcha_field(options), + :error_messages => options[:error_messages] + } + + render :partial => 'enjoy/simple_captcha/simple_captcha', :locals => { :simple_captcha_options => defaults } + end end end -end -SimpleCaptcha.setup do |sc| - sc.image_size = "200x50" - sc.length = 4 - sc.charset = "1234567890" + SimpleCaptcha.setup do |sc| + sc.image_size = "200x50" + sc.length = 4 + sc.charset = "0123456789" - sc.add_image_style("enjoy_cms_style", ["-alpha set", "-fill 'red'", "-background 'transparent'", "-size 200x50", "xc:transparent"]) + sc.add_image_style("enjoy_cms_style", [ + "-alpha set", + "-fill 'orange'", + "-background 'transparent'", + "-size 200x50", "xc:transparent" + ]) - sc.image_style = 'enjoy_cms_style' + sc.image_style = 'enjoy_cms_style' - sc.tmp_path = "tmp/sc" + sc.tmp_path = "tmp/sc" + end + end