You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

  1. $(function() {
  2. function updateSettings() {
  3. var opt = $('#list-selector').find(":selected");
  4. $("#settings").val(JSON.stringify({
  5. "token": $("#settings").data("token"),
  6. "list_id": opt.data("listId"),
  7. "board_name": opt.data("boardName"),
  8. "list_name": opt.data("listName")
  9. }));
  10. }
  11. var tokenMatch = window.location.hash.match(/token=(\w+)/);
  12. if (tokenMatch) {
  13. $(".jumbotron").hide();
  14. $("integration-settings").text("Loading...");
  15. token = tokenMatch[1];
  16. var base = document.getElementById("base-url").getAttribute("href").slice(0, -1);
  17. var csrf = $('input[name=csrfmiddlewaretoken]').val();
  18. $.ajax({
  19. url: base + "/integrations/add_trello/settings/",
  20. type: "post",
  21. headers: {"X-CSRFToken": csrf},
  22. data: {token: token},
  23. success: function(data) {
  24. $("#integration-settings" ).html(data);
  25. updateSettings();
  26. }
  27. });
  28. }
  29. $("#integration-settings").on("change", "#list-selector", updateSettings);
  30. });