Skip to content

Commit b30d744

Browse files
Konctantinlunny
authored andcommitted
Githook highlighter (#8932)
* Add code highlighter to GitHook edit Signed-off-by: Konctantin <[email protected]> * Fix indentation Signed-off-by: Konctantin <[email protected]> * Resolve merge conflict Signed-off-by: [email protected] <Konctantin> * Resolve merge conflict Signed-off-by: [email protected] <Konctantin> * Fix pre-build drone event Signed-off-by: Konctantin <[email protected]>
1 parent 896ad1d commit b30d744

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

routers/repo/setting.go

+1
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ func GitHooks(ctx *context.Context) {
707707
func GitHooksEdit(ctx *context.Context) {
708708
ctx.Data["Title"] = ctx.Tr("repo.settings.githooks")
709709
ctx.Data["PageIsSettingsGitHooks"] = true
710+
ctx.Data["RequireSimpleMDE"] = true
710711

711712
name := ctx.Params(":name")
712713
hook, err := ctx.Repo.GitRepo.GetHook(name)

web_src/js/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,17 @@ function initUserSettings() {
14991499
}
15001500
}
15011501

1502+
function initGithook() {
1503+
if ($('.edit.githook').length === 0) {
1504+
return;
1505+
}
1506+
1507+
CodeMirror.autoLoadMode(CodeMirror.fromTextArea($('#content')[0], {
1508+
lineNumbers: true,
1509+
mode: 'shell'
1510+
}), 'shell');
1511+
}
1512+
15021513
function initWebhook() {
15031514
if ($('.new.webhook').length === 0) {
15041515
return;
@@ -2296,6 +2307,7 @@ $(document).ready(() => {
22962307
initEditForm();
22972308
initEditor();
22982309
initOrganization();
2310+
initGithook();
22992311
initWebhook();
23002312
initAdmin();
23012313
initCodeView();

0 commit comments

Comments
 (0)