Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding maxlength to text fields

  • Loading branch information...
commit 43fac435c0dac1d3e18f8376715327031f00f966 1 parent 58751b8
@eadz authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/on_the_spot/on_the_spot_helpers.rb
View
8 lib/on_the_spot/on_the_spot_helpers.rb
@@ -11,9 +11,10 @@ class OnTheSpotMissingParameters < StandardError; end
# cancel_text : the cancel-button text
# tooltip : the tooltip to show
# placeholder : the placeholder to show
- # type : {'textarea' || 'select' }
+ # type : {'textarea' || 'select' || 'text' }
# rows : nr of rows for textarea
# columns : nr of columns for textarea
+ # maxlength : for text field or set to data-maxlength for textarea
# loadurl : (for select) an url that will return the json for the select
# data : (for select) an array of options in the form [id, value]
def on_the_spot_edit(object, field, options={})
@@ -57,7 +58,10 @@ def on_the_spot_edit(object, field, options={})
elsif editable_type == :textarea
html_options[:'data-rows'] = options[:rows]
html_options[:'data-columns'] = options[:columns]
- end
+ html_options[:'data-maxlength'] = options[:maxlength]
+ else
+ html_options[:'maxlength'] = options[:maxlength]
+ end
html_options[:'data-ok'] = options[:ok_text]
html_options[:'data-cancel'] = options[:cancel_text]
html_options[:'data-tooltip'] = options[:tooltip]

0 comments on commit 43fac43

Please sign in to comment.
Something went wrong with that request. Please try again.