Commit 4d5b82b0 authored by c24b's avatar c24b

Load lang

parent 6a5e707e
......@@ -148,36 +148,38 @@ help = {"#project":{
};
//define lang
lang = $("a#lang").data("lang")
//change lang
loadHelp(lang)
//change lang
$("a.new_lang").on("click", function(){
new_lang = $(this).data("lang")
//new_lang.setAttr("data-lang", lang)
loadHelp(new_lang);
new_lang = $(this).data("lang"))
// $.ajax({
// url: '/api/users?lang='+new_lang,
// type: 'PUT',
// beforeSend: function(xhr) {
// xhr.setRequestHeader("X-CSRFToken", getCookie("csrftoken"));
// },
// success: function(response) {
// console.log(response);
// console.log("EDIT SUCCESS!");
// //addFormStatus("success", "div#editForm-"+id, response["detail"]);
// window.location.reload()
// },
// error: function(xhr) {
// console.log("EDIT FAIL!")
// var status = xhr.status;
// var info = xhr.responseJSON["detail"];
// var msg = "<strong>ERROR ["+status+"]:</strong>"+ "<p>"+info+"</p>"
// addFormStatus("error", "div#editForm-"+id, msg);
// },
// });
// };
});
console.log("AJAX")
$.ajax({
url: '/api/users/?'+jQuery.param({"default_language":new_lang}),
type: 'PUT',
beforeSend: function(xhr) {
xhr.setRequestHeader("X-CSRFToken", getCookie("csrftoken"));
},
success: function(response) {
console.log(response);
console.log("EDIT SUCCESS!");
//window.location.reload()
},
error: function(xhr) {
console.log("EDIT FAIL!")
},
});
});
$( ".help" ).each(function(i, el) {
function loadHelp(lang){
$("span.help-btn").remove()
$( ".help" ).each(function(i, el) {
console.log("This", el);
id = el.id
div_id = "#"+id
......@@ -192,7 +194,7 @@ $( ".help" ).each(function(i, el) {
info = help[div_id]
console.log(lang)
console.log(info[lang]["content"])
help_btn = '<span class="glyphicon glyphicon-question-sign" tab-index=0 data-toggle="popover" data-placement="'+info[lang]["placement"]+'" title="'+info[lang]["title"]+'" data-content="'+info[lang]["content"]+'"></span>'
help_btn = '<span class="glyphicon glyphicon-question-sign help-btn" tab-index=0 data-toggle="popover" data-placement="'+info[lang]["placement"]+'" title="'+info[lang]["title"]+'" data-content="'+info[lang]["content"]+'"></span>'
if (info["position"] == "inside"){
......@@ -217,8 +219,8 @@ $( ".help" ).each(function(i, el) {
//$(help_btn).insertBefore(el);
}
});
});
}
$(document).on('click', function (e) {
$('[data-toggle="popover"],[data-original-title]').each(function () {
//the 'is' for buttons that trigger popups
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment