Skip to content

wbotelhos/inplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inplace - An inplace editor

CI Gem Version Maintainability Sponsor

Inplace is an tiny inplace editor to enable a quick ajax update with no need to create a form.

Options

`data-field-name`: Name of the field;
`data-field-text`: Name of the attribute of the returned JSON used to be the inplace text;
`data-field-value`: Value of the field;
`data-field-type`: Field type that can be `text` or `select`;
`data-options`: Data options setted on the field with prefix `inplace-`;
`data-url`: URL used to post the data;

Usage

You declare an element with optional data atributes:

<div
  class="inplace"
  data-attributes='{ "maxlength": 2 }'
  data-field-name="number"
  data-field-value="42"
  data-url="/update"
>42</div>

On JS you can declare attributes too, but data attributes has priority:

$('.inplace').inplace({ url: '/save' });