brianpat VIP
Total posts: 211
02 Feb 2015 14:37

Cobalt templates are great, but I have a feeling some of its functionalities are not highlited to end user and end user wont know about it until they login. To let user know the functionalities which will enable them to register, I have this proposal for Sergey:

Can we have some control on the backend to show Bookmark, Follow and Compare button to be shown by default on Fronend without Login.

When guest user click Bookmark or Follow, then they will directly either redirected to login page, or show a tooltip saying "please login to have this functionality" or a popus appears for login

For compare , it does not need any login

We also need a better button which clearly displays these functionalities.

I know Sergey is very busy with developments, but having this fature will distinguish cobalt from the rest.

If this is not possible, can someone advises how to do it?

Appreciate a reply at the earliest.

Last Modified: 23 Feb 2015

Tags Developer


Sergey
Total posts: 13,748
03 Feb 2015 10:48

It is possible. It the template you can find place wheer those buttons are displaied and add condition to display the same buttons (just copy/paste HTML markup and edit it) that will show tooltip or somethign like this.

For examplee those buttons in a template in

<?php if($this->user->get('id')):?>

so add another condition with

<?php if(!$this->user->get('id')):?>

brianpat VIP
Total posts: 211
03 Feb 2015 12:11

Thanks Sergey, would it be possible for you to incorporate this flag in cobalt admin backend? This should be a must functionality for cobalt. I hope you wont disappoint me.


brianpat VIP
Total posts: 211
03 Feb 2015 19:22

I changed, but I have now two problems.

1) I can see only compare button, but not other button such as favourites and follow - How can I display them and when user clicks them they will be diverted to Login Page. If user is already logged in then it will beheave as usual. 2) The other problem is compare button is not static, means if you put ur cursor, then only shows, otherwise it doesnot. How can I alsways show this compare button all the time?


brianpat VIP
Total posts: 211
03 Feb 2015 22:40

I also noticed that after changnging as per the suggestion, I do not see all these options on list pagen after you log in. So the above logic does not work.


Sergey
Total posts: 13,748
04 Feb 2015 04:12

brianpat Thanks Sergey, would it be possible for you to incorporate this flag in cobalt admin backend?

What do you mean? Create such a parameter for templates?

brianpat I changed, but I have now two problems.

You changed that? Or you added new condition?


brianpat VIP
Total posts: 211
04 Feb 2015 08:50

Sergey

brianpat Thanks Sergey, would it be possible for you to incorporate this flag in cobalt admin backend?

What do you mean? Create such a parameter for templates? yes which will control this.

brianpat I changed, but I have now two problems.

You changed that? Or you added new condition?

i changed the syntax as per your suggestion, i just replaced it to <?php if(!$this->user->get('id')):?>, but now i cant even see the buttons when you logged in


Sergey
Total posts: 13,748
05 Feb 2015 04:09

I suggested not to change but add new condition. What you have already in template works nice. You only need to add dummy buttons when user is nto logged in. So you have to add somethign like this.

<?php if(!$this->user->get('id')):?>
   <a href="/ http://site/login " class="btn btn-micro">
       <img src="/media/bookmark.png">
   </a>
<?php endif; ?>

Of course path to picture is worng. this is just an idea. So when user logged in he see block that is there now and when not logged in he see this block with dummy buttons.


brianpat VIP
Total posts: 211
05 Feb 2015 09:01

Thanks, I got your points. But then how can I show compare button on both occasion, like to show compare button when user is not logged in and also to show compare button when user is logged in?

Also how can I show the static compare button means will be there all the time whether you put your cursor to that record or not. Now it is showing only when you put your cursor. The problem with this now is the compare button does not display within the record area on list page. It displays bit above and when you put the cursor, it disappears. Probably it is a bug.


Sergey
Total posts: 13,748
05 Feb 2015 10:23

Group all conditions in one btn-group class. First show compage button then conditions

