Minor naming improvement
This commit is contained in:
parent
2c5411b00c
commit
ec332cf903
|
@ -37,8 +37,8 @@ func Toggle(options *ToggleOptions) macaron.Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check non-logged users landing page.
|
// Check non-logged users landing page.
|
||||||
if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageUrl != setting.LANDING_PAGE_HOME {
|
if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LANDING_PAGE_HOME {
|
||||||
ctx.Redirect(setting.AppSubUrl + string(setting.LandingPageUrl))
|
ctx.Redirect(setting.AppSubUrl + string(setting.LandingPageURL))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Build information
|
// Build information should only be set by -ldflags.
|
||||||
BuildTime string
|
BuildTime string
|
||||||
BuildGitHash string
|
BuildGitHash string
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ var (
|
||||||
CertFile, KeyFile string
|
CertFile, KeyFile string
|
||||||
StaticRootPath string
|
StaticRootPath string
|
||||||
EnableGzip bool
|
EnableGzip bool
|
||||||
LandingPageUrl LandingPage
|
LandingPageURL LandingPage
|
||||||
UnixSocketPermission uint32
|
UnixSocketPermission uint32
|
||||||
|
|
||||||
SSH struct {
|
SSH struct {
|
||||||
|
@ -258,6 +258,7 @@ var (
|
||||||
HasRobotsTxt bool
|
HasRobotsTxt bool
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DateLang transforms standard language locale name to corresponding value in datetime plugin.
|
||||||
func DateLang(lang string) string {
|
func DateLang(lang string) string {
|
||||||
name, ok := dateLangs[lang]
|
name, ok := dateLangs[lang]
|
||||||
if ok {
|
if ok {
|
||||||
|
@ -407,9 +408,9 @@ func NewContext() {
|
||||||
|
|
||||||
switch sec.Key("LANDING_PAGE").MustString("home") {
|
switch sec.Key("LANDING_PAGE").MustString("home") {
|
||||||
case "explore":
|
case "explore":
|
||||||
LandingPageUrl = LANDING_PAGE_EXPLORE
|
LandingPageURL = LANDING_PAGE_EXPLORE
|
||||||
default:
|
default:
|
||||||
LandingPageUrl = LANDING_PAGE_HOME
|
LandingPageURL = LANDING_PAGE_HOME
|
||||||
}
|
}
|
||||||
|
|
||||||
SSH.RootPath = path.Join(homeDir, ".ssh")
|
SSH.RootPath = path.Join(homeDir, ".ssh")
|
||||||
|
|
|
@ -24,6 +24,8 @@ type SingleInstancePool struct {
|
||||||
// count maintains the number of times an instance with same identity checks in
|
// count maintains the number of times an instance with same identity checks in
|
||||||
// to the pool, and should be reduced to 0 (removed from map) by checking out
|
// to the pool, and should be reduced to 0 (removed from map) by checking out
|
||||||
// with same number of times.
|
// with same number of times.
|
||||||
|
// The purpose of count is to delete lock when count down to 0 and recycle memory
|
||||||
|
// from map object.
|
||||||
count map[string]int
|
count map[string]int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,21 +4,21 @@ var csrf;
|
||||||
var suburl;
|
var suburl;
|
||||||
|
|
||||||
function initCommentPreviewTab($form) {
|
function initCommentPreviewTab($form) {
|
||||||
var $tab_menu = $form.find('.tabular.menu');
|
var $tabMenu = $form.find('.tabular.menu');
|
||||||
$tab_menu.find('.item').tab();
|
$tabMenu.find('.item').tab();
|
||||||
$tab_menu.find('.item[data-tab="' + $tab_menu.data('preview') + '"]').click(function () {
|
$tabMenu.find('.item[data-tab="' + $tabMenu.data('preview') + '"]').click(function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
"_csrf": csrf,
|
"_csrf": csrf,
|
||||||
"mode": "gfm",
|
"mode": "gfm",
|
||||||
"context": $this.data('context'),
|
"context": $this.data('context'),
|
||||||
"text": $form.find('.tab.segment[data-tab="' + $tab_menu.data('write') + '"] textarea').val()
|
"text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
|
||||||
},
|
},
|
||||||
function (data) {
|
function (data) {
|
||||||
var $preview_tab = $form.find('.tab.segment[data-tab="' + $tab_menu.data('preview') + '"]');
|
var $previewSegment = $form.find('.tab.segment[data-tab="' + $tabMenu.data('preview') + '"]');
|
||||||
$preview_tab.html(data);
|
$previewSegment.html(data);
|
||||||
emojify.run($preview_tab[0]);
|
emojify.run($previewSegment[0]);
|
||||||
$('pre code', $preview_tab[0]).each(function (i, block) {
|
$('pre code', $previewSegment[0]).each(function (i, block) {
|
||||||
hljs.highlightBlock(block);
|
hljs.highlightBlock(block);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -28,61 +28,65 @@ function initCommentPreviewTab($form) {
|
||||||
buttonsClickOnEnter();
|
buttonsClickOnEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
var previewTab;
|
|
||||||
var previewFileModes;
|
var previewFileModes;
|
||||||
|
|
||||||
function initEditPreviewTab($form) {
|
function initEditPreviewTab($form) {
|
||||||
var $tab_menu = $form.find('.tabular.menu');
|
var $tabMenu = $form.find('.tabular.menu');
|
||||||
$tab_menu.find('.item').tab();
|
$tabMenu.find('.item').tab();
|
||||||
previewTab = $tab_menu.find('.item[data-tab="' + $tab_menu.data('preview') + '"]');
|
var $previewTab = $tabMenu.find('.item[data-tab="' + $tabMenu.data('preview') + '"]');
|
||||||
|
if ($previewTab.length) {
|
||||||
if (previewTab.length) {
|
previewFileModes = $previewTab.data('preview-file-modes').split(',');
|
||||||
previewFileModes = previewTab.data('preview-file-modes').split(',');
|
$previewTab.click(function () {
|
||||||
previewTab.click(function () {
|
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
"_csrf": csrf,
|
"_csrf": csrf,
|
||||||
"mode": "gfm",
|
"mode": "gfm",
|
||||||
"context": $this.data('context'),
|
"context": $this.data('context'),
|
||||||
"text": $form.find('.tab.segment[data-tab="' + $tab_menu.data('write') + '"] textarea').val()
|
"text": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
|
||||||
},
|
},
|
||||||
function (data) {
|
function (data) {
|
||||||
var $preview_tab = $form.find('.tab.segment[data-tab="' + $tab_menu.data('preview') + '"]');
|
var $previewSegment = $form.find('.tab.segment[data-tab="' + $tabMenu.data('preview') + '"]');
|
||||||
$preview_tab.html(data);
|
$previewSegment.html(data);
|
||||||
emojify.run($preview_tab[0]);
|
emojify.run($previewSegment[0]);
|
||||||
$('pre code', $preview_tab[0]).each(function (i, block) {
|
$('pre code', $previewSegment[0]).each(function (i, block) {
|
||||||
hljs.highlightBlock(block);
|
hljs.highlightBlock(block);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonsClickOnEnter();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditDiffTab($form) {
|
function initEditDiffTab($form) {
|
||||||
var $tab_menu = $form.find('.tabular.menu');
|
var $tabMenu = $form.find('.tabular.menu');
|
||||||
$tab_menu.find('.item').tab();
|
$tabMenu.find('.item').tab();
|
||||||
$tab_menu.find('.item[data-tab="' + $tab_menu.data('diff') + '"]').click(function () {
|
$tabMenu.find('.item[data-tab="' + $tabMenu.data('diff') + '"]').click(function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
"_csrf": csrf,
|
"_csrf": csrf,
|
||||||
"context": $this.data('context'),
|
"context": $this.data('context'),
|
||||||
"content": $form.find('.tab.segment[data-tab="' + $tab_menu.data('write') + '"] textarea').val()
|
"content": $form.find('.tab.segment[data-tab="' + $tabMenu.data('write') + '"] textarea').val()
|
||||||
},
|
},
|
||||||
function (data) {
|
function (data) {
|
||||||
var $diff_tab = $form.find('.tab.segment[data-tab="' + $tab_menu.data('diff') + '"]');
|
var $diffPreviewSegment = $form.find('.tab.segment[data-tab="' + $tabMenu.data('diff') + '"]');
|
||||||
$diff_tab.html(data);
|
$diffPreviewSegment.html(data);
|
||||||
emojify.run($diff_tab[0]);
|
emojify.run($diffPreviewSegment[0]);
|
||||||
initCodeView()
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonsClickOnEnter();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function initEditForm() {
|
||||||
|
if ($('.edit.form').length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
initEditPreviewTab($('.edit.form'));
|
||||||
|
initEditDiffTab($('.edit.form'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function initCommentForm() {
|
function initCommentForm() {
|
||||||
if ($('.comment.form').length == 0) {
|
if ($('.comment.form').length == 0) {
|
||||||
return
|
return
|
||||||
|
@ -200,11 +204,6 @@ function initCommentForm() {
|
||||||
selectItem('.select-assignee', '#assignee_id');
|
selectItem('.select-assignee', '#assignee_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditForm() {
|
|
||||||
initEditPreviewTab($('.edit.form'));
|
|
||||||
initEditDiffTab($('.edit.form'));
|
|
||||||
}
|
|
||||||
|
|
||||||
function initInstall() {
|
function initInstall() {
|
||||||
if ($('.install').length == 0) {
|
if ($('.install').length == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -612,7 +611,7 @@ function initWikiForm() {
|
||||||
"code", "quote", "|",
|
"code", "quote", "|",
|
||||||
"unordered-list", "ordered-list", "|",
|
"unordered-list", "ordered-list", "|",
|
||||||
"link", "image", "table", "horizontal-rule", "|",
|
"link", "image", "table", "horizontal-rule", "|",
|
||||||
"clean-block", "preview", "fullscreen", "side-by-side"]
|
"clean-block", "preview", "fullscreen"]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue