Added html autocomplete="off" feature to input fields.
This commit is contained in:
parent
84e98e4b2c
commit
8b858dad99
|
@ -52,7 +52,7 @@ class App.Controller extends Spine.Controller
|
||||||
for attribute in attributes
|
for attribute in attributes
|
||||||
|
|
||||||
if !attribute.readonly && ( !data.required || data.required && attribute[data.required] )
|
if !attribute.readonly && ( !data.required || data.required && attribute[data.required] )
|
||||||
|
|
||||||
# set autofocus
|
# set autofocus
|
||||||
if autofocus is 1
|
if autofocus is 1
|
||||||
attribute.autofocus = 'autofocus'
|
attribute.autofocus = 'autofocus'
|
||||||
|
@ -69,18 +69,24 @@ class App.Controller extends Spine.Controller
|
||||||
attribute.multiple = 'multiple'
|
attribute.multiple = 'multiple'
|
||||||
else
|
else
|
||||||
attribute.multiple = ''
|
attribute.multiple = ''
|
||||||
|
|
||||||
# set autocapitalize option
|
# set autocapitalize option
|
||||||
if attribute.autocapitalize is undefined || attribute.autocapitalize
|
if attribute.autocapitalize is undefined || attribute.autocapitalize
|
||||||
attribute.autocapitalize = ''
|
attribute.autocapitalize = ''
|
||||||
else
|
else
|
||||||
attribute.autocapitalize = 'autocapitalize="off"'
|
attribute.autocapitalize = 'autocapitalize="off"'
|
||||||
|
|
||||||
|
# set autocomplete option
|
||||||
|
if attribute.autocomplete is undefined
|
||||||
|
attribute.autocomplete = ''
|
||||||
|
else
|
||||||
|
attribute.autocomplete = 'autocomplete="' + attribute.autocomplete + '"'
|
||||||
|
|
||||||
# set value
|
# set value
|
||||||
if data.params
|
if data.params
|
||||||
if attribute.name of data.params
|
if attribute.name of data.params
|
||||||
attribute.value = data.params[attribute.name]
|
attribute.value = data.params[attribute.name]
|
||||||
|
|
||||||
# set default value
|
# set default value
|
||||||
else
|
else
|
||||||
if 'default' of attribute
|
if 'default' of attribute
|
||||||
|
@ -92,21 +98,21 @@ class App.Controller extends Spine.Controller
|
||||||
# add item
|
# add item
|
||||||
item = $( @formGenItem(attribute, data.model.className) )
|
item = $( @formGenItem(attribute, data.model.className) )
|
||||||
item.appendTo(fieldset)
|
item.appendTo(fieldset)
|
||||||
|
|
||||||
# if password, add confirm password item
|
# if password, add confirm password item
|
||||||
if attribute.type is 'password'
|
if attribute.type is 'password'
|
||||||
|
|
||||||
attribute.display = attribute.display + ' (confirm)'
|
attribute.display = attribute.display + ' (confirm)'
|
||||||
attribute.name = attribute.name + '_confirm';
|
attribute.name = attribute.name + '_confirm';
|
||||||
|
|
||||||
item = $( @formGenItem(attribute, data.model.className) )
|
item = $( @formGenItem(attribute, data.model.className) )
|
||||||
item.appendTo(fieldset)
|
item.appendTo(fieldset)
|
||||||
|
|
||||||
# return form
|
# return form
|
||||||
return form.html()
|
return form.html()
|
||||||
|
|
||||||
formGenItem: (attribute, classname) ->
|
formGenItem: (attribute, classname) ->
|
||||||
|
|
||||||
# create item id
|
# create item id
|
||||||
attribute.id = classname + '_' + attribute.name
|
attribute.id = classname + '_' + attribute.name
|
||||||
|
|
||||||
|
@ -144,7 +150,7 @@ class App.Controller extends Spine.Controller
|
||||||
|
|
||||||
# check all filter values as array
|
# check all filter values as array
|
||||||
for value in filter[key]
|
for value in filter[key]
|
||||||
|
|
||||||
# if it's matching, use it for selection
|
# if it's matching, use it for selection
|
||||||
if record[key] is value
|
if record[key] is value
|
||||||
list.push record
|
list.push record
|
||||||
|
@ -153,7 +159,7 @@ class App.Controller extends Spine.Controller
|
||||||
|
|
||||||
# build options list
|
# build options list
|
||||||
list.forEach( (item) =>
|
list.forEach( (item) =>
|
||||||
|
|
||||||
# if active or if active doesn't exist
|
# if active or if active doesn't exist
|
||||||
if item.active || !( 'active' of item )
|
if item.active || !( 'active' of item )
|
||||||
name = '???'
|
name = '???'
|
||||||
|
@ -180,7 +186,7 @@ class App.Controller extends Spine.Controller
|
||||||
if attribute.options
|
if attribute.options
|
||||||
for record in attribute.options
|
for record in attribute.options
|
||||||
if typeof attribute.value is 'string' || typeof attribute.value is 'number' || typeof attribute.value is 'boolean'
|
if typeof attribute.value is 'string' || typeof attribute.value is 'number' || typeof attribute.value is 'boolean'
|
||||||
|
|
||||||
# if name or value is matching
|
# if name or value is matching
|
||||||
if record.value.toString() is attribute.value.toString() || record.name.toString() is attribute.value.toString()
|
if record.value.toString() is attribute.value.toString() || record.name.toString() is attribute.value.toString()
|
||||||
record.selected = 'selected'
|
record.selected = 'selected'
|
||||||
|
@ -201,7 +207,7 @@ class App.Controller extends Spine.Controller
|
||||||
{ name: 'active', value: true }
|
{ name: 'active', value: true }
|
||||||
{ name: 'inactive', value: false }
|
{ name: 'inactive', value: false }
|
||||||
]
|
]
|
||||||
|
|
||||||
# update boolean types
|
# update boolean types
|
||||||
for record in attribute.options
|
for record in attribute.options
|
||||||
record.value = '{boolean}::' + record.value
|
record.value = '{boolean}::' + record.value
|
||||||
|
@ -210,7 +216,7 @@ class App.Controller extends Spine.Controller
|
||||||
for record in attribute.options
|
for record in attribute.options
|
||||||
if record.value is '{boolean}::' + attribute.value
|
if record.value is '{boolean}::' + attribute.value
|
||||||
record.selected = 'selected'
|
record.selected = 'selected'
|
||||||
|
|
||||||
# return item
|
# return item
|
||||||
item = App.view('generic/select')( attribute: attribute )
|
item = App.view('generic/select')( attribute: attribute )
|
||||||
|
|
||||||
|
@ -221,19 +227,19 @@ class App.Controller extends Spine.Controller
|
||||||
# checkbox
|
# checkbox
|
||||||
else if attribute.tag is 'checkbox'
|
else if attribute.tag is 'checkbox'
|
||||||
item = App.view('generic/checkbox')( attribute: attribute )
|
item = App.view('generic/checkbox')( attribute: attribute )
|
||||||
|
|
||||||
# radio
|
# radio
|
||||||
else if attribute.tag is 'radio'
|
else if attribute.tag is 'radio'
|
||||||
item = App.view('generic/radio')( attribute: attribute )
|
item = App.view('generic/radio')( attribute: attribute )
|
||||||
|
|
||||||
# textarea
|
# textarea
|
||||||
else if attribute.tag is 'textarea'
|
else if attribute.tag is 'textarea'
|
||||||
item = App.view('generic/textarea')( attribute: attribute )
|
item = App.view('generic/textarea')( attribute: attribute )
|
||||||
|
|
||||||
# autocompletion
|
# autocompletion
|
||||||
else if attribute.tag is 'autocompletion'
|
else if attribute.tag is 'autocompletion'
|
||||||
item = App.view('generic/autocompletion')( attribute: attribute )
|
item = App.view('generic/autocompletion')( attribute: attribute )
|
||||||
|
|
||||||
a = ->
|
a = ->
|
||||||
# if attribute.relation && App[attribute.relation]
|
# if attribute.relation && App[attribute.relation]
|
||||||
# @log '1312312333333333333', App[attribute.relation]
|
# @log '1312312333333333333', App[attribute.relation]
|
||||||
|
@ -286,7 +292,7 @@ class App.Controller extends Spine.Controller
|
||||||
# get all params of the form
|
# get all params of the form
|
||||||
formParam: (form, errors) ->
|
formParam: (form, errors) ->
|
||||||
param = {}
|
param = {}
|
||||||
|
|
||||||
# find form based on sub elements
|
# find form based on sub elements
|
||||||
if $(form).children()[0]
|
if $(form).children()[0]
|
||||||
form = $(form).children().parents('form')
|
form = $(form).children().parents('form')
|
||||||
|
@ -294,13 +300,13 @@ class App.Controller extends Spine.Controller
|
||||||
# find form based on parents next <form>
|
# find form based on parents next <form>
|
||||||
else if $(form).parents('form')[0]
|
else if $(form).parents('form')[0]
|
||||||
form = $(form).parents('form')
|
form = $(form).parents('form')
|
||||||
|
|
||||||
# find form based on parents next <form>, not really good!
|
# find form based on parents next <form>, not really good!
|
||||||
else if $(form).parents().find('form')[0]
|
else if $(form).parents().find('form')[0]
|
||||||
form = $(form).parents().find('form')
|
form = $(form).parents().find('form')
|
||||||
else
|
else
|
||||||
@log 'ERROR, no form found!', form
|
@log 'ERROR, no form found!', form
|
||||||
|
|
||||||
for key in form.serializeArray()
|
for key in form.serializeArray()
|
||||||
if param[key.name]
|
if param[key.name]
|
||||||
if typeof param[key.name] is 'string'
|
if typeof param[key.name] is 'string'
|
||||||
|
@ -379,7 +385,7 @@ class App.Controller extends Spine.Controller
|
||||||
object[row.name] = {
|
object[row.name] = {
|
||||||
name: '-',
|
name: '-',
|
||||||
}
|
}
|
||||||
|
|
||||||
# if no content exists, try firstname/lastname
|
# if no content exists, try firstname/lastname
|
||||||
if !object[row.name]['name']
|
if !object[row.name]['name']
|
||||||
if object[row.name]['firstname'] || object[row.name]['lastname']
|
if object[row.name]['firstname'] || object[row.name]['lastname']
|
||||||
|
@ -396,7 +402,7 @@ class App.Controller extends Spine.Controller
|
||||||
object[row.name] = {
|
object[row.name] = {
|
||||||
name: '????',
|
name: '????',
|
||||||
}
|
}
|
||||||
|
|
||||||
# execute callback on content
|
# execute callback on content
|
||||||
if row.callback
|
if row.callback
|
||||||
object[row.name]['name'] = row.callback(object[row.name]['name'])
|
object[row.name]['name'] = row.callback(object[row.name]['name'])
|
||||||
|
|
|
@ -14,7 +14,7 @@ class App.User extends App.Model
|
||||||
{ name: 'street', display: 'Street', tag: 'input', type: 'text', limit: 100, null: true, class: 'xlarge', signup: false, quick: true, info: true },
|
{ name: 'street', display: 'Street', tag: 'input', type: 'text', limit: 100, null: true, class: 'xlarge', signup: false, quick: true, info: true },
|
||||||
{ name: 'zip', display: 'Zip', tag: 'input', type: 'text', limit: 100, null: true, class: 'xlarge', signup: false, quick: true, info: true },
|
{ name: 'zip', display: 'Zip', tag: 'input', type: 'text', limit: 100, null: true, class: 'xlarge', signup: false, quick: true, info: true },
|
||||||
{ name: 'city', display: 'City', tag: 'input', type: 'text', limit: 100, null: true, class: 'xlarge', signup: false, quick: true, info: true },
|
{ name: 'city', display: 'City', tag: 'input', type: 'text', limit: 100, null: true, class: 'xlarge', signup: false, quick: true, info: true },
|
||||||
{ name: 'password', display: 'Password', tag: 'input', type: 'password', limit: 50, null: true, class: 'xlarge', signup: true, quick: false, },
|
{ name: 'password', display: 'Password', tag: 'input', type: 'password', limit: 50, null: true, autocomplete: 'off', class: 'xlarge', signup: true, quick: false, },
|
||||||
{ name: 'organization_id', display: 'Organization', tag: 'select', multiple: false, nulloption: true, null: true, relation: 'Organization', class: 'xlarge' },
|
{ name: 'organization_id', display: 'Organization', tag: 'select', multiple: false, nulloption: true, null: true, relation: 'Organization', class: 'xlarge' },
|
||||||
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true, class: 'xlarge', quick: true, info: true },
|
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true, class: 'xlarge', quick: true, info: true },
|
||||||
{ name: 'role_ids', display: 'Roles', tag: 'checkbox', multiple: true, null: false, relation: 'Role', class: 'xlarge' },
|
{ name: 'role_ids', display: 'Roles', tag: 'checkbox', multiple: true, null: false, relation: 'Role', class: 'xlarge' },
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<input id="<%= @attribute.id %>" type="<%= @attribute.type %>" name="<%= @attribute.name %>" value="<%= @attribute.value %>" class="<%= @attribute.class %>" <%= @attribute.required %> <%= @attribute.autofocus %> <%- @attribute.autocapitalize %>/>
|
<input id="<%= @attribute.id %>" type="<%= @attribute.type %>" name="<%= @attribute.name %>" value="<%= @attribute.value %>" class="<%= @attribute.class %>" <%= @attribute.required %> <%= @attribute.autofocus %> <%- @attribute.autocapitalize %> <%- @attribute.autocomplete %>/>
|
Loading…
Reference in a new issue