Important announcements from CouchCMS team
230 posts Page 22 of 23
Previous 1 ... 19, 20, 21, 22, 23 Next
trendoman wrote: 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>
I think this is the right solution.

Your if statement should probably also check which template is being edited, so the error isn't mangled on other templates. You can also simplify the first condition. Just check if an error message exists.
Code: Select all
<cms:if k_error_k_page_name && k_selected_masterpage eq 'my_template.php'>
Last one, honest! :)

The possibilities are endless!
Code: Select all
        <cms:if k_error >
            <cms:show_error>
                <cms:each k_error >
                    <cms:if k_selected_masterpage eq 'my_template.php'>
                        <cms:php>global $CTX; $CTX ->set(item, (str_replace('<b>Name:</b>', '<b>Title:</b>', $CTX->get(item))));</cms:php>
                    </cms:if>
                    <cms:show item /><br>
                </cms:each>
            </cms:show_error>
        </cms:if>
@tim, thanks for the alter variant of a dirty trick :)
Let's change validator message on all templates, that have k_page_name hidden. Dare?
trendoman wrote: @tim, thanks for the alter variant of a dirty trick :)
Let's change validator message on all templates, that have k_page_name hidden. Dare?
8-) couch/theme/_system/group_system_fields.html:
Code: Select all
<div id="admin_wrapper_system_fields" <cms:if k_field_hidden>style="display:none;"</cms:if>>
    <cms:admin_form_fields childof='_system_fields_' depth='1'>
        <cms:render 'form_row' />
        <cms:if k_field_name eq "k_page_name" && k_field_hidden>
            <cms:set name_field_is_hidden='1' 'global'/>
        </cms:if>
    </cms:admin_form_fields>
</div>

8-) couch/theme/_system/content_form.html:
Code: Select all
        <cms:if k_error >
            <cms:show_error>
                <cms:each k_error >
                    <cms:if k_error_k_page_name && name_field_is_hidden >
                        <cms:php>global $CTX; $CTX->set(item, (str_replace('<b>Name:</b>', '<b>Title:</b>', $CTX->get(item))));</cms:php>
                    </cms:if>
                    <cms:show item /><br>
                </cms:each>
            </cms:show_error>
        </cms:if>
Thanks, @tim Your solution is indeed elegant and in the best course of CouchCMS 2.0 features :)
Following code doesn't make a label dynamic.

Code: Select all

<cms:editable type='reverse_relation' name='tours' advanced_gui='0' field='location' masterpage='index.php' anchor_text='View Tours' label='Tours' desc='' />

<cms:config_form_view>
    <cms:field 'tours' label="Tours in <cms:show k_page_title />" no_wrapper='0'  />
</cms:config_form_view>



Alternatively, I solved this via copying the link from default field:
Code: Select all
<cms:editable type='reverse_relation' name='tours' advanced_gui='1' field='location' masterpage='index.php' anchor_text='View Tours' label='Tours' desc='' />

<cms:config_form_view>

    <cms:field 'tours' label="Related Tours" no_wrapper='0' >
        <cms:set copied_link = "<cms:concat k_admin_link '?o=index.php&q=list&cid=' k_page_id '&rid=61' />" />
        <cms:capture into='tours_count' >
            <cms:pages masterpage='index.php' custom_field="location=id(<cms:show k_page_id />)" skip_custom_field='1' show_unpublished='1' count_only='1' />
        </cms:capture>
        <a href="<cms:show copied_link />">View tours in <cms:show k_page_title /> (<cms:show tours_count/>)</a>
    </cms:field>

</cms:config_form_view>



2017-09-06-201547.png
2017-09-06-201547.png (12.38 KiB) Viewed 674 times


How to properly make a dynamic label for an editable field?
Hi, I want to let client quickly unpublish selected pages.
How to add 'Unpublish' to bulk actions? It is handy to be able to unpublish old blog posts (e.g. after sorting list-view by date), or search results (e.g. pages that contain 'hotel' in title).

2017-09-09-011628.png
2017-09-09-011628.png (4.95 KiB) Viewed 653 times

Thanks
The new version of Couch is a true bliss to work with, thanks guys!

I ran into one "problem", I'm trying to make a nested pages template searchable but I do not see a search block appear.

Code: Select all
<cms:template title="Isolatie indicatie" nested_pages="1" clonable='1' order="80" parent="isolatie">
   <cms:config_list_view searchable='1' orderby='weight' order='asc'>
      <cms:field 'k_selector_checkbox' />
      <cms:field 'k_page_title' />
      
      <cms:field 'k_up_down' />
      <cms:field 'k_actions' />
   
   </cms:config_list_view>
</cms:template>


Am I doing something wrong or is this simply not possible?
@Saskia, I am sorry but the search option is only for regular cloned pages (i.e. not for nestable or gallery pages).
A quick question:
Why do we need this field for non-commentables templates (do not have "commentable='1' " setting on)
<cms:field 'k_comments_count' />

Is it possible to completely remove this from all templates, that do not have commentable='1' setting?
Previous 1 ... 19, 20, 21, 22, 23 Next
230 posts Page 22 of 23

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 1 guest