Sha256: e00a281b755e9a25b7e569026c8046a3eec1f82817320cb9435eb855db3b9fc1

Contents?: true

Size: 1.25 KB

Versions: 24

Compression:

Stored size: 1.25 KB

Contents

$(() => {
  const $projects = $("#projects, #project");
  const $budgetSummaryTotal = $(".budget-summary__total");
  const $budgetExceedModal = $("#budget-excess");
  const $budgetSummary = $(".budget-summary__progressbox");
  const $voteButton = $(".budget-vote-button");
  const totalAllocation = parseInt($budgetSummaryTotal.attr("data-total-allocation"), 10);

  const cancelEvent = (event) => {
    $(event.currentTarget).removeClass("loading-spinner");
    event.stopPropagation();
    event.preventDefault();
  };

  $voteButton.on("click", "span", () => {
    $(".budget-list__action").click();
  });

  $projects.on("click", ".budget-list__action", (event) => {
    const currentAllocation = parseInt($budgetSummary.attr("data-current-allocation"), 10);
    const $currentTarget = $(event.currentTarget);
    const projectAllocation = parseInt($currentTarget.attr("data-allocation"), 10);

    if (!$currentTarget.attr("data-open")) {
      $currentTarget.addClass("loading-spinner");
    }

    if ($currentTarget.attr("disabled")) {
      cancelEvent(event);
    } else if (($currentTarget.attr("data-add") === "true") && ((currentAllocation + projectAllocation) > totalAllocation)) {
      $budgetExceedModal.foundation("toggle");
      cancelEvent(event);
    }
  });
});

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
decidim-budgets-0.27.9 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.8 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.7 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.6 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.26.10 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.26.9 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.5 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.26.8 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.4 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.3 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.26.7 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.26.5 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.2 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.1 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.26.4 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.0 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.26.3 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.0.rc2 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.27.0.rc1 app/packs/src/decidim/budgets/projects.js
decidim-budgets-0.26.2 app/packs/src/decidim/budgets/projects.js