Important announcements from CouchCMS team
237 posts Page 21 of 24
Previous 1 ... 18, 19, 20, 21, 22, 23, 24 Next
Hi,
will there be any additional documentation material regarding CouchCMS 2? Right now, some tidbits are spread around the forum but no love for the actual documentation section on the main page. And somewhere there was a mentioning of an update/rework of repeatable regions. is this still on the radar?

tnx&good work
i have another cuestion, is posible to order the search results?
this is my code
Code: Select all
<cms:search masterpage='historias.php' limit='5' paginate='1' orderby='publish_date' order='desc'>

but it seems to no work
i have another cuestion, is posible to order the search results?
Search results are internally given a calculated score and the page with the highest score is always displayed first. So, to answer your query, no - the order in which the search results are displayed cannot be changed.
Not sure if this has been discussed. If it has - please throw in a link :)
I figured out how to make a column sortable by adding sortable='1' and sort_name='name-of-your-editable-field' to 'cms:field' definition.

My sample of 'cms:template' definition for 2 custom editable sortable fields:
Code: Select all
<cms:editable type='text' name='pp_price' label='Base Price' desc='Amount in USD // upto 2 decimal points without the $ sign' maxlength='10' search_type='decimal' validator='non_negative_decimal' width='150' order='' >0</cms:editable>
<cms:editable type='text' name='pp_displayname' label='Display Name' desc='Used instead of `Title` // if set' />

<cms:config_list_view exclude='default-page-for-passport-php' searchable='1' >

    <cms:field 'k_selector_checkbox' />
    <cms:field 'k_page_title' />

    <cms:field 'display_name' header='Public Name' class='no-hide' sortable='1' sort_name='pp_displayname'>
        <cms:if k_page_date ne '0000-00-00 00:00:00'>
        <span class="text-uppercase"><cms:if pp_displayname ><cms:show pp_displayname /><cms:else /><cms:show k_page_title /></cms:if></span>
        </cms:if>
    </cms:field>

    <cms:field 'display_price' header='Price' class='no-hide' sortable='1' sort_name='pp_price'>
        <cms:if k_page_date ne '0000-00-00 00:00:00'>
        <span class="text-uppercase"><cms:if pp_price >$ <cms:number_format number=pp_price decimal_precision='2' thousands_separator=' '/><cms:else /></cms:if></span>
        </cms:if>
    </cms:field>

    <cms:field 'k_page_foldertitle' />
    <cms:field 'k_page_date' />
    <cms:field 'k_actions' />

    <cms:style>
    .text-uppercase {
        text-transform: uppercase;
    }
    .col-display_price {
        text-align: left;
    }
    .col-folder {
        width: auto;
    }
    .col-title {
        width: auto;
    }
    .col-no-hide {
        display:table-cell !important;
    }
    </cms:style>

</cms:config_list_view>



After adding those, url shows the common 'orderby' and 'order' parameters
cms/?o=mytemplate.php&q=list&orderby=pp_price&order=desc

And table headers in list-view have the same up-down icons as the Title field.

It also works with search results, which is great to search for some products with at least one letter and a wildcard (*) and then order by price.
Continuation of my play with 2.0 :)
I found a simple way to insert a text to a repeatable field (i.e. hint for a client). Will be valuable for those, who wish add default text values to repeatable regions, however currently only single first line supported.

Also we need to find a way to disable this message once the page has been saved. So this is available only for new fresh pages. Solution: if page is not saved yet - it doesn't have an 'id' assigned to it by database. Internally, Couch has such id set as '-1'. Therefore we'll add a check for it.

Code: Select all

<cms:config_form_view>
    <cms:field 'k_page_name' hide='1' />

    <cms:script>
       <cms:if k_page_id = '-1'>
   
        $(function(){
            // my editable has a name 'pp_feat'
            $('table#f_<cms:show 'pp_feat' /> input[type="text"]').val('*SAMPLE FEATURE*: <strong>30 Day money back</strong> guarantee');
        });

       </cms:if>
    </cms:script>