.btn-group
   compare
   if user
       button for logget in user
   if !user
       button for non logged in user.

brianpat The problem with this now is the compare button does not display within the record area on list page. It displays bit above and when you put the cursor, it disappears. Probably it is a bug.

This is depends on your Joomla template. Give me the link to see.


brianpat VIP
Total posts: 211
13 Feb 2015 14:43

I follwed the approach, but I have now one issue with it.

I created the button compare but, it is showing with extra spaces.

Here is the code:

<?php if(!$this->user->get('id')):?>
    <a href="/index.php?option=com_users&view=login">
        <img alt="Follow" src="/<?php echo JURI::root(TRUE)?>/media/mint/icons/follow.gif" data-original-title="Follow this property and get Notification, You need to Login to do it" rel="tooltip">
    </a>
    <a href="/jlatest/index.php?option=com_users&view=login">
    <img alt="Bookmark" src="/<?php echo JURI::root(TRUE)?>/media/mint/icons/bookmark.gif" data-original-title="Save this Property and Track, You need to Login to do it" rel="tooltip">
    </a>
    <?php echo HTMLFormatHelper::compare($item, $this->submission_types[$item->type_id], $this->section);?>
<?php endif; ?>

I found out that this is due to the class btn-min in html.php in cobalt library on line number 433

return sprintf('<a class="btn btn-co-control btn-mini%s" id="compare_%d" type="button" onclick="Cobalt.CompareRecord(%d, %d);">%s</a>',

Any idea how can I fix this? follow


pepperstreet VIP
Total posts: 3,837
13 Feb 2015 15:46

Since it is added in the core files, I would suggest to fix it in your template...:

Either keep the current output and try to change the appearance with CSS.
Maybe you can add an extra CSS class to your button group? So, you can target the specific inner button class... and override its style.

Or by PHP before you output the compare button. Most likely preg_replace or simpler str_replace should work.


Sergey
Total posts: 13,748
16 Feb 2015 10:43

You can override CSS properties you do not like. Or replace btn-mini like this

<?php 
$btn = HTMLFormatHelper::compare($item, $this->submission_types[$item->type_id], $this->section);
echo str_replace('btn-mini', '', $btn);
?>

brianpat VIP
Total posts: 211
16 Feb 2015 21:42

will i place it on html.php? I dont want to change this core file.


pepperstreet VIP
Total posts: 3,837
17 Feb 2015 00:10

brianpat will i place it on html.php? I dont want to change this core file.

Nope. Just in your custom template. See your previous code snippet where you output the compare button...

<?php echo HTMLFormatHelper::compare($item, $this->submission_types[$item->type_id], $this->section);?>

Replace it with the 2 lines from Sergey.

The difference and logic is:

  • First line puts the whole compare-button code in $btn,
  • Second line removes the CSS class (replaces the btn-mini with nothing '' ).
  • Outputs your button (echo)

brianpat VIP
Total posts: 211
17 Feb 2015 10:47

it still does not work. It shows little bigger background button. no idea why?

imag2


brianpat VIP
Total posts: 211
17 Feb 2015 10:50

i got it fixed by adding the whole class name by the following

<?php 
                            $btn = HTMLFormatHelper::compare($item, $this->submission_types[$item->type_id], $this->section);
                            echo str_replace('btn btn-co-control btn-mini', 'nothing', $btn);
                            ?>

brianpat VIP
Total posts: 211
17 Feb 2015 11:31

I have another question. Can I display compare button on record page?


Sergey
Total posts: 13,748
18 Feb 2015 05:55

brianpat I have another question. Can I display compare button on record page?

No.


pepperstreet VIP
Total posts: 3,837
19 Feb 2015 02:43

Sergey No.

I am surprised. Why not?


brianpat VIP
Total posts: 211
19 Feb 2015 09:13

I am also very much surprised. dont understand why this is designed this way/

Powered by Cobalt