Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
I have created a gallery template and an additional thumbnail variable (of a different size). However, I DON'T want either one to display on the admin page because it just confuses the people that are maintaining the site. The same is true for the system generated "name" field. The user has no real need to even see it.

In fact, this raises the premise that the super administrator should have the ability to limit what the regular administrators see on their admin pages. I'm creating a site that will be maintained by relatively low-level staffers and they can mess things up very quickly given the full admin page access.

Is there any way to hide these items from the regular administrators?
My approach, daily used:

In a working template put the following editable inside <cms:template />:
Code: Select all
<cms:template title='My template' >

.. here come all your editables ..
   
<cms:editable                                                               name='admin'
              label='Admin Hacks'
              type='message'
              order='-1000'
              dynamic='default_data'
              >_editables_hack_dynamic.html
</cms:editable>

Now, create a file _editables_hack_dynamic.html in your snippets folder with the following content:
Code: Select all
<style>
  div#k_page_name.k_element,
/*  div#k_element_gg_thumb, */
  div#k_name.k_element
  {display: none}
</style>

This will hide names of clonable pages.

To hide also thumbnails, uncomment that commented-out line.
Oh, and if you still want to see those fields yourself, as superadmin, then enclose the content of your snippet with conditional to finally look like this:
Code: Select all
<cms:if k_user_access_level lt '10' >
     <style>
           div#k_page_name.k_element,
           div#k_element_gg_thumb,
           div#k_name.k_element
                {display: none}
     </style>
</cms:if>
Thanks for the quick reply! However, I can't get it to work. It seems like the _editables_hack_dynamic.html file is not being included from my snippets. Here's the first part of my gallery.php:
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Gallery' clonable='1' dynamic_folders='1' gallery='1'>

  <cms:editable
      name="gg_image"
      label="Image"
      desc="Upload your main image here"
      width="500"
      show_preview='1'
      preview_height='200'
      type="image"
   />

   <cms:editable
      name="gg_thumb"
      assoc_field="gg_image"
      label="Image Thumbnail"
      desc="Thumbnail of image above"
      width='115'
      height='115'
      enforce_max='1'
      type="thumbnail"
   />
   <cms:editable
      name='bigthumb'
      label='Display Thumbnail'
      desc='Larger thumbnail'
      width='200'
      height='200'
      assoc_field='gg_image'
      show_preview='1'
      type='thumbnail'
   /> 
   <cms:editable
       name='gg_desc'
       label='Description (optional)'
       type='text'
   />
   
   <cms:editable                                                               
       name='admin'
       label='Admin Hacks'
       type='message'
       order='-1000'
       dynamic='default_data'
       >_editables_hack_dynamic.html
   </cms:editable>
</cms:template>
<!DOCTYPE html>

And my /snippets/_editables_hack_dynamic.html file matches your content. When I view source of the resulting admin page, I don't see the style included in the source and the admin page still shows the thumbnails.
Have you made sure that you have accessed the modified template (i.e. with the new editable region added) as super-admin on the front-end? This is the same as adding any other editable region.
@KK, thanks for input :) I was almost done :D

Well, if the snippet is not included, you may check 3 things:
1. snippets folder is correct one (check config.php)
2. you have visited your template as superadmin first. CMS needs to pick up a new editable.
3. The last conditional is set to output the styling only for admins, i.e. anyone with access lesser than 10 (superadmin). So, you have to do step 2 and then logout and login as admin to check if it's working.
Ack, I created a new admin user and was still logged in as him! My bad! :oops:
The code now appears in source and it works great! (and had to remember to add a style for my additional thumbnail). The conditional opens up a bunch of new possibilities for me too, THANKS!

Support around here is as great as the app!
6 posts Page 1 of 1