jquery.amend
jQuery plugin to add amendments to a text
##Requirements##
- text clearly divided into identified parts (using custom attribute)
- persistance system to store data (create and delete functions)
- google-diff-match-patch library to visualize amendments
##How to use##
$(selector).amend(options, data);
###options###
- attrname (optional): html attribute containing text id ("data-reference" by default)
- auto (optional): show amend form when user clicks on text (false by default)
- container (optional): custom amendments container (optional)
- fields: custom amendment fields map ~ data structure (see default opts)
- listeners: collection of listeners (see Events section)
- statuses (optional): custom amendment status map (see default opts)
- style (optional): custom class names for form elements (see default opts)
- t (optional): translate function with text as 1st argument and tag as 2nd (optional)
###data###
A list of amendments, each amendment should contain:
- id: amendment unique id
- reference: original text id
- amendment: new text
- reason: amendment's justification
- author: username
- status: "pending", "approved" or "rejected"
##Events##
- jqa-toggle: listens to expand/collapse amendments trigger
- jqa-render: listens to render amendments trigger
- jqa-counter: triggered when amendments counter has been updated
- jqa-new: listens to add amendment / new text trigger
- jqa-ready: triggered when amendment / new text form has been rendered
- jqa-submit: triggered when data form has been submitted
- jqa-cancel: triggered when any form has been canceled
- jqa-confirm: triggered when confirm form has been submitted
- jqa-success: triggered when success callback ends
- jqa-rendered: triggered when amendment / new text has been rendered
##HTML and style##
- HTML should contain only headers and paragraphs identified by custom attribute (see an example at index.html)
- CSS could be customized using style config and library specific selectors (see jquery.amend.css)
##Available translations##
- "Add new text inside"
- "Send"
- "Cancel"
- "Delete text"
- "Amendment"
- "Reason"
- "Name"
- "Confirm"
- "sent by"
- "anonymous"