summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repository/utils/dom.js
blob: abf726194ac49344a0f70658d783cdb29bb0e3ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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);
  }
};