Created
June 29, 2011 04:12
-
-
Save kevinpfromnm/1053091 to your computer and use it in GitHub Desktop.
example from tagglable hobo plugin (hobo 1.0.x)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autocomplete :new_tag_name do | |
post = find_instance | |
items = Tag.find(:all,:conditions => ['name LIKE ?',"%#{params[:query]}%"]).select { |i| i.viewable_by?(current_user) } | |
items = items - post.tags | |
render :text => "<ul>\n" + | |
items.map { |i| "<li>#{i.name}</li>\n" }.join + | |
"</ul>" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<def tag="tag-list"> | |
<% target = this %> | |
<h3 param="tag-heading">Tags</h3> | |
<div param="collection-wrap"> | |
<collection:taggings part="tags"> | |
<a:tag /><delete-button label="x" /> | |
</collection> | |
</div> | |
<form with="&this.taggings.new" update="tags" reset-form refocus-form param> | |
<div> | |
<label for="tagging[tag]" param>Add a tag:</label> | |
<name-one:tag complete-target="&target" completer="new_tag_name" /> | |
</div> | |
</form> | |
</def> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment