techutopia
Total posts: 202
24 Aug 2014 13:14

Hi,

I don't want users to be able to rate in records lists, only on a record page.

But I still want the Total rating to be shown on the results lists.

I have attached picture for explanation. :-)

How do I do this?

Thanks,

Dale.

cbratings

Last Modified: 28 Aug 2014


Sergey
Total posts: 13,748
25 Aug 2014 02:28

Right now there is no psrsmeter for that. YOu can only do it with custom template. In the l ist you may call it like this.

You have ot create new multiple ratinfgt emplate here com_cobalt/views/rating_tmpls/multirating/deafult.php. Copy it. Find self::canRate(....) and change it to false if it is a list.

cahnge this

self::canRate('record', $record->user_id, $record->id, $type->params->get('properties.rate_access'), $key)

to this

JFactory::getApplication()->input->get('view') == 'records' ?  false : self::canRate('record', $record->user_id, $record->id, $type->params->get('properties.rate_access'), $key)

And set your new template in rating parametrs.


techutopia
Total posts: 202
26 Aug 2014 23:51

Thanks Sergey, your time is appreciated.

At the moment I am trying to do everything I need without altering templates.

From my point of view, I am not an advanced user and I want to be in a 'good' position for future updates - and not altering templates will make my life easier at the moment. (I'm think about Cobaly 8 updates and Cobalt 9! - :-))

Thanks again,

Dale.


pepperstreet VIP
Total posts: 3,837
27 Aug 2014 07:47

techutopia trying to do everything I need without altering templates.

CSS workaround

Go to YourSection -> General Parameters -> Templates -> Markup layout (edit default)

In template see tab -> General parameters -> Custom CSS

Enter your custom CSS rules to hide the rating table body. The important part is to target the right classes. It may depend on your main J! template. Many templates add special classes to your body tag, which include your current location and context. i.e. component, view, task, itemID etc.

e.g. the J! Protostar template. It provides com_cobalt and view-records

So, you can easily target the Cobalt list view, without altering the full article display ;)

Example CSS for Protostar

Hence the class body.view-records specific to Protostar
.table-rating tbody is the common class from Cobalt default output

body.view-records .table-rating tbody
{
  display:none;
}

@Sergey
Unfortunately, the Cobalt default templates have no specific CSS class?! A surrounding container/class would really help for quick and individual custom styling. Cobalt should output a class to identify the current "context". i.e. records-list, cob-list-view or record-full-view, cob-record etc.

Also would appreciate the support and output of J! PageClassSuffix from MenuItem parameters. ;)


Sergey
Total posts: 13,748
28 Aug 2014 11:24

techutopia From my point of view, I am not an advanced user and I want to be in a 'good' position for future updates - and not altering templates will make my life easier at the moment. (I'm think about Cobaly 8 updates and Cobalt 9! - :-))

Altering template will not lead you to any problem. You will be able to update safely.

pepperstreet Unfortunately, the Cobalt default templates have no specific CSS class?!

I think table-rating is enough.


techutopia
Total posts: 202
28 Aug 2014 12:55

Thanks.

Maybe you could put my mind at ease?

If I copy distribution templates, and then modify them ...

  • How do I keep track of changes made to the original template and know what is altered and when so I can update my copies - say, when a new feature is added?
  • If the original templates are updated is there an easy way to compare the two files - i.e. original and my altered copy?

Ta.

Dale.


pepperstreet VIP
Total posts: 3,837
28 Aug 2014 13:05

Sergey I think table-rating is enough.

For the rating template, I agree.

Actually, I was talking about the default markup, list and record templates. Having default classes + some contextual classes are a big help, and allow easy modifications WITHOUT altering templates... and even WITHOUT COPYING or OVERRIDING.

I still suggest some general classes for the outer containers. Plus some contextual classes like names/id# of section, type etc.


Sergey
Total posts: 13,748
28 Aug 2014 14:27

techutopia How do I keep track of changes made to the original template and know what is altered and when so I can update my copies - say, when a new feature is added?

You do not need to do that. We do not add features to templates. because of this problem. Even if we add those are additional parameters with you do not need in your new template anyway. If your custom template shows what you want, you do not need to know what is new in new template.

techutopia If the original templates are updated is there an easy way to compare the two files - i.e. original and my altered copy?

Only by using some local diff tools.

Powered by Cobalt