Sha256: d7b2311d5972c4c0b9f868e26f36c6367eefc606055c896670455281a86e2207

Contents?: true

Size: 1.46 KB

Versions: 31

Compression:

Stored size: 1.46 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);

    $(".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"));
    $(".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

31 entries across 31 versions & 1 rubygems

Version Path
decidim-meetings-0.28.4 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.27.9 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.28.3 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.27.8 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.28.2 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.27.7 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.28.1 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.27.6 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.26.10 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.26.9 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.28.0 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.27.5 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.28.0.rc5 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.28.0.rc4 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.26.8 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.27.4 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.27.3 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.26.7 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.26.5 app/packs/src/decidim/meetings/meetings_polls.js
decidim-meetings-0.27.2 app/packs/src/decidim/meetings/meetings_polls.js