Sha256: d2480d04c403e37ce5c3ffce120806c617802482424a551e30dc8aaa62e393c3

Contents?: true

Size: 1.7 KB

Versions: 19

Compression:

Stored size: 1.7 KB

Contents

/**
 * Makes the #select-identity-button to open a popup for the user to
 * select with which identity he wants 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

19 entries across 19 versions & 1 rubygems

Version Path
decidim-core-0.26.10 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.9 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.8 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.7 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.5 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.4 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.3 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.2 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.1 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.0 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.0.rc2 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.26.0.rc1 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.25.2 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.25.1 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.25.0 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.25.0.rc4 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.25.0.rc3 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.25.0.rc2 app/packs/src/decidim/identity_selector_dialog.js
decidim-core-0.25.0.rc1 app/packs/src/decidim/identity_selector_dialog.js