src/pyams_security/resources/js/security.js
changeset 0 f04e1d0a0723
child 2 94e76f8e9828
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_security/resources/js/security.js	Thu Feb 19 10:53:29 2015 +0100
@@ -0,0 +1,44 @@
+(function($) {
+
+	window.PyAMS_security = {
+
+		/**
+		 * Init social plug-in
+		 */
+		init_social: function (element) {
+
+			MyAMS.ajax.check(window.authomatic,
+							'/--static--/pyams_security/js/authomatic' + (MyAMS.devmode ? '.min.js' : '.js'),
+							function (first_load) {
+								authomatic.setup({
+									popupWidth: 800,
+									popupHeight: 400,
+									onLoginComplete: function(result) {
+										console.log(result);
+										if (result.error) {
+
+										} else if (result.user) {
+											alert(result.user);
+										}
+									}
+								});
+								authomatic.popupInit();
+							});
+		},
+
+		/**
+		 * Ordered plug-ins callback
+		 */
+		plugins: {
+
+			/**
+			 * Change plug-ins names order
+			 */
+			changeOrder: function(table, names) {
+				var input = $('input[name="' + $(this).data('ams-input-name') + '"]', $(this));
+				input.val(names.join(';'));
+			}
+		}
+	};
+
+})(jQuery);