Sha256: d834356b733d5ae9f7248dff1fb3f89727454a9cbec4dc224fa51789b3346ed9

Contents?: true

Size: 1.52 KB

Versions: 6

Compression:

Stored size: 1.52 KB

Contents

import MeetingsPollComponent from "src/decidim/meetings/poll.component"
const OPEN_CLASS = "is-open";

$(() => {
  // Mount polls component for users
  const $container = $("[data-decidim-meetings-poll]");
  const $counter = $("#visible-questions-count");

  if ($container.length) {
    const poll = new MeetingsPollComponent($container, $container.data("decidim-meetings-poll"), $counter);

    poll.mountComponent();

    $(".meeting-polls__action-list").on("click", (event) => {
      event.preventDefault();

      if (poll.isMounted()) {
        $(event.target).removeClass(OPEN_CLASS);
        $container.removeClass(OPEN_CLASS);
        poll.unmountComponent();
      } else {
        $(event.target).addClass(OPEN_CLASS);
        $container.addClass(OPEN_CLASS);
        poll.mountComponent();
      }
    });
  }

  // Mount polls component for admins
  const $adminContainer = $("[data-decidim-admin-meetings-poll]");

  if ($adminContainer.length) {
    const adminPoll = new MeetingsPollComponent($adminContainer, $adminContainer.data("decidim-admin-meetings-poll"));

    adminPoll.mountComponent();

    $(".meeting-polls__action-administrate").on("click", (event) => {
      event.preventDefault();

      if (adminPoll.isMounted()) {
        $(event.target).removeClass(OPEN_CLASS);
        $adminContainer.removeClass(OPEN_CLASS);
        adminPoll.unmountComponent();
      } else {
        $(event.target).addClass(OPEN_CLASS);
        $adminContainer.addClass(OPEN_CLASS);
        adminPoll.mountComponent();
      }
    });
  }
});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-meetings-0.29.1 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.29.0 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.29.0.rc4 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.29.0.rc3 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.29.0.rc2 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.29.0.rc1 app/packs/src/decidim/meetings/meetings_polls.js