Licitator 1.0
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.

50 lines
1.9 KiB

5 years ago
  1. $(function() {
  2. $("#dashboard_filters").submit(function(e){
  3. e.preventDefault();
  4. let url = $(this).attr('action');
  5. let data = $(this).serialize();
  6. $.get(url, data, function(response){
  7. console.log(response);
  8. $("#result-contents").html(response);
  9. $('button[type="submit"]').prop('disabled', false);
  10. });
  11. });
  12. $("#reset-project-filters").click(function(e){
  13. e.preventDefault();
  14. let url = $("#dashboard_filters").attr('action');
  15. $.get(url, function(response){
  16. $("#result-contents").html(response);
  17. });
  18. });
  19. $('#myModal').on('show.bs.modal', function (event) {
  20. let button = $(event.relatedTarget); // Button that triggered the modal
  21. let title = button.data('title');
  22. let image = button.data('image');
  23. let modal = $(this);
  24. modal.find('.modal-title').text(title);
  25. modal.find('.news-body').html('<div class="loader"></div>');
  26. modal.find('.modal-body img').attr("src", image).attr('alt', title);
  27. modal.find('.loader').removeClass('show').addClass('show');
  28. });
  29. $("a.news-link").click(function(e){
  30. e.preventDefault();
  31. let url = $(this).attr('href');
  32. let target = $(this).data('target');
  33. $.get(url, function(response){
  34. $(target).find('.loader').removeClass('show');
  35. $(target).find('.modal-content').html(response);
  36. });
  37. });
  38. $(document).on("click", "a.contact_link", function(e){
  39. e.preventDefault();
  40. $(e.target).attr('disabled', true);
  41. let url = $(this).attr('href');
  42. $.get(url, function(response){
  43. }).done(function() {
  44. $(e.target).attr('disabled', true);
  45. window.location = "?persist";
  46. }).fail(function() {
  47. alert( "There's been an error" );
  48. });
  49. });
  50. });