Sha256: 8d353c8e668b7eb7115ae00bf91d743bae369ac86dcd5b522fe2d94e4ca7ce38
Contents?: true
Size: 1.71 KB
Versions: 12
Compression:
Stored size: 1.71 KB
Contents
/** * Makes the #select-identity-button to open a popup for the user to * select with which identity they want to perform an action. * */ $(() => { let button = $("#select-identity-button"), identitiesUrl = null, userIdentitiesDialog = $("#user-identities"); if (userIdentitiesDialog.length) { identitiesUrl = userIdentitiesDialog.data("reveal-identities-url"); button.click(function () { $.ajax(identitiesUrl).done(function(response) { userIdentitiesDialog.html(response).foundation("open"); button.trigger("ajax:success") }); }); } }); /** * Manage the identity selector for endorsements. * */ $(() => { $("#select-identity-button").on("ajax:success", function() { // once reveal popup has been rendered register event callbacks $("#user-identities ul.reveal__list li").each(function(index, elem) { let liTag = $(elem) liTag.on("click", function() { let method = liTag.data("method"), urlDataAttr = null; if (method === "POST") { urlDataAttr = "create_url"; } else { urlDataAttr = "destroy_url"; } $.ajax({ url: liTag.data(urlDataAttr), method: method, dataType: "script", success: function() { if (liTag.hasClass("selected")) { liTag.removeClass("selected") liTag.find(".icon--circle-check").addClass("invisible") liTag.data("method", "POST") } else { liTag.addClass("selected") liTag.find(".icon--circle-check").removeClass("invisible") liTag.data("method", "DELETE") } } }) }) }); }); })
Version data entries
12 entries across 12 versions & 1 rubygems