diff --git a/api_taster.gemspec b/api_taster.gemspec index d3ed0f7..4405d68 100644 --- a/api_taster.gemspec +++ b/api_taster.gemspec @@ -19,6 +19,7 @@ Gem::Specification.new do |s| s.add_dependency 'sass-rails' s.add_dependency 'bootstrap-sass', '~> 2.1' s.add_dependency 'redcarpet' + s.add_dependency 'remotipart', '~> 1.0' s.add_development_dependency 'rake' s.add_development_dependency 'simplecov' diff --git a/app/assets/javascripts/api_taster/application.js b/app/assets/javascripts/api_taster/application.js index 8c515ad..354ccc8 100644 --- a/app/assets/javascripts/api_taster/application.js +++ b/app/assets/javascripts/api_taster/application.js @@ -12,5 +12,6 @@ // //= require jquery //= require jquery_ujs +//= require jquery.remotipart //= require bootstrap //= require_tree . diff --git a/app/views/api_taster/routes/_param_form_element.html.erb b/app/views/api_taster/routes/_param_form_element.html.erb index 8fbf3d6..b206902 100644 --- a/app/views/api_taster/routes/_param_form_element.html.erb +++ b/app/views/api_taster/routes/_param_form_element.html.erb @@ -1,6 +1,10 @@
- + <% if value === :file %> + + <% else %> + + <% end %>
diff --git a/lib/api_taster.rb b/lib/api_taster.rb index ec00575..7add34f 100644 --- a/lib/api_taster.rb +++ b/lib/api_taster.rb @@ -1,5 +1,6 @@ require 'jquery-rails' require 'bootstrap-sass' +require 'remotipart' require 'active_support/dependencies' require 'api_taster/engine' require 'api_taster/route' diff --git a/lib/api_taster/form_builder.rb b/lib/api_taster/form_builder.rb index 556c98d..7c794c6 100644 --- a/lib/api_taster/form_builder.rb +++ b/lib/api_taster/form_builder.rb @@ -52,7 +52,7 @@ def add_element_to_buffer(parent_labels, label, value) :locals => { :label => "#{print_labels(parent_labels)}#{label}", :label_text => label, - :value => value.to_s + :value => value } ) end diff --git a/spec/form_builder_spec.rb b/spec/form_builder_spec.rb index 8ee96a6..02c1632 100644 --- a/spec/form_builder_spec.rb +++ b/spec/form_builder_spec.rb @@ -12,6 +12,7 @@ module ApiTaster let(:builder) do FormBuilder.new({ :hello => 'world', + :content => :file, :user => { :name => 'Fred', :comment => { @@ -43,6 +44,10 @@ module ApiTaster builder.html.should match('value="world"') end + it "does files" do + builder.html.should match('') + end + it "does numbers" do builder.html.should match('value="1"') end