Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

Tag edit support #65

Merged
merged 6 commits into from
Nov 30, 2012
Merged

Tag edit support #65

merged 6 commits into from
Nov 30, 2012

Commits on Nov 14, 2012

  1. Implemented tags edit feature, added a couple of fixes.

    Details:
    
    small fixes:
    1. 'style' is now cleared after highlight animation, so it no longer messes with other things you want to style.
    
    features:
    1. each tag label is now marked as 'tagit-label' class - simplifies use of ellipsis for tags and etc.
    2. option 'editable', methods _edit and _postEdit were added
    
    Edit logic:
    if 'editable=true' click on a tag:
      - hides corresponding tagit-label using class 'hidden'
      - adds an input with class 'tagit-edit' and width of hidden tagit-label.
      - adds 'edited' class to parent 'tagit-choice'
      - selects tag label text in added input by call to .select()
    'blur' call of that added input:
      - uses only first available value - line is splitted with _splitAt and first value is used
      - if value is identical to old tag label - editing finished, nothing changed, all inputs and classes removed
      - otherwise tries to add a new tag with _addTag. If fails (eg. tag with same value already exists) - stays at edit state
      - if _addTag succeeds:
        - new tag is added at the end of tagsArray
        - removes old tag with _popTag and removes corresponding DOM element
        - moves last added tag to the place where old tag was with 'insertBefore' and _moveTag
        - fires 'tagsChanged' if it's present
        - finished editing process by removing inputs and classes like 'edited' and 'hidden'
    
    Anyway, all this is in code, some comments were also added.
    With lots of css changes for tagit in my project I wasn't able to add sample styles for: 'tagit-edit', 'hidden', 'edited', 'tagit-label'
    I hope you will figure our yourself how to style these parts.
    
    Changes were also added to tagit-themeroller, although weren't tested, so be careful when using.
    Anton Averin committed Nov 14, 2012
    Configuration menu
    Copy the full SHA
    d28d0a3 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2012

  1. a fix for case when there are only 2 tags present

    Anton Averin committed Nov 15, 2012
    Configuration menu
    Copy the full SHA
    e64d111 View commit details
    Browse the repository at this point in the history
  2. triggerKeys support added for edit input

    Anton Averin committed Nov 15, 2012
    Configuration menu
    Copy the full SHA
    b4fa087 View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2012

  1. added missing var init

    Bugfix:
    timeout is now cleared on destroy, doesn't causing an error when we go to another page and _addTag is called some time later, resultsing in a js error
    Anton Averin committed Nov 16, 2012
    Configuration menu
    Copy the full SHA
    9635056 View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2012

  1. fixed bug in finish editing

    added support of triggerKeys for editing
    Anton Averin committed Nov 27, 2012
    Configuration menu
    Copy the full SHA
    b6c1f45 View commit details
    Browse the repository at this point in the history
  2. fixed styles and added editable test to demo page

    Anton Averin committed Nov 27, 2012
    Configuration menu
    Copy the full SHA
    c61a0a6 View commit details
    Browse the repository at this point in the history