From: Michael P. <mp...@pl...> - 2012-08-03 14:11:18
|
Hello all, If you've been following krang-svn you would have noticed a lot of commits by me in the past few weeks that all deal with adding tags to Krang stories and media. I should have discussed this earlier in case anyone had some input/feedback but I have to admit that I let real life get in the way (vacations, traveling, conferences, court case, work deadlines, misbehaving internet connections, etc). So I'm trying to rectify that situation now :) Basically it adds simple tags story and media that can be accessed like @tags = $story->tags; @tags = $media->tags; And updated like so: $story->tags(['foo', 'bar']); $media->tags([]); And searched like: @stories = Krang::Story->find(tag => 'foo'); David Kaufman asked me off list what are the benefits/differences between these tags and having tags in your element library. We actually used element library tags for a long time and those worked pretty well. But here a couple of places where they fell short and where the new tags will work better: * Elements, while searchable in code aren't searchable in the UI because they are custom to each setup. These new tags are available for searching on the advanced tabs of the find screens for stories and media. * Not as easy to use. Compare @tags = $story->element->child_data('tags') and @tags = $story->tags(); And it's not just from the Perl code, but from SQL as well since tags are stored in story_tag or media_tag table and can be manipulated much more easily than if they are stored as Storable array binary blobs in the element table. * Tagging has become pretty universal in web systems, especially CMSs and it's a shame that each element library would need to re-invent this wheel. This also makes them more prominent on the edit screens in the same spot as title and slug instead of possibly buried under a complex element that needs an extra step to edit. * Easier to extend via addons. Our main addon extends Krang with lots of other objects (Events, Groups, Mailings, Contributions, etc) and we wanted to tag those as well. And we've written a UI to manage these tags across all of these different objects. This would have been hard to do if updating a tag meant crawling through lots of stories and updating their elements. Instead we use some pretty simple SQL to manipulate them. So please try it out and tell me what you think? I'm planning on tagging a version for 3.21 so that we can test it out this weekend. -- Michael Peters Plus Three, LP |