Page 1 of 1

Hiding sections in 1.0

PostPosted: Fri Jul 18, 2008 6:10 pm
by gorzek
I looked through the documentation for custom sections, though a lot of it appears incomplete.

I have reimplemented the related records section on one of my views. Is there a way for me to just remove the old one? Basically, I put the new one in the main column, rather than on the left. Even giving them the same section name (e.g. submissions__relationship), they both show up--one does not replace the other. I just want the one on the left to go away.

Is there a way to do this easily without modifying templates?

PostPosted: Mon Jul 21, 2008 6:53 pm
by shannah
I apologize for the scanty documentation... many of the bleeding edge features of xataface still require documentation.

To hide the default relationship section, you can add the following to the relationships.ini definition of the relationship:

section:visible=0

Note that the following directives are also available:
section:permission
section:label
section:order
section:limit
section:filter
section:sort
section:class (accepts 'left' or 'main')

E.g. relationships.ini
Code: Select all
[my_relationship]
    __sql__ = "select * from etc ..."
    section:permission="edit" ;; only show this section if the user has edit permissions
    section:label="My Relationship label"
    section:order="2" ; The order in which the section should be located.
    section:limit="10";  Show 10 records
    section:filter="postDate>'2004-3-2' and ownerID=10" ; Show only records in this relationship newer than '2004-3-2' and owned by ownerID 10.
    section:sort="postDate desc, firstName asc" ; Sort records
    section:class="main" ; This section should be in the main column.



Hope this helps a little.

-Steve

PostPosted: Mon Jul 21, 2008 6:59 pm
by gorzek
Awesome! That's what I was looking for. I get the feeling Xataface has a lot of cool features that are unfortunately not documented yet. I think I've found one or two while implementing my project on 1.0b3. :)

Thanks again!

PostPosted: Mon Jul 21, 2008 7:19 pm
by gorzek
One other thing... say I want to hide a section that's not in a relationship, such as the Details section in the Browse action. I tried putting it in fields.ini, but it didn't do anything. How do you hide a non-relationship section?

Sorry I have so many questions.

PostPosted: Mon Jul 21, 2008 7:48 pm
by shannah
The default section (edit details) is implicitly named '__main__'. So you can add attributes to this section in the fields.ini file just as you would any other section:

Code: Select all
[section:__main__]
    label="My custom label"
etc...

PostPosted: Mon Jul 21, 2008 8:26 pm
by gorzek
Aha! That was not very obvious. So, I can control any section (besides relationships) in fields.ini via [section:%name%] blocks?