Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gampleman/laplace
A simple in-place editor
https://github.com/gampleman/laplace
annotated-source in-place-editor
Last synced: 24 days ago
JSON representation
A simple in-place editor
- Host: GitHub
- URL: https://github.com/gampleman/laplace
- Owner: gampleman
- Created: 2013-11-20T01:07:39.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-20T14:47:01.000Z (about 11 years ago)
- Last Synced: 2024-10-26T22:10:01.199Z (2 months ago)
- Topics: annotated-source, in-place-editor
- Language: JavaScript
- Homepage: http://code.gampleman.eu/Laplace/
- Size: 164 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Laplace
=======Laplace is meant to be a simple, but reusable in-place editor built in CoffeeScript.
It is controlled by a simple data api inspired by Bootstrap.
You can see a [quick demo](http://code.gampleman.eu/Laplace/) or read the [annotated source code](http://code.gampleman.eu/Laplace/docs/laplace.html).
### Usage
To make something editable, first give it the class `laplace`. Then set several data attributes either on the element itself, or on a parent element, or in the configuration object (in order of prefference).
`url` - Where to post updated data.
`method` - Defaults to `POST`.
`name` - Use as the forms name value.
`type` - What kind of input is this supposed to be. Supports all values of the `type` attribute for the `input` tag (except file), plus the special values of `textarea`, `select` and `radio-buttons`. `select` and `radio-buttons` also require the following to be set:
`values` - The possible values as a JSON array. Either `["value", "value", ...]` or `[["Label", "Value"], ["Label", "Value"]]` syntax is supported.
`edit-label` - The text to use for displaying the edit button. Defaults to `"Edit"`.
`save-label` - The text to use for displaying the save button. Defaults to `"Save"`.
`cancel-label` - The text to use for displaying the cancel button. Defaults to `"Cancel"`.
### Integration
Your webapp will be sent the updated value as if the user was editing a regular form and should return a response with the 200 status code and whatever the field should be displaying.
### License
Copyright 2013 by Jakub Hampl. MIT Licensed.