# ----------------------------------------------------------------------------- # Author: Alexander Kravets , # Slate Studio (http://www.slatestudio.com) # # Coding Guide: # https://github.com/thoughtbot/guides/tree/master/style/coffeescript # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- # INPUT STRING # ----------------------------------------------------------------------------- # Basic string input implementation, this is base class for many chr inputs. # This input also serves as a demo for implementing other input types. # # Public methods: # initialize() - run input plugin initializations if any # hash(hash) - update hash with inputs: hash[name] = value # updateValue(@value) - update inputs value # showErrorMessage(message) - show error (validation) message for input # hideErrorMessage() - hide error message # # Dependencies: #= require ../vendor/jquery.typeahead # # ----------------------------------------------------------------------------- class @InputString constructor: (@name, @value, @config, @object) -> @_create_el() @_add_label() @_add_input() @_add_placeholder() return this # PRIVATE =============================================== _safe_value: -> if typeof(@value) == 'object' return JSON.stringify(@value) else return _escapeHtml(@value) _create_el: -> @$el =$ "