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.

30 lines
1.0 KiB

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