Skip to content

Commit

Permalink
Form fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fredwu committed Jul 16, 2012
1 parent 1d8718e commit fa8e451
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion app/assets/stylesheets/api_taster/layout.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ legend {
font-size: 12px;
line-height: 24px;
}

&.hero-legend {
margin: 0;
border: none;
}
}

.nav-label {
Expand Down Expand Up @@ -85,4 +90,4 @@ legend {
white-space: pre;
word-wrap: normal;
}
}
}
6 changes: 4 additions & 2 deletions lib/api_taster/form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class FormBuilder < AbstractController::Base

def initialize(params)
flush_output_buffer
@_buffer = ''
@_buffer = '<legend class="hero-legend"></legend>'
add_to_buffer(params)
end

Expand All @@ -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

Expand Down
4 changes: 4 additions & 0 deletions spec/dummy/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
end

ApiTaster.routes do
ApiTaster.global_params = {
:version => 1
}

get '/i_dont_exist_anymore', {
:hello => 'world'
}
Expand Down

0 comments on commit fa8e451

Please sign in to comment.