debian-mirror-gitlab/app/assets/javascripts/repository/utils/dom.js

14 lines
405 B
JavaScript
Raw Normal View History

2020-03-13 15:44:24 +05:30
import { joinPaths } from '~/lib/utils/url_utility';
2019-12-26 22:10:19 +05:30
export const updateElementsVisibility = (selector, isVisible) => {
document.querySelectorAll(selector).forEach(elem => elem.classList.toggle('hidden', !isVisible));
};
2020-01-01 13:55:28 +05:30
export const updateFormAction = (selector, basePath, path) => {
const form = document.querySelector(selector);
if (form) {
2020-03-13 15:44:24 +05:30
form.action = joinPaths(basePath, path);
2020-01-01 13:55:28 +05:30
}
};