Cioppino Two Thumbs

by Elizabeth Leddy last modified May 16, 2012 12:11 AM

Rating widget based on thumbs up and down.

Project Description

Cioppino Two Thumbs

Introduction

This will add those terribly "delish" little thumbs all over facebook to products of your choosing. By default, only logged in users can rate a product, and once they are logged in they can vote once (and change their vote at any time)

Installation

Your mission, should you choose to accept it is to add the package to your buildout config and rerun buildout. If you want it as a viewlet below the content title, you must follow the viewlet directions below before restarting and installing. Otherwise install immediately and then skip to the section on browser views.

As a Viewlet

Then, in the configure.zcml in the base of your product you need to tell which content types should display the thumbs. For example, with the PloneSoftwareCenter product, the configure.zcml has the lines:

<include package="cioppino.twothumbs" />
<class class=".content.project.PSCProject">
   <implements interface="cioppino.twothumbs.interfaces.ILoveThumbsDontYou" />
</class>

That little diddy would add the thumbs viewlet to the PSCProject product only. You only need to include the package 1 time but you need to add the class block for every content type you would like to show the thumbs.

As a Browser View

Additionally, you can generate the widget on any content page in any place by just adding a few lines to your template:

<div tal:content="structure here/@@rate-if-you-dare"/>

Migration

If you used to use plone.contentratings and want to migrate to the thumbs product, there is an example in the trunk of PloneSoftwareCenter. It's pretty easy. Please see http://svn.plone.org/svn/collective/Products.PloneSoftwareCenter/tags/1.6.1/Products/PloneSoftwareCenter/Extensions/migrateratings.py for an example.

Bugs/Suggestions/Help

Please file bugs at https://github.com/eleddy/cioppino.twothumbs.

Credits

This product was initially developed at the Plone Cioppino Sprint in Bodega Bay 2011. The source code is filled with plenty of inside jokes and may only be maintainable after drinking copious numbers of Manhattans. Without the [drink] support of everyone there, this may not have been made possible. Big ups.

Changelog

1.4 (2012-05-15)

  • German translation added. [jensens]
  • Add support for Plone 3 [rochecompaan]
  • Enable use of the twotumbs widget outside the content div [rochecompaan]

1.3 (2011-09-22)

  • Turn thumbs background images into a sprite [marcosfromero]
  • Improve accessibility: non AJAX/JavaScript support [marcosfromero]
  • Improve i18n and added new Spanish translations [marcosfromero]
  • Improve feedback for anonymous users and after voting [marcosfromero]

1.2 (2011-05-27)

  • Initial i18n and Spanish translation [hvelarde]

1.1 (2011-02-15)

  • switch to absolute patch for form actions since it breaks when under the influence of rewriting [eleddy]

1 (2011-02-14)

  • Initial release [eleddy on code, spanktar on graphics]

Current Release
cioppino.twothumbs 1.4

Released May 16, 2012 — tested with Plone 4.1, Plone 4, Plone 3

plone 3 and german translations
More about this release…

Download file Get Cioppino Two Thumbs for all platforms
cioppino.twothumbs-1.5.tar.gz
If you are using Plone 3.2 or higher, you probably want to install this product with buildout. See our tutorial on installing add-on products with buildout for more information.

All Releases

Version Released Description Compatibility Licenses Status
1.4 May 16, 2012 plone 3 and german translations More about this release…
Plone 4.1
Plone 4
Plone 3
GPL final
1.2 Jun 01, 2011 Spanish translation is here and se te caerán los pantalones! OK, maybe it's not THAT awesome but we sure tried. Come and get it! More about this release…
Plone 4
GPL final
1.1 Feb 16, 2011 Bug fixes. More about this release…
Plone 4
GPL final
1 Feb 15, 2011 Initial Release More about this release…
Plone 4
GPL final

Comments (2)

Serhat Sevki Dincer Apr 20, 2011 03:38 PM
so as I understand, in order to add twothumbs widget to a page we have to use the zope interface. I want to let the users of my site to freely/easily enable twothumbs-rating of any element/page that they own. how do i do that?

Note: as i discovered, appending "/manage_interfaces" will provide a page to do that for normal users, but that page is just scary, and even I want to disable that and have a menu item like "Display>TwoThumbs". Is this possible?
Elizabeth Leddy Apr 20, 2011 04:26 PM
Hi Serhat - Currently it doesn't do this but it would be trivial-ish to add such a thing. You should just be able to dynamically mark the interface for the content type (see http://collective-docs.plon[…]interfaces-programmatically). Currently it only sets and unsets for an entire content type.

As for the display menu, not sure how that would work. I would recommend maybe just adding a "allow product to be rated" box to the content type. ping me in #plone (eleddy) if you want to talk about how to do this. Would love to have your contributions to the product!