Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hi

I have a client who wants to be able to add their own columns/lists so know can do that using repeatable regions to create the columns as is using bootstrap but the bit I think I will be stuck on is the list type as for example one column would be a normal list like the following example

Code: Select all
<ul class="list">
                                    <li>White, Pink-Eyed</li>
                                    <li>White, Dark-Eyed</li>
                                    <li>Cream, Pink-Eyed</li>
                                    <li>Cream, Dark-Eyed</li>
                                    <li>Buff</li>
                                    <li>Saffron</li>
                                    <li>Golden, Pink-Eyed</li>
                                    <li>Golden, Dark-Eyed</li>
                                    <li>Lilac</li>
                                    <li>Beige</li>
                                    <li>Red</li>
                                    <li>Chocolate</li>
                                    <li>Black</li>
                                    <li>Slate</li>
                                    <li>Blue</li>
                            </ul>


Then the next column would be a list like the following(which is currently done by using mosaic cms tag) so is there some way the client could choose what type of list to show, would it be something like enable/disable sections

Code: Select all
<ul class="list">
                                                            <li>
                            <strong>Agouti</strong>
                        <ul>
                                                            <li>Golden</li>
                                                            <li>Silver</li>
                                                            <li>Lemon</li>
                                                            <li>Chocolate</li>
                                                            <li>Cream</li>
                                                            <li>Cinnamon</li>
                                                    </ul>
                        </li>
                                                                                <li>
                            <strong>Solid Agouti</strong>
                        <ul>
                                                            <li>Golden</li>
                                                            <li>Silver</li>
                                                            <li>Lemon</li>
                                                            <li>Chocolate</li>
                                                            <li>Cream</li>
                                                            <li>Cinnamon</li>
                                                    </ul>
                        </li>
                                                  </ul>


I have done the enable/disable sections in the past on another site like the following which had the repeatable region in it but unsure if that's the correct way to do it or would I need to use the cms:capture tag?

Code: Select all
<cms:editable name='testimonial_enable' label='Enable Testimonials Section' opt_values='Enable=1 || Disable=0' type='radio' group='testimonials_group' order='1' />


Hopefully that all makes sense
Been trying to think of a way to do this but can't seem to think of a way of when the client adds a new column for the repeatable region that they can choose to have a normal basic list or a list with a submenu so somehow they could choose like the following

Choose basic list
Code: Select all
<ul>
<li>Item Name</li>
</ul>


Choose list with sub items like the following
Code: Select all
<ul>
<li>Item Name
<ul>
<li>Item Name</li>
</ul>
</li>
</ul>


I thought of just having the mosaic code in and possibly use if and else but can't work out if would be correct way to do it or not
Just had a thought, would something like the following work?

Code: Select all
<cms:repeatable name='lists' label='Lists' stacked_layout='1' group='lists_group'>

<cms:editable name='list_type' type='radio' label='Select slide type' opt_values='Standard List | List with sublist' />
   
<cms:func _into='my_cond' list_type=''>
        <cms:if list_type='Standard List'>show<cms:else />hide</cms:if>
    </cms:func>
    <cms:editable name='list_item' label='List Item' type='text' not_active=my_cond />
   
    <cms:func _into='my_cond' list_type=''>
        <cms:if list_type='List with sublist'>show<cms:else />hide</cms:if>
    </cms:func>
<cms:mosaic name='listsublist' label='List with sublist' group='the_breed_sections' >
    <cms:tile name='listtem' label='List Item'>
        <cms:editable type='text' name='listparentitem' label='Parent Item Name' not_active=my_cond />
       
<cms:repeatable name='listsub' label='Sub List' group='the_breed_sections' >
<cms:editable type='text' name='listchilditem' label='Child Item Name'  />
</cms:repeatable>
    </cms:tile>
    </cms:mosaic>

</cms:repeatable>
Think I will have to admit defeat on this one as just trying to do what is required on a test page but I forgot anything inside the repeatable tag is repeated (should of known that by now). I did the following code which works for that part but it's outputting the code that is the issue as it's outputting the tags again as are inside the repeatable tag, see below the 1st part of code

Code: Select all
<cms:editable name='test_group' label='Test Lists' type='group' collapsed='1' />
<cms:repeatable name='lists' label='Lists' stacked_layout='1' group='test_group'>

<cms:editable name='list_type' type='radio' label='Select List type' opt_values='Standard List | List with sublist' />
   
<cms:func _into='my_cond' list_type=''>
        <cms:if list_type='Standard List'>show<cms:else />hide</cms:if>
    </cms:func>
    <cms:editable name='standard_list_heading' label='Standard List Heading' type='text' group='test_group' not_active=my_cond />
    <cms:editable name='standard_list_item' label='Standard List Item' type='text' group='test_group' not_active=my_cond />
   
    <cms:func _into='my_cond' list_type=''>
        <cms:if list_type='List with sublist'>show<cms:else />hide</cms:if>
    </cms:func>
        <cms:editable type='text' name='listsublistheading' label='List with sublist Heading' group='test_group' not_active=my_cond />
        <cms:editable type='text' name='listparentitem' label='Parent Item Name' group='test_group' not_active=my_cond />
        <cms:editable type='text' name='listchilditem' label='Child Item Name' group='test_group' not_active=my_cond  />

</cms:repeatable>


Code: Select all
<cms:show_repeatable 'lists'>      
          <div class="col-md-3">
              <div class="esc-heading heading-line-bottom lr-line left-heading">
                  <cms:if "<cms:not_empty standard_list_heading />" >
                    <h4><cms:show standard_list_heading/></h4>
                      <cms:else />
                      <h4><cms:show listsublistheading/></h4>
                    </cms:if>
                </div>
              <cms:if "<cms:not_empty standard_list_item />" >
            <ul class="list">
                    <li><cms:show standard_list_item/></li>
            </ul>
                  <cms:else />
                  <ul class="list">
                      <li><cms:show listparentitem/>
                          <ul>
                              <li><cms:show listchilditem/></li>
                          </ul>
                      </li>
                  </ul>
                  </cms:if>
          </div>
            </cms:show_repeatable>


The issue is when added a new row for the list item, everything is outputted again including the header and the ul and li tag again so it's outputted like the following

Code: Select all
<div class="col-md-3">
              <div class="esc-heading heading-line-bottom lr-line left-heading">
                                      <h4>English Self</h4>
                                      </div>
                          <ul class="list">
                    <li>White, Pink-Eyed</li>
            </ul>
                            </div>

<div class="col-md-3">
              <div class="esc-heading heading-line-bottom lr-line left-heading">
                                        <h4></h4>
                                    </div>
                          <ul class="list">
                    <li>White, Dark-Eyed</li>
            </ul>
                            </div>


Think will need help on this one, is there any way some fields could be hidden or not repeated if empty or something somehow as want to try and achieve the following output

Code: Select all
<div class="col-md-3">
              <div class="esc-heading heading-line-bottom lr-line left-heading">
                                      <h4>Standard List</h4>
                                      </div>
                          <ul class="list">
                    <li>1st Item</li>
                    <li>2nd Item</li>
            </ul>
                            </div>
<div class="col-md-3">
              <div class="esc-heading heading-line-bottom lr-line left-heading">
                                      <h4>List with child item</h4>
                                      </div>
                          <ul class="list">
                    <li>1st Item
                    <ul>
                    <li>2nd Item</li>
                    </ul>
                   </li>
            </ul>
                            </div>


I can't get my head around it, I think I am trying to do something that could be difficult to achieve in couchcms, sorry if wrong
4 posts Page 1 of 1