How to change style of a field in a specific module based on another field, v7.7

Hi,

i'll like to do the following:

 In the Contacts module i've a new custom field, a simple checkbox called leaved_company.

I'll like to change the style of the contact header in the record view (so first name last name), based on the value of this field. If checked then apply style xyz on the field. 

I suppose i've to make some custom files in custom/modules/Contacts/clients/base/views but i can't really find which ones and with what for a content ? Can i just override the part displaying the name of the contact or i've to make the complete view again ?

Thanks.

jb

  • What you probably need to do is look at 

    clients/base/fields/fullname

    and extend it to change your detail.hbs and fullname.js to check your checkbox field to note if the person has left the company and change the style of the display

     

    I've not done this but you would create:

    custom/modules/Contacts/clients/base/fields/fullname/detail.hbs

    and in 

    custom/modules/Contacts/clients/base/fields/fullname/fullname.js


    In fullname.js format function set var this.left_company to true or false based on your checkbox value.

    Then your HBS will be something like this (better still use the css classes to set your style)

      {{#if left_company}}

    <span class="ellipsis_inline" style="color:red" rel="tooltip" title="{{value}}" data-placement="bottom" data-fieldname="{{name}}">

        {{value}}

    </span>

      {{else}}

    <span class="ellipsis_inline" rel="tooltip" title="{{value}}" data-placement="bottom" data-fieldname="{{name}}">

        {{value}}

    </span>

      {{/if}}

     

     

    HTH

    FrancescaS