Git Product home page Git Product logo

cioppino.twothumbs's Introduction

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

Coverage

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.

Make sure you have installed or "Activated" the product if things aren't working as expected.

Compatibility

cioppino.twothumbs works with Plone 5.2 and 6.0, on Python 3 only. For other Plone and Python versions, see the 2.x releases.

As a Viewlet

Cioppino.TwoThumbs provides a behavior for dexterity content types. In the dexterity configuration UI, it will be listed under "Behaviors".

You may also manually add this behavior to your type by adding the following to ../path/to/profiles/default/types/your_type.xml:

...
<property name="behaviors">
    <element value="cioppino.twothumbs" />
    ...
</property>
...

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"/>

Note that this ONLY works if the browser view is in context of a content type since it requires access to content object annotations.

Migration

If you used to use plone.contentratings and want to migrate to the thumbs product, there is an example in PloneSoftwareCenter. It's pretty easy. Please see https://github.com/collective/Products.PloneSoftwareCenter/blob/master/Products/PloneSoftwareCenter/Extensions/migrateratings.py for an example. It has not been tried on Python 3 though, so maybe you need to migrate to a version supporting Python 2 first. But it is okay to try.

Anonymous Voting

Anonymous voting is possible, but weak. A unique identifier is generated and set as cookie on first vote. Then the uid is used as identifier for later display/changes. To enable anonymous voting go to Plones configuration registry, search for cioppino.twothumbs.anonymous entry and edit it. Alternativly you can add your own registry.xml to your sites profile:

<?xml version="1.0"?>
<registry>
    <record name="cioppino.twothumbs.anonymousvoting">
        <value>True</value>
    </record>
</registry>

It's easy to fake anonymous votes, so don't trust them much. A todo here is to add a captcha, which would make automated vote-faking impossible.

Bugs/Suggestions/Help

Please file bugs at https://github.com/collective/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.

cioppino.twothumbs's People

Contributors

agitator avatar agnogueira avatar andreasma avatar cguardia avatar danjacka avatar davisagli avatar eleddy avatar fredvd avatar gagaro avatar gforcada avatar hvelarde avatar jensens avatar jladage avatar mauritsvanrees avatar mpampols avatar mrtango avatar pbauer avatar rochecompaan avatar simahawk avatar sneridagh avatar tisto avatar toutpt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cioppino.twothumbs's Issues

plone.protect confirmation after enabling behavior

Seen on Plone 5.2, both on Python 2.7 and 3.7. I expect this on earlier Plone 5 versions as well, and on Plone 4 with plone4.csrffixes, but I have not tried it.

Create a Plone Site, activate twothumbs, enable the behavior on the Page content type.
Now go to the front page and you get the plone.protect page "Confirming User Action." Url is:
http://localhost:8080/Plone/@@confirm-action?original_url=http%3A%2F%2Flocalhost%3A8080%2FPlone%2Ffront-page%2Fdocument_view

So I guess the viewlet does a write-on-read when no ratings have been added yet.

Same happens when you create a new page, give it a title and save it. After edit you end up on the view, and this has the same problem. Url is:

http://localhost:8080/Plone/@@confirm-action?original_url=http%3A%2F%2Flocalhost%3A8080%2FPlone%2Fpage%2Fdocument_view

LikeWidgetView not rendered

In Plone 4.3 I need to add to like.py:

class LikeWidgetView(BrowserView):
    ...
    def render(self):
        return self.index()

    def __call__(self):
        return self.render()`
    ...

Someone else?

Travis fails at installing liblcms1-dev

The last official Travis build was from January, and it passed.
I triggered a build just now, and this is the result:

$ sudo apt-get -qq install libfreetype6-dev liblcms1-dev
E: Package 'liblcms1-dev' has no installation candidate
The command "sudo apt-get -qq install libfreetype6-dev liblcms1-dev" failed and exited with 100 during .

I don't know why this package would be needed. It was installed since the first Travis build, commit 6482bdc from 2013.

So the Travis setup needs some love.

nulltranslate has no "context" argument

Commit 740f298 changed browser/like.py file so that the "context" is passed to translator instead of "target_language". But the nulltranslator isn't updated to include "context" argument (line 121). It will break if no translator found. Please simply add it to the function like this:
def nulltranslate(msgid, target_language=None, context=None):

Thank you!

Can't get per-item thumbs?

we've tried adding 2thumbs various ways, but let's focus on adding it as a behavior to a dexterity type. while we get the 2thumbs widget on /individual/ items, we can't find a way to add it to an /enumerated/ list, whether we add it to the content item, or to a container object containing items. we want the behavior demonstrated in the http://plone.org/products/ . for extra points, how do we add a "Highest rated" option to the listing view?

upgradeSteps don't match any metadata version

The upgradeSteps in configure.zcml is from 1000 to 1001. But the metadata.xml has version from 1 to 2 (1.2 in base profile). So the upgrade in the control panel doesn't do anything.

I would like to suggest two things: first, change the metadata.xml to 1001. Second, the upgrade should also include plone5 profile's plone.app.registry to install the js and css.

This bug is not essential mostly due to the upgrade as a one-time thing. I can do the upgrade in my own buildout package. But it may confuse new users who wants to do the upgrade.

Which Plone and Python versions are supported?

The README currently says: "cioppino.twothumbs works with Plone 4.3, 5.1, 5.2. It works on Python 2.7, and for Plone 5.2 it also works on Python 3.6. Those are the versions that are automatically tested."

GitHub Actions says something different: this is only tested on Plone 5.2 and 6.0 and only on Python 3. This was done in versions 2.2.2 and 2.2.3. So either these bugfix release really dropped support for older versions, or they theoretically work, but are simply no longer getting tested.

I would say we can let master indeed be for Plone 5.2 and 6.0 and Py 3 only. This should be a new major release 3.0.0.
We can create a maintenance branch for older versions, based on version 2.2.1. We could rerelease this as version 2.2.5.

Question then is: is there a release that supports Plone 5.2 on Python 2.7? If we want to support in-place migrations, this is a must. From the changelog, I can't really tell if this is the case.
Can someone enlighten me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.