Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
17 posts Page 1 of 2
I've been looking into this and can't exactly make it work, I want to change the function by which couch filters the clonable list view from folders to a custom field.

How would I change this to make it work:

Code: Select all
<cms:capture into='my_folders' scope='global'>
    <cms:if k_folder_totalchildren >
        <div class="bulk-actions">
           
            <cms:dropdownfolders masterpage=k_template_name prompt='Name your pick' hierarchical='1' selected_id=my_selected_fid />
           
            <a class="button" id="btn_folder_submit"
                href="<cms:admin_link />"
                onclick="this.style.cursor='wait'; return false;" >
                <span>Filter</span>
            </a>
           
        </div>
    </cms:if>
</cms:capture>
Alin, I'll need some more info about what you are trying to achieve.
Could you please elaborate?
KK wrote: Alin, I'll need some more info about what you are trying to achieve.
Could you please elaborate?


Sure thing,

I registered a custom list view in kfunctions and the new template displays the editable field 'status' from the cloned pages.
The editable field is type dropdown and has only two values, enabled and disabled.

What I want to be able to do is filter the cloned pages like you would do with folders in the admin list view but instead of using folders, use the status field.

Is this better?
Yes :)
I'll get back.
KK wrote: Yes :)
I'll get back.


Thank you! :)
Hello @kk and a Happy new year!

Did you get a chance to look into this ? Or some kind of search field for the admin panel?
Thanks for your patience, Alin :)

I am attaching a first-cut version of this addon.
Please try it and let me know if it helps.

To use it you'll have to download the v2.0 from GitHub (has some more commits since the official release of it available on our site) - https://github.com/CouchCMS/CouchCMS. Please use it else the addon will not work.

Ok, with that done, extract the attached zip and place the 'filter' folder it yields into 'couch/addon'.
Activate this addon the usual way i.e. make an entry in 'addons/kfunctions.php' like this -
Code: Select all
require_once( K_COUCH_DIR.'addons/filter/filter.php' );


Finally, to attach this addon to your template that has the radiobuttons you mentioned, do the following (let us suppose the template is 'blog.php' and the name of the radiobutton editable region is 'status') -

1. In this addon's folder (i.e. in 'couch/addons/filter'), you'll find a file named config.example.php. Please rename it to 'config.php'.
2. Edit this config file and add the following line to it -
Code: Select all
$t['blog.php'] = 'status';

Of course, you need to put the actual name of your template and editable region.

With that done, coming back to the admin screen of the template you should see a dropdown with the values of your radiobuttons.

This addon should support type 'radio', 'checkbox', 'dropdown' and 'relation' regions. Should be most useful for 'relation' I think. You can have multiple on the same template (separate the names with a pipe '|') although the real estate on the admin screen will make this less practical.

Anyway, please test and let me know how it goes.
It is working for me but if it doesn't for you, please get me the FTP+Couch access creds for your site and I'll be glad to take a look.

Thanks and regards

P.S. Addon revised to support Relation region with advanced GUI (viewtopic.php?f=5&t=11021)

Attachments

This is waaaay to easy to use :lol:

Just tested it and it works great, the only "bad" thing about it is that it doesn't work with v 1.4.7 (isn't there an easy way to make it work with this v too?). I got too attached to it cause I worked a lot on admin designs for it and didn't want to go through it all again :)) But all in all, this works like a charm !

Thank you so much!
i have trouble with this addon at couch2.1beta:

i have few files:

snippets/admin/opt_partners_list.html
Code: Select all
<cms:show_globals masterpage='partneriai.php'>
   <cms:show_repeatable 'partners_category' >
      | <cms:show category_lt />
   </cms:show_repeatable>
</cms:show_globals>


i have config: admin/addons/filter/config.php
Code: Select all
$t['partneriai.php'] = 'partnerio_kategorija';


i have template partneriai.php:
Code: Select all
<cms:template title='Partneriai' clonable='1'  order='5'>

   <cms:editable name='pertner_logo' type='image' label='Logotipas' show_preview='1' preview_width='150' group="pertners_block_group_<cms:show lc />" />

      <cms:editable name="partnerio_kategorija" label="Partnerio kategorija" opt_values='admin/opt_partners_list.html' dynamic='opt_values' type='dropdown' />
   

   <cms:config_list_view>

      <cms:field 'k_selector_checkbox'/>

      <cms:field 'pertner_logo' header='Logotipas'>
         <img width="100" src="<cms:show pertner_logo />"/>
      </cms:field>

      <cms:field 'k_page_title' header='Partnerio pavadinimas' />

      <cms:field 'partnerio_kategorija' header='Kategorija' />
      <cms:globals>
         <cms:repeatable name='partners_category' label='Partnerių kategorijos' order='1'>
            <cms:editable name='category_lt' label='Kategorija lietuviškai' type='text' />
            <cms:editable name='category_lv' label='Kategorija latviškai' type='text' />
            <cms:editable name='category_ru' label='Kategorija rusiškai' type='text' />
            <cms:editable name='category_en' label='Kategorija angliškai' type='text' />
         </cms:repeatable>
      </cms:globals>

   </cms:config_list_view>

</cms:template>


and as result i have this:
Image
You are using <cms:globals> as a child block of <cms:config_list_view> - please move it to make it a direct child of <cms:template> instead (i.e. it is supposed to be a sibling of cms:config_list_view and not its child).

Please refresh your template as super-admin and see if that makes any difference.
17 posts Page 1 of 2

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 2 guests