Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="https://github.com/mbleigh/acts-as-taggable-on" rel="noreferrer">mbleigh's acts_as_taggable_on gem</a> is a feature-complete solution that you should definitely look into a little more closely. The implementation is rock-solid and flexible to use. However, it is mostly concerned with attaching tags to objects, retrieving tags on objects, and searching for tagged items. This is all backend server stuff.</p> <p>Most of the functionality you are looking to change (based on your comments) is actually related more to your front-end UI implementation, and the gem doesn't really do much for you there. I'll take your requests one-by-one.</p> <ol> <li>If user inputs a new tag, that tag gets added, if user inputs an existing tag, the existing tag gets used. acts_as_taggable_on does this.</li> <li>Click a tag from suggested list to add that tag. This is an implementation issue - on the back-end you'll need to collect the suggested list of tags, then display those in your presentation as links to your processing function.</li> <li>Autocomplete as user enters potential tag. You'll use the jQuery autocomplete plugin against a list of items pulled off the tags table. With additional jQuery, you can capture when they've selected one of the options, or completed entering their new tag, and then call the processing function.</li> <li>Restrict users to entering only one tag. This will be your UI implementation - once they've entered or selected a tag, you process it. If they enter two words separated by a comma, then before or during processing you have to either treat it as one tag, or take only the text up to the first comma and discard the rest.</li> <li>When you process the addition of a tag, you will have to do two things. First, you'll need to handle the UI display changes to reflect that a tag has been entered/chosen. This includes placing the tag in the "seleted" area, removing it from the "available" display, updating any counters, etc. Second, you'll need to send a request to the server to actually add the tag to the object and persist that fact to the database (where the taggable gem will take over for you). You can either do this via an individual AJAX request per tag, or you can handle it when you submit the form. If the latter, you'll need a var to keep the running list of tags that have been added/removed and you'll need code to handle adding/removing values to that var.</li> </ol> <p>For an example of saving tags while editing but not sending to server/db until saving a form, you might take a look at the tagging functionality on Tumblr's new post page. You can add/remove tags at will while creating the post, but none of it goes to the database until you click save.</p> <p>As you can see, most of this is on you to determine and code, but has very little to do with the backend part. The gem will take care of that for you quite nicely.</p> <p>I hope this helps get you moving in the right direction.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload