Skip to content

Commit

Permalink
Githook highlighter (#8932)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Konctantin authored and lunny committed Nov 15, 2019
1 parent 896ad1d commit b30d744
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions routers/repo/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ func GitHooks(ctx *context.Context) {
func GitHooksEdit(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.githooks")
ctx.Data["PageIsSettingsGitHooks"] = true
ctx.Data["RequireSimpleMDE"] = true

name := ctx.Params(":name")
hook, err := ctx.Repo.GitRepo.GetHook(name)
Expand Down
12 changes: 12 additions & 0 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
if ($('.new.webhook').length === 0) {
return;
Expand Down Expand Up @@ -2296,6 +2307,7 @@ $(document).ready(() => {
initEditForm();
initEditor();
initOrganization();
initGithook();
initWebhook();
initAdmin();
initCodeView();
Expand Down

0 comments on commit b30d744

Please sign in to comment.