summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repository/utils/dom.js
blob: b667cd53b183f2b89273dcf0c7e439c7a041cacf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { joinPaths } from '~/lib/utils/url_utility';

export const updateElementsVisibility = (selector, isVisible) => {
  document
    .querySelectorAll(selector)
    .forEach((elem) => elem.classList.toggle('hidden', !isVisible));
};

export const updateFormAction = (selector, basePath, path) => {
  const form = document.querySelector(selector);

  if (form) {
    form.action = joinPaths(basePath, path);
  }
};