Githook highlighter (#8932)

* Add code highlighter to GitHook edit

Signed-off-by: Konctantin <gawrilyako@gmail.com>

* Fix indentation

Signed-off-by: Konctantin <gawrilyako@gmail.com>

* Resolve merge conflict

Signed-off-by: gawrilyako@gmail.com <Konctantin>

* Resolve merge conflict

Signed-off-by: gawrilyako@gmail.com <Konctantin>

* Fix pre-build drone event

Signed-off-by: Konctantin <gawrilyako@gmail.com>
This commit is contained in:
Konctantin 2019-11-15 09:56:06 +03:00 committed by Lunny Xiao
parent 896ad1d9cf
commit b30d744e09
2 changed files with 13 additions and 0 deletions

View file

@ -707,6 +707,7 @@ func GitHooks(ctx *context.Context) {
func GitHooksEdit(ctx *context.Context) { func GitHooksEdit(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.githooks") ctx.Data["Title"] = ctx.Tr("repo.settings.githooks")
ctx.Data["PageIsSettingsGitHooks"] = true ctx.Data["PageIsSettingsGitHooks"] = true
ctx.Data["RequireSimpleMDE"] = true
name := ctx.Params(":name") name := ctx.Params(":name")
hook, err := ctx.Repo.GitRepo.GetHook(name) hook, err := ctx.Repo.GitRepo.GetHook(name)

View file

@ -1499,6 +1499,17 @@ function initUserSettings() {
} }
} }
function initGithook() {
if ($('.edit.githook').length === 0) {
return;
}
CodeMirror.autoLoadMode(CodeMirror.fromTextArea($('#content')[0], {
lineNumbers: true,
mode: 'shell'
}), 'shell');
}
function initWebhook() { function initWebhook() {
if ($('.new.webhook').length === 0) { if ($('.new.webhook').length === 0) {
return; return;
@ -2296,6 +2307,7 @@ $(document).ready(() => {
initEditForm(); initEditForm();
initEditor(); initEditor();
initOrganization(); initOrganization();
initGithook();
initWebhook(); initWebhook();
initAdmin(); initAdmin();
initCodeView(); initCodeView();