Permalink
Browse files

Updates to work with Rails 3

  • Loading branch information...
1 parent 32c7dee commit 4620bf1f999dd06f7a927bf1addb6b7234dfa0e3 @lleger lleger committed with Jun 6, 2011
Showing with 7 additions and 7 deletions.
  1. +4 −4 lib/pretty_buttons.rb
  2. +3 −3 { → lib}/tasks/pretty_buttons_tasks.rake
View
@@ -13,7 +13,7 @@ def include_pretty_buttons
# pretty_button 'Click me', signup_url
def pretty_button(content, path, options={})
options[:class] = options[:class].nil? ? "button" : "button " << options[:class]
- link_to "<span>#{content}</span>", path, options
+ link_to "<span>#{content}</span>".html_safe, path, options
end
# dynamically Generate all icon based buttons
@@ -68,15 +68,15 @@ def pretty_submit(content, options={}, &blk)
options[:div][:class] = options[:div][:class].nil? ? "clear submit-line" : ("clear submit-line " << options[:div][:class])
options.delete :form
- btn = link_to("<span>#{content}</span>", '#', options[:btn])
+ btn = link_to("<span>#{content}</span>".html_safe, '#', options[:btn])
if block_given?
concat content_tag(:div, "#{btn}#{capture(&blk)}", options[:div]), blk.binding
else
content_tag :div, btn, options[:div]
end
end
- if RAILS_GEM_VERSION > '1.2.3'
+ if Rails.version > '1.2.3'
# Rails 1.2.3 doesn't do do aliases on dynamic methods
alias :back_button :arrow_left_button
alias :delete_button :cancel_button
@@ -91,6 +91,6 @@ def pretty_submit(content, options={}, &blk)
alias :down_button :arrow_down_button
alias :print_button :printer_button
alias :search_button :magnifier_button
- end if defined? RAILS_GEM_VERSION
+ end
end
@@ -1,8 +1,8 @@
require 'fileutils'
-PRETTY_PUBLIC_CSS = File.join(RAILS_ROOT,"public","stylesheets")
-PRETTY_PUBLIC_IMGS = File.join(RAILS_ROOT,"public","images")
-PRETTY_PLUGIN_PATH = File.join(RAILS_ROOT, "vendor/plugins/Pretty-Buttons")
+PRETTY_PUBLIC_CSS = File.join(Rails.root,"public","stylesheets")
+PRETTY_PUBLIC_IMGS = File.join(Rails.root,"public","images")
+PRETTY_PLUGIN_PATH = File.join(Rails.root, "vendor/plugins/Pretty-Buttons")
namespace :pretty_buttons do
desc 'Installs all the files for the buttons'

0 comments on commit 4620bf1

Please sign in to comment.