docker_manager/admin/assets/javascripts/discourse/helpers/commit-url.js
Jarek Radosz ea174f7e36
DEV: Clean up the code (#245)
gjs, helper invocation case, typos, latest license template, unnecessary tracking, concatClass, unnecessary service injection, new imports, whitespace, pure function helper, htmlSafe calling convention, this. in template, unused vars in ruby, update linting, qunit-dom
2024-10-23 11:21:22 +02:00

16 lines
410 B
JavaScript

import { htmlSafe } from "@ember/template";
export default function commitUrl(cssClass, version, prettyVersion, url) {
if (!prettyVersion) {
return "";
}
if (!url) {
return prettyVersion;
}
const repoUrl = url.substr(0, url.search(/(\.git)?$/));
return htmlSafe(
`<a class='${cssClass} commit-hash' title='${version}' href='${repoUrl}/commit/${version}'>${prettyVersion}</a>`
);
}