Skip to content

Commit

Permalink
remove useless javascript, youpi !
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalfox committed Oct 17, 2024
1 parent 20102d0 commit ba127ed
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions templates/leads/lead_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,54 +262,6 @@ <h2>{% trans "Administrative notes" %}</h2>

<script type="text/javascript">
<!--

$(document).ready(function() {
// Function to add new tags asynchronously

// Add autocomplete on existings tags
$("#newtag").autocomplete({ source:"{{ completion_url }}", minLength: 0});

// Connect form validation to ajax request
$("#tag_form").submit(function(e) {
e.preventDefault();
// send requests
if ($("#newtag").val()) {
$.post("{% url 'leads:add_tag' %}",
{ tag : $("#newtag").val(), lead_id : {{lead.id|unlocalize }} },
function(data) {
if (data.tag_created) {
// Add new tag on list
var remove_link = "<a class='tagrlink' href='javascript:;' onClick=\"$.get('" + data.tag_remove_url + "', hide_tag)\"> <i class=\"bi bi-x-circle\"></i></a>";
$("#newtags").append("<div id='tag_" + data.id + "'><a href='"+ data.tag_url + "' class='mx-1'>" + data.tag_name + "</a> " + remove_link + "&nbsp;&nbsp;");
$("#newtag").val("");
}
else {
$("#newtag").val("{% trans 'Tag already exists' %}");
}
});
}
});

// Connect suggested tag to ajax request
$("#suggested a").on("click", function(e){
e.preventDefault();
// send requests
$.post("{% url 'leads:add_tag' %}",
{ tag : $(this).text(), lead_id : {{lead.id|unlocalize}} },
function(data) {
// Add new tag on list
var remove_link = "<a href='javascript:;' onClick=\"$.get('" + data.tag_remove_url + "')\"><i class=\"bi bi-x-circle\"></i></a>";
$("#newtags").append("<a href='"+ data.tag_url + "'>" + data.tag_name + "</a>" + remove_link + "&nbsp;&nbsp;");
});
// Remove from suggested list
$(this).remove();
});
});

function hide_tag(data) {
$("#tag_"+ data.id).hide("fast");
};

// Add keyboard shortcut to go to next/previous lead
function doc_keyUp(e) {
/// Do not change page if the user is editing a field
Expand Down

0 comments on commit ba127ed

Please sign in to comment.