From fa8e451e3b7054a291433f12be457cf8ed09de73 Mon Sep 17 00:00:00 2001 From: Fred Wu Date: Tue, 17 Jul 2012 00:18:09 +1000 Subject: [PATCH] Form fixes --- app/assets/stylesheets/api_taster/layout.css.scss | 7 ++++++- lib/api_taster/form_builder.rb | 6 ++++-- spec/dummy/config/routes.rb | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/api_taster/layout.css.scss b/app/assets/stylesheets/api_taster/layout.css.scss index e87a619..f7267b3 100644 --- a/app/assets/stylesheets/api_taster/layout.css.scss +++ b/app/assets/stylesheets/api_taster/layout.css.scss @@ -54,6 +54,11 @@ legend { font-size: 12px; line-height: 24px; } + + &.hero-legend { + margin: 0; + border: none; + } } .nav-label { @@ -85,4 +90,4 @@ legend { white-space: pre; word-wrap: normal; } -} \ No newline at end of file +} diff --git a/lib/api_taster/form_builder.rb b/lib/api_taster/form_builder.rb index 695aac3..64dbd3a 100644 --- a/lib/api_taster/form_builder.rb +++ b/lib/api_taster/form_builder.rb @@ -8,7 +8,7 @@ class FormBuilder < AbstractController::Base def initialize(params) flush_output_buffer - @_buffer = '' + @_buffer = '' add_to_buffer(params) end @@ -20,7 +20,9 @@ def html def add_to_buffer(params, parent_labels = []) params.each do |label, value| - label = "[#{label}]" + if parent_labels.present? + label = "[#{label}]" + end new_parent_labels = parent_labels.clone << label diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb index 1a71bd8..e062f62 100644 --- a/spec/dummy/config/routes.rb +++ b/spec/dummy/config/routes.rb @@ -10,6 +10,10 @@ end ApiTaster.routes do + ApiTaster.global_params = { + :version => 1 + } + get '/i_dont_exist_anymore', { :hello => 'world' }