Extra button link

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • homeempire
    Senior Member
    • Sep 2014
    • 181

    Extra button link

    Hi.

    I add extra button to Account Entity. I add this code to clientDef:

    "menu": {
    "detail": {
    "buttons": [
    {
    "label": "Zadzwoń",
    "action": "zadzwon",
    "acl": "read",
    "style": "default"
    }
    ]
    }
    },

    and button is ok.

    but….

    My question is how to make button to link: "tel: {name}" ?
  • yuri
    Member
    • Mar 2014
    • 8511

    #2
    You can't do this via clientDefs. You will need to create own class for detail view (Custom:Account.Detail) and add your button dynamically with "link": 'tel: ' + this.model.get('youField') instead of "action"
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • homeempire
      Senior Member
      • Sep 2014
      • 181

      #3
      Ok I have own class. I put detail.js in client/custom/src/views/account. My code:

      Code:
      Espo.define('Custom:Views.Account.Detail', 'Views.Detail', function (Dep) {
      
      return Dep.extend({
      
      relatedAttributeMap: {
      'contacts': {
      'billingAddressCity': 'addressCity',
      'billingAddressStreet': 'addressStreet',
      'billingAddressPostalCode': 'addressPostalCode',
      'billingAddressState': 'addressState',
      'billingAddressCountry': 'addressCountry',
      'id': 'accountId',
      'name': 'accountName'
      },
      },
      
      
      
      });
      });



      Can You give me a code ? I try with this but it doesn't work:

      Code:
      Espo.define('Custom:Views.Account.Detail', 'Views.Detail', function (Dep) {
      
      return Dep.extend({
      
      relatedAttributeMap: {
      'contacts': {
      'billingAddressCity': 'addressCity',
      'billingAddressStreet': 'addressStreet',
      'billingAddressPostalCode': 'addressPostalCode',
      'billingAddressState': 'addressState',
      'billingAddressCountry': 'addressCountry',
      'id': 'accountId',
      'name': 'accountName'
      },
      },
      
      this.menu.actions.push({
      'label': 'Zadzwoń',
      'link': 'tel: ' + this.model.get('name'),
      'acl': 'read'
      });
      
      });
      });

      Comment

      • yuri
        Member
        • Mar 2014
        • 8511

        #4
        You should put that code into setup method. Take some of existing classes as an expample.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • homeempire
          Senior Member
          • Sep 2014
          • 181

          #5
          Ok thanx it's working.

          But tell me please how to make directly button instead of dropdown action?
          I guess that i need to change this.menu.actions.push ? But for what?
          And how open links in new card instead the same window?
          Last edited by homeempire; 07-10-2015, 11:11 AM.

          Comment

          • yuri
            Member
            • Mar 2014
            • 8511

            #6
            use this.menu.buttons
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            • homeempire
              Senior Member
              • Sep 2014
              • 181

              #7
              Thanks. Working great. But how open links in new card?

              Comment

              • yuri
                Member
                • Mar 2014
                • 8511

                #8
                No ability. You will need to write action and js code.
                If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                Comment

                Working...