Commit de35a2d2 authored by Andrey Lugovskiy's avatar Andrey Lugovskiy

- fixed missing javascript

parent a98587c9
......@@ -651,6 +651,31 @@ var GenesysFilter = {
};
/* jshint ignore:start */
var XUtil = {
x01: function (path, handler, object) {
$.ajax(path, $.extend({}, {
type: 'POST',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
data: (object === null ? null : JSON.stringify(object)),
beforeSend: function () {
},
success: function (respObject) {
document.console.log(respObject);
},
error: function (jqXHR, textStatus, errorThrown) {
document.console.log(textStatus);
document.console.log(errorThrown);
}
}, handler));
}
};
/* jshint ignore:end */
$(document).click(function(e) {
if (!$(e.target).is($('#navigation-menu')) && !$(e.target).is($('.humburger-btn'))) {
if ($('#navbar').hasClass('in')) {
......
......@@ -110,52 +110,42 @@
<content tag="javascript">
<security:authorize access="isAuthenticated()">
<script src="<c:url value="/html/js/main.js" />"></script>
<script src="<c:url value="/html/js/jsonclient.js" />"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
<security:authorize access="principal.id == #user.id">
$("#new-team-form input[type=submit]").on("click", function(e) {
e.preventDefault();
x01("<c:url value="/json/v0/me/teams" />", { success: function(e) {
window.location.reload();
}}, $(this.form).serializeObject());
});
$("a[x-team-id]").on("click", function(e) {
e.preventDefault();
x01("<c:url value="/json/v0/me/teams/" />" + $(this).attr('x-team-id') + "/leave",
{ success: function(e) {
BrowseUtil.x01("<c:url value="/json/v0/me/teams/" />" + $(this).attr('x-team-id') + "/leave",{
success: function(e) {
window.location.reload();
}});
}
});
});
</security:authorize>
<security:authorize access="hasRole('ADMINISTRATOR')">
$("button#acccount-enable").on("click", function(e) {
e.preventDefault();
x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
window.location.reload();
}}, true);
});
$("button#acccount-disable").on("click", function(e) {
e.preventDefault();
x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
window.location.reload();
}}, false);
});
$("button#acccount-lock").on("click", function(e) {
e.preventDefault();
x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
window.location.reload();
}}, true);
});
$("button#acccount-unlock").on("click", function(e) {
e.preventDefault();
x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
XUtil.x01 ("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
window.location.reload();
}}, false);
});
......
......@@ -103,33 +103,33 @@
<content tag="javascript">
<security:authorize access="isAuthenticated()">
<script src="<c:url value="/html/js/main.js" />"></script>
<script src="<c:url value="/html/js/jsonclient.js" />"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
<security:authorize access="hasRole('ADMINISTRATOR')">
$("button#acccount-enable").on("click", function(e) {
e.preventDefault();
x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
window.location.reload();
}}, true);
});
$("button#acccount-disable").on("click", function(e) {
e.preventDefault();
x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/enabled" />", { success: function(e) {
window.location.reload();
}}, false);
});
$("button#acccount-lock").on("click", function(e) {
e.preventDefault();
x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
window.location.reload();
}}, true);
});
$("button#acccount-unlock").on("click", function(e) {
e.preventDefault();
x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
XUtil.x01("<c:url value="/json/v0/user/${user.uuid}/locked" />", { success: function(e) {
window.location.reload();
}}, false);
});
......
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