Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2015-09-01 04:43:14

mikeelbon
Member
From: United Kingdom
Registered: 2015-08-12
Posts: 34
Website

clear rating option

Hi all.
I have come accross a problem when using ratings.

You are ( or client) are able to select either 1 to 5 stars. but if you change your mind there is no way to set it back to 0 again. Does someone have a solution to this - perhaps when 5 stars are selected (or 1 star for example) and you select 5 stars again (or one star again)  it changes them to zero?

Any help much appreciated

Offline

#2 2015-09-01 05:40:00

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: clear rating option

as far as I can tell, after you've clicked "Save" there's no way to get the star rating back to zero. Otherwise you can just click cancel and start over with feedback for that particular image.

Looks like the feedback dialog could use a "clear ratings" link like Ben came up with for selecting all or none in the gallery as a whole.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#3 2015-09-01 07:42:24

mikeelbon
Member
From: United Kingdom
Registered: 2015-08-12
Posts: 34
Website

Re: clear rating option

I think that it may be possible to address it by altering the template_index.php  and effectively adding a zero option and the style-component.css but not certain. I think that this may look a bit messy though.


Has anyone already got a solution to this?

Offline

#4 2015-09-01 08:13:20

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: clear rating option

Has anyone already got a solution to this?

Not that I know of.

Give Matt and Ben a chance to look it over. They're the ones who will come up with a solution.


I don't think that css file is the place to change things since the feedback form is generated with jQuery and css only styles what's there, it's not adding content.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#5 2015-09-01 10:30:43

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: clear rating option

This is something that would need changes to the CRG JavaScript and a button to clear the ratings.

Offline

#6 2015-09-02 05:11:23

mikeelbon
Member
From: United Kingdom
Registered: 2015-08-12
Posts: 34
Website

Re: clear rating option

Hi I would like to see the stars working as they do in lightroom where if it has the value of 1 star and you click the one star it becomes no stars.

I have tried to understand the javascript but my coding isn't that good. I can see in the jquery.ttgcrg-ce4.js script it has a section // Star Ratings Widget - from line from line 548 to 588. In this I can see how, when hovered, it removes the styling of those to the right  and adds the yellow styling to those before and the one you are hovering over. there is also a section on when clicked it sets the styling to black for those below and itself and then removes styling of those above.

What I can't find is how to find the current value of the star rating. You could then check to see if the current selection is the same and then remove styling from all.

Any help much appreciated.

Offline

#7 2015-09-02 05:42:20

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: clear rating option

I'd sit tight and see what Ben comes up with.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#8 2015-09-02 06:52:52

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: clear rating option

That's a good way of doing it.  Changing lines 574 to 577, from this:

    var rating = $(star).data('score');

    $(widget).find('.star_' + rating).prevAll().andSelf().addClass('ratings_vote');
    $(widget).find('.star_' + rating).nextAll().removeClass('ratings_vote'); 

to this:

    var rating = $(star).data('score');
    if (rating == ttgCrg.responses[ttgCrg.active_photo_id].rating) {
        rating = 0;
        $(widget).find('.ratings_stars').removeClass('ratings_vote');
    } else {
        $(widget).find('.star_' + rating).prevAll().andSelf().addClass('ratings_vote');
        $(widget).find('.star_' + rating).nextAll().removeClass('ratings_vote'); 
    }

should do the job.  Let us know how that goes and we'll add it into CRG.

Offline

#9 2015-09-02 07:12:58

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: clear rating option

Works like a charm Ben!


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#10 2015-09-02 07:37:24

mikeelbon
Member
From: United Kingdom
Registered: 2015-08-12
Posts: 34
Website

Re: clear rating option

Ben you guru!

I have been playing with this alot today I had managed to get the hover to work but not the rest and it is so simple. Thank you so much. I think this is how it should be set up for everyone. Has Matt seen this?

Offline

#11 2015-09-02 07:58:52

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: clear rating option

Yes. I have already merged that code into the CRG code base.

The trick with that change was that the usual blanking of stars doesn't work with a starting index of 0.

Offline

#12 2015-09-17 07:12:44

mikeelbon
Member
From: United Kingdom
Registered: 2015-08-12
Posts: 34
Website

Re: clear rating option

Good to see that this has made it in to the latest update.
Thanks again,
Mike

Offline

#13 2015-09-17 21:18:11

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: clear rating option

I'm glad to have that in.  Thanks for the suggestion!

Offline

#14 2015-09-30 21:44:13

mikeelbon
Member
From: United Kingdom
Registered: 2015-08-12
Posts: 34
Website

Re: clear rating option

Just an update on this.
I have noticed that if you change a star rating and then click cancel it doesn't go back to the original setting. Any thoughts on this?

Offline

#15 2015-09-30 23:03:17

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: clear rating option

Hi Mike,  well-spotted.  A bit of a quirk.  The rating isn't actually saved unless you click 'Save'.  So the issue is that the displayed value is held, despite clicking 'Cancel'.

Offline

#16 2015-10-01 18:05:23

mikeelbon
Member
From: United Kingdom
Registered: 2015-08-12
Posts: 34
Website

Re: clear rating option

When selecting/ unselected the option boxes and then cancel they return to their previous value. The ratings currently don't work in the same way. I've had a quick look at the code but no joy yet in finding the solution.
Mike

Offline

#17 2015-10-01 18:55:49

mikeelbon
Member
From: United Kingdom
Registered: 2015-08-12
Posts: 34
Website

Re: clear rating option

Just a bit more of an update.

scenario:
step1 :  A client selects an image and clicks five stars and option one
step 2: They then log out.
step 3:They log back in
step 4: Go to image and change the image rating to one star and option two but click cancel.
step 5 :  They then go back into image and it shows one star (Quirk) and option one.
step6: If they log out at this point and
step 7: log back in
step 8: Go back to image it shows 5 stars and option 1.

So it is very confusing at the moment and needs a solution. Step 5 should show five stars

I hope this makes it clearer to what is happening.

Last edited by mikeelbon (2015-10-01 18:57:15)

Offline

#18 2015-10-02 22:13:08

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: clear rating option

Thanks Mike.

I can see what's going on, and have a strategy to fix it, but the code isn't working: fixing one aspect of it breaks another, and vice versa.  I'll keep working on it.

Offline

#19 2015-10-03 10:47:38

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: clear rating option

We've released CRG 6.1.1a, which addresses this.  The only changed file is: ttg-be/crg/lib/js/jquery.ttgcrg-ce4.js

Offline

#20 2015-10-03 19:22:47

mikeelbon
Member
From: United Kingdom
Registered: 2015-08-12
Posts: 34
Website

Re: clear rating option

Thanks for you speedy solution to this!!!
Mike

Offline

Board footer

Powered by FluxBB