Commit de35a2d2 authored by Andrey Lugovskiy's avatar Andrey Lugovskiy

- fixed missing javascript

parent a98587c9
/** /**
* Copyright 2015 Global Crop Diversity Trust * Copyright 2015 Global Crop Diversity Trust
* *
* jQuery $ and $.ajax() required. * jQuery $ and $.ajax() required.
*/ */
'use strict'; 'use strict';
...@@ -651,6 +651,31 @@ var GenesysFilter = { ...@@ -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) { $(document).click(function(e) {
if (!$(e.target).is($('#navigation-menu')) && !$(e.target).is($('.humburger-btn'))) { if (!$(e.target).is($('#navigation-menu')) && !$(e.target).is($('.humburger-btn'))) {
if ($('#navbar').hasClass('in')) { if ($('#navbar').hasClass('in')) {
...@@ -786,7 +811,7 @@ $('.twitter-follow-button').click(function(e) { ...@@ -786,7 +811,7 @@ $('.twitter-follow-button').click(function(e) {
}); });
/** /**
* Share on LinkedIn * Share on LinkedIn
*/ */
$('.linkedin-share-button').click(function(e) { $('.linkedin-share-button').click(function(e) {
e.preventDefault(); e.preventDefault();
......
...@@ -110,52 +110,42 @@ ...@@ -110,52 +110,42 @@
<content tag="javascript"> <content tag="javascript">
<security:authorize access="isAuthenticated()"> <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"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
<security:authorize access="principal.id == #user.id"> <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) { $("a[x-team-id]").on("click", function(e) {
e.preventDefault(); e.preventDefault();
x01("<c:url value="/json/v0/me/teams/" />" + $(this).attr('x-team-id') + "/leave", BrowseUtil.x01("<c:url value="/json/v0/me/teams/" />" + $(this).attr('x-team-id') + "/leave",{
{ success: function(e) { success: function(e) {
window.location.reload(); window.location.reload();
}}); }
});
}); });
</security:authorize> </security:authorize>
<security:authorize access="hasRole('ADMINISTRATOR')"> <security:authorize access="hasRole('ADMINISTRATOR')">
$("button#acccount-enable").on("click", function(e) { $("button#acccount-enable").on("click", function(e) {
e.preventDefault(); 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(); window.location.reload();
}}, true); }}, true);
}); });
$("button#acccount-disable").on("click", function(e) { $("button#acccount-disable").on("click", function(e) {
e.preventDefault(); 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(); window.location.reload();
}}, false); }}, false);
}); });
$("button#acccount-lock").on("click", function(e) { $("button#acccount-lock").on("click", function(e) {
e.preventDefault(); 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(); window.location.reload();
}}, true); }}, true);
}); });
$("button#acccount-unlock").on("click", function(e) { $("button#acccount-unlock").on("click", function(e) {
e.preventDefault(); 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(); window.location.reload();
}}, false); }}, false);
}); });
...@@ -165,4 +155,4 @@ ...@@ -165,4 +155,4 @@
</security:authorize> </security:authorize>
</content> </content>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -103,33 +103,33 @@ ...@@ -103,33 +103,33 @@
<content tag="javascript"> <content tag="javascript">
<security:authorize access="isAuthenticated()"> <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"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
<security:authorize access="hasRole('ADMINISTRATOR')"> <security:authorize access="hasRole('ADMINISTRATOR')">
$("button#acccount-enable").on("click", function(e) { $("button#acccount-enable").on("click", function(e) {
e.preventDefault(); 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(); window.location.reload();
}}, true); }}, true);
}); });
$("button#acccount-disable").on("click", function(e) { $("button#acccount-disable").on("click", function(e) {
e.preventDefault(); 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(); window.location.reload();
}}, false); }}, false);
}); });
$("button#acccount-lock").on("click", function(e) { $("button#acccount-lock").on("click", function(e) {
e.preventDefault(); 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(); window.location.reload();
}}, true); }}, true);
}); });
$("button#acccount-unlock").on("click", function(e) { $("button#acccount-unlock").on("click", function(e) {
e.preventDefault(); 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(); window.location.reload();
}}, false); }}, false);
}); });
...@@ -139,4 +139,4 @@ ...@@ -139,4 +139,4 @@
</security:authorize> </security:authorize>
</content> </content>
</body> </body>
</html> </html>
\ No newline at end of file
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