0

I have created a custom power up that requires settings. I use the show-settings capability for this.

The settings form is shown successfully: enter image description here

But I don't know how to retrieve data from that form. Getting and setting is for saving en retrieving data, as I understand, but not for getting http params.

I've tried to get parameters like:

function get(parameterName) {
    var result = null,
        tmp = [];

    location.search
        .substr(1)
        .split("&")
        .forEach(function(item) {
            tmp = item.split("=");
            if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
        });

    return result;
}

Then calling get('webhookUrl') in different places;

  1. outside of window.TrelloPowerUp.initialize({});
  2. inside 'show-settings': function(t, options) {
  3. inside callback in t.popup(..)

Anything I log there, it doesn't seem to work.

app.js:

...
    'show-settings': function(t, options) {
        // when a user clicks the gear icon by your Power-Up in the Power-Ups menu
        // what should Trello show. We highly recommend the popup in this case as
        // it is the least disruptive, and fits in well with the rest of Trello's UX

        return t.popup({
            title: 'Custom Fields Settings',
            url: 'settings.html?v=' + timeStamp,
            height: 184, // we can always resize later
            callback: function(t) {
                console.log(t);
            }

        });
    },

In the settings.html

  <body>
    <form id="settings">
      <input name="webhookUrl" placeholder="https://app.buddy.works/user-name/projects-name/pipelines/pipeline .."></input>
      <button type="submit" class="mod-primary">Save</button>
    </form>
  </body>

Btw, i find it hard to debug things in the browser, in Chrome Developers Tools I check Javascript Context, every time I scroll to the right iframe, it is tedious.

Matt
  • 136
  • 2
  • 17

0 Answers0