{% load i18n %}

var enabledEditText = "{% trans "Enable edit inline" %}";
var disabledEditText = "{% trans "Disable edit inline" %}";
var toggleInplaceEdit = function () {
    var trigger = $(this);
    if (trigger.hasClass('active')) {
        inplaceManager.disable();
        trigger.removeClass('active');
        trigger.html(enabledEditText);
    } else {
        inplaceManager.enable();
        trigger.addClass('active');
        trigger.html(disabledEditText);
    }
};
var toolbar = $("<div id=\"toolbar-inplace-edit\"></div>").prependTo("body");
toolbar.append("<span class=\"toolbarActions\"></span>");
var actions = toolbar.find(".toolbarActions");
actions.append("<span class=\"toolbarAction\" id=\"ActivateInplaceEdit\">" + enabledEditText + "</span>");
$("#ActivateInplaceEdit").click(toggleInplaceEdit);