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.

32 lines
1.0 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 csrf = $('input[name=csrfmiddlewaretoken]').val();
  17. $.ajax({
  18. url: "/integrations/add_trello/settings/",
  19. type: "post",
  20. headers: {"X-CSRFToken": csrf},
  21. data: {token: token},
  22. success: function(data) {
  23. $("#integration-settings" ).html(data);
  24. updateSettings();
  25. }
  26. });
  27. }
  28. $("#integration-settings").on("change", "#list-selector", updateSettings);
  29. });