Permalink
Browse files

Marks the output from the formbuilder as html_safe, otherwise formtas…

…tic won't output html_safe content +

Fixes $ instead of jQuery (JS library compatibility issue) +
Bump minor
  • Loading branch information...
bbenezech committed Jun 22, 2010
1 parent 380e6ba commit 676d5d273a64f629e448e041f61c60c4bc5ba73c
Showing with 10 additions and 3 deletions.
  1. +1 −1 VERSION
  2. +1 −0 lib/papermill.rb
  3. +6 −0 lib/papermill/extensions.rb
  4. +2 −2 lib/papermill/form_builder.rb
View
@@ -1 +1 @@
-2.1.0
+2.1.1
View
@@ -12,6 +12,7 @@
Hash.send :include, PapermillHashExtensions
Array.send :include, PapermillArrayExtensions
String.send :include, StringToUrlNotFound unless String.instance_methods.include? "to_url"
+String.send :include, HtmlSafeBackwardCompatibilityFix unless String.instance_methods.include? "html_safe"
Formtastic::SemanticFormBuilder.send(:include, PapermillFormtasticExtensions) rescue NameError
require 'papermill/papermill_options.rb'
@@ -1,5 +1,11 @@
class PapermillException < Exception; end
+module HtmlSafeBackwardCompatibilityFix
+ def html_safe
+ self
+ end
+end
+
module PapermillHashExtensions
def deep_merge(hash)
target = dup
@@ -94,7 +94,7 @@ def papermill_upload_tag(method, options)
%{<div class="papermill">
#{@template.hidden_field("#{assetable_name}[papermill_#{method}_ids]", nil)}
#{html[:css].to_s + html[:js].to_s + options[:form_helper_elements].map{|element| html[element] || ""}.join("\n")}
- </div>}
+ </div>}.html_safe
end
@@ -137,7 +137,7 @@ def set_papermill_inline_js(field_id, create_url, options)
""
else
%{<script type="text/javascript">
- $(function() {
+ jQuery(function() {
#{outputed_js}
});
</script>}

0 comments on commit 676d5d2

Please sign in to comment.