</cms:config_form_view>



2017-09-02-170141.png
2017-09-02-170141.png (6.36 KiB) Viewed 28833 times


For 'nicedit' type of editables, change text in textarea:
$('textarea#id-here').text('text-here');

2017-09-02-175431.png
2017-09-02-175431.png (9.23 KiB) Viewed 28833 times
@KK, something needs your assist, I suppose:

Once system field 'name' has been hidden by
Code: Select all
<cms:config_form_view>
    <cms:field 'k_page_name' hide='1' />
</cms:config_form_view>

Error message is misleading, if user forgot to fill in the Title. What would be the best solution here?

2017-09-02-181636.png
2017-09-02-181636.png (8.94 KiB) Viewed 28831 times


Thanks and regards
@trendoman,

What if you change the label of the Title field to 'Name'?
Code: Select all
<cms:config_form_view> 
<cms:field 'k_page_title' label='Name' />
<cms:field 'k_page_name' hide='1' />
</cms:config_form_view>
tim wrote: @trendoman,

What if you change the label of the Title field to 'Name'?
Code: Select all
<cms:config_form_view> 
<cms:field 'k_page_title' label='Name' />
<cms:field 'k_page_name' hide='1' />
</cms:config_form_view>
Alternatively, change the error message:
Code: Select all
<cms:config_form_view> 
<cms:field 'k_page_name' validator_msg='name=Title field cannot be left empty.' />
<cms:field 'k_page_name' hide='1' />
</cms:config_form_view>
[/quote]
@tim, I could change the message via php event 'alter_system_fields_info', but I could not change the "Name: " before the message.

Code: Select all
$FUNCS->add_event_listener( 'alter_system_fields_info', array('CustomEvents', 'test') );

class CustomEvents{

    function test( &$arr_sys_fields, &$his){

        //error_log( print_r( $arr_sys_fields['1']->validator_msg , true));
        $arr_sys_fields['1']->validator_msg = 'title_ready=Only Lowercase characters, numerals, hyphen and underscore permitted|required=Title is required';
        //error_log( print_r( $arr_sys_fields['1']->validator_msg , true));

    }
}

2017-09-02-195227.png
2017-09-02-195227.png (4.62 KiB) Viewed 28828 times


Also, your sample wouldn't work since there is no such validator like 'name', above message pops out after validator 'required', but even changing it to following doesn't work. That's why I had to resort to event fiddling.
<cms:field 'k_page_name' validator_msg='required=Title field cannot be left empty.' />


I think even if we reconstruct the input by using 'cms:field' as a tag-pair, there is no way that I am aware of to change k_error prefix..
So here is a big question: in last two messages below how to change the auto-prefix 'Name: '?

k_error_k_page_name: Title is required
k_error: Name: Title is required
k_persist_error: Name: Title is required


Answer: A parameter label in cms:input is used to determine what to show in error message.
So, if it'd be a
<cms:input type='text' name='k_page_name' label='Something Else' required='1'/>

Then error messages would be
k_error: Something Else: Required field cannot be left empty
k_persist_error: Something Else: Required field cannot be left empty
Unfortunately, couldn't find a proper general solution and modified couch/_system/theme/content_form.html :?
Code: Select all
        <cms:if k_error_k_page_name eq 'Required field cannot be left empty' >
            <cms:show_error>
                <strong>Title</strong>: Required field cannot be left empty
            </cms:show_error>
        <cms:else_if k_error />
            <cms:show_error>
                <cms:each k_error >
                    <cms:show item /><br>
                </cms:each>
            </cms:show_error>
        </cms:if>


2017-09-02-203619.png
2017-09-02-203619.png (8 KiB) Viewed 28824 times
Previous 1 ... 18, 19, 20, 21, 22, 23, 24 Next
237 posts Page 21 of 24
cron