Only show view link to administrators with old-card merge

16 views
Skip to first unread message

Jake K

unread,
Apr 27, 2012, 9:53:17 PM4/27/12
to Hobo Users
Hi there,

I am trying to make the view link only appear to administrators for
some children cards that are being displayed in a list on their parent
page. I'm building a review site and am displaying all the review
cards (children) on a category page (the parent item they are
reviewing). Because I'm showing all the fields for each child inside
the card on the list on the parent page, it's not necessary to have a
link to the view page for each one, but Hobo seems to render the title
of each review as a link automatically. Is there any way I can have
the title only be a link for administrators (who may need to access
the view page to then edit the reviews)?

Thanks,
Jake

Ignacio Huerta

unread,
Apr 29, 2012, 3:00:34 PM4/29/12
to hobo...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jake,

You can use this inside any tag:

if="&current_user.administrator"

This way you can have two pieces of code, one for the users and other
for the admins.

If you don't know where to apply that post more of your code so we can
see how to help you.

Regards,
Ignacio



El 28/04/12 03:53, Jake K escribi�:
- --
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Email realizado con software libre
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+dj9AACgkQBPlUJ6RHaOSMXgCfSPef4ygRqcP1zxUR9uqR9eNf
d+UAnA+LrOkw5JMrNubPa+R9+HT5MZ/X
=QD2m
-----END PGP SIGNATURE-----

kevinpfromnm

unread,
Apr 30, 2012, 12:51:09 PM4/30/12
to hobo...@googlegroups.com
I'd just note that you probably want to use current_user.administrator? with the ? as the other doesn't necessarily return a boolean value and/or the guest model doesn't have a plain administrator method by default.


On Sunday, April 29, 2012 1:00:34 PM UTC-6, Ignacio Huerta wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jake,

You can use this inside any tag:

if="&current_user.administrator"

This way you can have two pieces of code, one for the users and other
for the admins.

If you don't know where to apply that post more of your code so we can
see how to help you.

Regards,
Ignacio



El 28/04/12 03:53, Jake K escribi�:
> Hi there,
>
> I am trying to make the view link only appear to administrators
> for some children cards that are being displayed in a list on their
> parent page. I'm building a review site and am displaying all the
> review cards (children) on a category page (the parent item they
> are reviewing). Because I'm showing all the fields for each child
> inside the card on the list on the parent page, it's not necessary
> to have a link to the view page for each one, but Hobo seems to
> render the title of each review as a link automatically. Is there
> any way I can have the title only be a link for administrators (who
> may need to access the view page to then edit the reviews)?
>
> Thanks, Jake
>

- --
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35

Ignacio Huerta

unread,
May 16, 2012, 3:38:36 PM5/16/12
to hobo...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

(Sorry for the delay, this email got a bit lost).

You are definitely right Kevin: that "small detail" can give you a lot
of headache, I've felt it myself :P.

Regards,
Ignacio

El 30/04/12 18:51, kevinpfromnm escribi�:
> I'd just note that you probably want to use
> current_user.administrator? with the ? as the other doesn't
> necessarily return a boolean value and/or the guest model doesn't
> have a plain administrator method by default.
>
> On Sunday, April 29, 2012 1:00:34 PM UTC-6, Ignacio Huerta wrote:
>
> Hi Jake,
>
> You can use this inside any tag:
>
> if="&current_user.administrator"
>
> This way you can have two pieces of code, one for the users and
> other for the admins.
>
> If you don't know where to apply that post more of your code so we
> can see how to help you.
>
> Regards, Ignacio
>
>
>
> El 28/04/12 03:53, Jake K escribi�:
>> Hi there,
>
>> I am trying to make the view link only appear to administrators
>> for some children cards that are being displayed in a list on
>> their parent page. I'm building a review site and am displaying
>> all the review cards (children) on a category page (the parent
>> item they are reviewing). Because I'm showing all the fields for
>> each child inside the card on the list on the parent page, it's
>> not necessary to have a link to the view page for each one, but
>> Hobo seems to render the title of each review as a link
>> automatically. Is there any way I can have the title only be a
>> link for administrators (who may need to access the view page to
>> then edit the reviews)?
>
>> Thanks, Jake
>
>
>
> -- You received this message because you are subscribed to the
> Google Groups "Hobo Users" group. To view this discussion on the
> web visit
> https://groups.google.com/d/msg/hobousers/-/lpxAbYL3JSMJ. To post
> to this group, send email to hobo...@googlegroups.com. To
> unsubscribe from this group, send email to
> hobousers+...@googlegroups.com. For more options, visit
> this group at http://groups.google.com/group/hobousers?hl=en.

- --
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Email realizado con software libre
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+0AjwACgkQBPlUJ6RHaORoswCcCrPO+UPAQeMGeGhoo4aL2VkE
6A0AoKFwB7fMd/HCa8/ALKu77fu7FW0I
=NmxE
-----END PGP SIGNATURE-----
Reply all
Reply to author
Forward
0 new messages