diff --git a/.bra.toml b/.bra.toml index d0229e8ab9..5fac22f584 100644 --- a/.bra.toml +++ b/.bra.toml @@ -14,7 +14,7 @@ watch_dirs = [ watch_exts = [".go", ".ini"] build_delay = 1500 cmds = [ - ["go", "install", "-tags", "sqlite cert"], - ["go", "build", "-tags", "sqlite cert"], + ["go", "install", "-tags", "sqlite redis cert"], + ["go", "build", "-tags", "sqlite redis cert"], ["./gogs", "web"] ] \ No newline at end of file diff --git a/.gopmfile b/.gopmfile index 2455f1041d..aca9e0feed 100644 --- a/.gopmfile +++ b/.gopmfile @@ -16,7 +16,7 @@ github.com/go-xorm/xorm = commit:2d8b3135b1 github.com/gogits/gfm = commit:40f747a9c0 github.com/gogits/oauth2 = commit:99cbec870a github.com/lib/pq = commit:b021d0ef20 -github.com/macaron-contrib/cache = commit:204d8e5137 +github.com/macaron-contrib/cache = github.com/macaron-contrib/captcha = commit:d37d37eeea github.com/macaron-contrib/csrf = github.com/macaron-contrib/i18n = commit:2246f45894 diff --git a/gogs.go b/gogs.go index e0ecec251a..5a3f5114cd 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.5.5.1013 Beta" +const APP_VER = "0.5.5.1014 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/base/markdown.go b/modules/base/markdown.go index cb08320099..7b371dbd9c 100644 --- a/modules/base/markdown.go +++ b/modules/base/markdown.go @@ -91,6 +91,14 @@ func (options *CustomRender) Link(out *bytes.Buffer, link []byte, title []byte, options.Renderer.Link(out, link, title, content) } +func (options *CustomRender) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) { + if len(link) > 0 && !isLink(link) { + link = []byte(path.Join(strings.Replace(options.urlPrefix, "/src/", "/raw/", 1), string(link))) + } + + options.Renderer.Image(out, link, title, alt) +} + var ( MentionPattern = regexp.MustCompile(`@[0-9a-zA-Z_]{1,}`) commitPattern = regexp.MustCompile(`(\s|^)https?.*commit/[0-9a-zA-Z]+(#+[0-9a-zA-Z-]*)?`) diff --git a/public/ng/css/gogs.css b/public/ng/css/gogs.css index 52a503cc4d..48aac6e3d9 100644 --- a/public/ng/css/gogs.css +++ b/public/ng/css/gogs.css @@ -980,7 +980,6 @@ The register and sign-in page style background-color: #FFF; margin-left: -15px; } -/* repository main */ #repo-wrapper { padding-bottom: 100px; } @@ -1554,20 +1553,15 @@ The register and sign-in page style .diff-box .panel-header { font-size: 14px; } -.diff-file-box .code-diff tbody tr:hover td, -.diff-file-box .code-diff tbody tr:hover pre { - background-color: #FFF8D2 !important; - border-color: #F0DB88 !important; -} -.diff-file-box .file-body.file-code .lines-num-old { - border-right: 1px solid #DDD; -} -.file-content .file-body.file-code .lines-num { +.diff-file-box .file-body.file-code .lines-num { text-align: right; color: #999; background: #fafafa; width: 1%; } +.diff-file-box .file-body.file-code .lines-num-old { + border-right: 1px solid #DDD; +} .diff-file-box .code-diff tbody tr.tag-code td, .diff-file-box .code-diff tbody tr.tag-code pre { background-color: #E0E0E0 !important; @@ -1583,6 +1577,11 @@ The register and sign-in page style background-color: #d1ffd6 !important; border-color: #b4e2b4 !important; } +.diff-file-box .code-diff tbody tr:hover td, +.diff-file-box .code-diff tbody tr:hover pre { + background-color: #FFF8D2 !important; + border-color: #F0DB88 !important; +} .compare-head-box { margin-top: 10px; } diff --git a/public/ng/less/gogs/repository.less b/public/ng/less/gogs/repository.less index 423aeeb65d..0163b42bbf 100644 --- a/public/ng/less/gogs/repository.less +++ b/public/ng/less/gogs/repository.less @@ -3,493 +3,490 @@ @repoHeaderBgColor: #FFF; @repoHeaderNameColor: #888; -/* repository main */ - #repo-wrapper { - padding-bottom: 100px; + padding-bottom: 100px; } #repo-header { - height: 69px; - border-bottom: 1px solid@repoHeaderBorderColor; - background-color: @repoHeaderBgColor; + height: 69px; + border-bottom: 1px solid@repoHeaderBorderColor; + background-color: @repoHeaderBgColor; } #repo-header-name { - line-height: 66px; - color: @repoHeaderNameColor; - font-size: 1.6em; - font-weight: normal; - margin-bottom: 0; - i { - margin-right: 12px; - vertical-align: middle; - } - .divider { - margin: 0 4px; - } + line-height: 66px; + color: @repoHeaderNameColor; + font-size: 1.6em; + font-weight: normal; + margin-bottom: 0; + i { + margin-right: 12px; + vertical-align: middle; + } + .divider { + margin: 0 4px; + } } #repo-header-meta { - line-height: 66px; - li { - > a { - padding: 0; - &:hover { - background-color: transparent; - } + line-height: 66px; + li { + >a { + padding: 0; + &:hover { + background-color: transparent; + } + } } - } - a { - & > .btn { - line-height: 16px; - margin-left: 16px; - font-size: 13px; - i { - margin-right: 6px; - } - .num { - margin-left: 6px; - } + a { + &>.btn { + line-height: 16px; + margin-left: 16px; + font-size: 13px; + i { + margin-right: 6px; + } + .num { + margin-left: 6px; + } + } } - } } #repo-header-download-btn { - > .btn > i { - margin-right: 0 !important; - } - &:hover { - &:after, .btn { - background-color: @btnHoverBlackColor; - color: #FFF; + >.btn>i { + margin-right: 0 !important; } - } - &:after { - background-color: @btnBlackColor; - padding: 9px 16px 8px 0; - margin-left: -8px !important; - color: #FFF; - border-top: 1px solid@btnBlackColor; - border-bottom: 1px solid@btnBlackColor; - border-top-right-radius: .25em; - border-bottom-right-radius: .25em; - } -} -#repo-header-download-drop { - line-height: 24px; - width: 440px; - top: 50px; - left: -370px; - padding: 20px; - box-sizing: border-box; - z-index: 1; - .btn > i { - margin-right: 6px; - } - button, - input { - font-size: 11px; - } -} -#repo-content { - padding: 18px 0; -} -.repo-wide-wrapper { - padding: 18px 0; - position: relative; -} -#repo-clone-url { - border-right: none; - width: 190px; - border-left: none; -} -#repo-clone-help { - clear: both; - line-height: 48px; -} -#repo-clone-zip { - line-height: 48px; - a { - cursor: pointer; - color: white; - overflow: visible; - padding: .6em 1.2em; - } - .btn { - margin: 0 6px; - } -} -#repo-desc { - font-size: 1.2em; - .no-description{ - color: #999; - } -} -#repo-sidebar-nav { - .label { - font-size: 12px; - line-height: 1.4em; - margin-top: 2px; - } - i { - margin-right: 6px; - } -} -#repo-sidebar-mini { - margin-top: 6px; - width: 60px; - li { - margin-bottom: 4px; - } - li > a { - position: relative; - padding-left: 12px; - width: 24px; - text-align: center; - > i.octicon { - font-size: 21px; - } - } - .num { - position: absolute; - font-size: 12px; - top: 0; - left: 36px; - padding: 0 2px; - min-width: 16px; - height: 16px; - text-align: center; - line-height: 16px; - border-radius: 4px; - opacity: 0.7; - -webkit-transform: scale(0.9); - font-weight: bold; - } -} -#repo-file-nav { - padding: .6em 0 1em 0; - > li > a { - padding-left: 0; &:hover { - background-color: transparent; - } - } - li.repo-jump > a { - padding-right: 0; - .btn { - margin-left: -1px; - } - } -} -#repo-branch-switch { - > a { - .btn { - padding-right: 30px; + &:after, .btn { + background-color: @btnHoverBlackColor; + color: #FFF; + } } &:after { - position: absolute; - top: 12px; - right: 30px; - margin-left: 0; - color: @baseFontColor; - + background-color: @btnBlackColor; + padding: 9px 16px 8px 0; + margin-left: -8px !important; + color: #FFF; + border-top: 1px solid@btnBlackColor; + border-bottom: 1px solid@btnBlackColor; + border-top-right-radius: .25em; + border-bottom-right-radius: .25em; + } +} +#repo-header-download-drop { + line-height: 24px; + width: 440px; + top: 50px; + left: -370px; + padding: 20px; + box-sizing: border-box; + z-index: 1; + .btn>i { + margin-right: 6px; + } + button, input { + font-size: 11px; + } +} +#repo-content { + padding: 18px 0; +} +.repo-wide-wrapper { + padding: 18px 0; + position: relative; +} +#repo-clone-url { + border-right: none; + width: 190px; + border-left: none; +} +#repo-clone-help { + clear: both; + line-height: 48px; +} +#repo-clone-zip { + line-height: 48px; + a { + cursor: pointer; + color: white; + overflow: visible; + padding: .6em 1.2em; + } + .btn { + margin: 0 6px; + } +} +#repo-desc { + font-size: 1.2em; + .no-description{ + color: #999; + } +} +#repo-sidebar-nav { + .label { + font-size: 12px; + line-height: 1.4em; + margin-top: 2px; + } + i { + margin-right: 6px; + } +} +#repo-sidebar-mini { + margin-top: 6px; + width: 60px; + li { + margin-bottom: 4px; + } + li > a { + position: relative; + padding-left: 12px; + width: 24px; + text-align: center; + >i.octicon { + font-size: 21px; + } + } + .num { + position: absolute; + font-size: 12px; + top: 0; + left: 36px; + padding: 0 2px; + min-width: 16px; + height: 16px; + text-align: center; + line-height: 16px; + border-radius: 4px; + opacity: 0.7; + -webkit-transform: scale(0.9); + font-weight: bold; + } +} +#repo-file-nav { + padding: .6em 0 1em 0; + >li>a { + padding-left: 0; + &:hover { + background-color: transparent; + } +} + li.repo-jump > a { + padding-right: 0; + .btn { + margin-left: -1px; + } + } +} +#repo-branch-switch { + >a { + .btn { + padding-right: 30px; + } + &:after { + position: absolute; + top: 12px; + right: 30px; + margin-left: 0; + color: @baseFontColor; + } + } + >.drop-down { + top: 40px; + left: 0; } - } - > .drop-down { - top: 40px; - left: 0; - } } #repo-branch-filter-ipt { - width: 100%; - border-left: none; - border-right: none; - box-sizing: border-box; + width: 100%; + border-left: none; + border-right: none; + box-sizing: border-box; } #repo-branch-tag { - .tab-nav { - border-bottom: 1px solid #EAEAEA; - a { - padding: .3em .8em; + .tab-nav { + border-bottom: 1px solid #EAEAEA; + a { + padding: .3em .8em; + } + .js-tab-nav-show { + background-color: #EEE; + font-weight: bold; + } } - .js-tab-nav-show { - background-color: #EEE; - font-weight: bold; + .switching-list { + max-height: 300px; + overflow-y: auto; } - } - .switching-list { - max-height: 300px; - overflow-y: auto; - } } #repo-branch-list, #repo-tag-list { - li { - i { - margin-right: 12px; - opacity: 0; + li { + i { + margin-right: 12px; + opacity: 0; + } } - } - li.checked { - i { - opacity: 1; + li.checked { + i { + opacity: 1; + } } - } } #repo-bread { - .bread { - padding-right: 0; - font-size: 16px; - font-weight: bold; - } + .bread { + padding-right: 0; + font-size: 16px; + font-weight: bold; + } } #repo-main { - padding-right: 40px; - box-sizing: border-box; + padding-right: 40px; + box-sizing: border-box; } #repo-files-table { - margin-bottom: 20px; - th, td { - text-align: left; - line-height: 32px; - } - td.icon { - width: 16px; - padding-right: .1em; - padding-left: 1em; - } - td.name { - max-width: 120px; - .text-truncate { - max-width: 100%; + margin-bottom: 20px; + th, td { + text-align: left; + line-height: 32px; } - } - td.age { - max-width: 120px; - text-align: right; - } - td.msg { - max-width: 440px; - .text-truncate { - max-width: 100%; + td.icon { + width: 16px; + padding-right: .1em; + padding-left: 1em; } - } - td.age, - td.size, - td.msg a { - color: #888; - } - td.msg a:hover { - color: #428BCA; - text-decoration: underline; - } - tbody { - background-color: #FFF; - tr:hover { - background-color: #ffffEE; + td.name { + max-width: 120px; + .text-truncate { + max-width: 100%; + } } - } - thead { - background-color: #F0F0F0; - .author { - a { + td.age { + max-width: 120px; + text-align: right; + } + td.msg { + max-width: 440px; + .text-truncate { + max-width: 100%; + } + } + td.age, + td.size, + td.msg a { + color: #888; + } + td.msg a:hover { + color: #428BCA; + text-decoration: underline; + } + tbody { + background-color: #FFF; + tr:hover { + background-color: #ffffEE; + } + } + thead { + background-color: #F0F0F0; + .author { + a { margin: 0 .4em; - } + } + } + .last-commit { + strong { + color: #444; + } + .text-truncate { + margin-left: .4em; + } + } + .last-commit .text-truncate, + .age { + font-weight: normal; + color: #888; + } } - .last-commit { - strong { - color: #444; - } - .text-truncate { - margin-left: .4em; - } - } - .last-commit .text-truncate, - .age { - font-weight: normal; - color: #888; - } - } } #repo-readme, #repo-read-file { - margin-bottom: 80px; + margin-bottom: 80px; } #repo-bare-start { - margin-bottom: 100px; - .panel-content { - background-color: #FFF; - } - pre { - margin: 0 40px; - padding: 6px 10px; - border: 1px solid #ddd; - background: #f8f8f8; - } + margin-bottom: 100px; + .panel-content { + background-color: #FFF; + } + pre { + margin: 0 40px; + padding: 6px 10px; + border: 1px solid #ddd; + background: #f8f8f8; + } } .repo-bare { - #repo-bare-start { - h2 { - margin-top: 30px; - margin-bottom: 24px; + #repo-bare-start { + h2 { + margin-top: 30px; + margin-bottom: 24px; + } + } + #repo-header-meta { + display: none; + } + #repo-clone-ssh { + margin-left: 200px; + } + #repo-clone-copy { + margin-right: 200px; + } + #repo-clone-help { + clear: both; + width: 100%; + } + #repo-clone-url { + width: 520px; } - } - #repo-header-meta { - display: none; - } - #repo-clone-ssh { - margin-left: 200px; - } - #repo-clone-copy { - margin-right: 200px; - } - #repo-clone-help { - clear: both; - width: 100%; - } - #repo-clone-url { - width: 520px; - } } + /* repository create */ #team-create-form, #repo-migrate-form, #repo-create-form { - width: 800px; - margin: 60px auto auto auto; - background: white; - h2 { - margin: .5em 1em; - } - .field { - margin: 1.2em 0 2em 0; - } - .ipt { - width: 540px; - } - textarea { - height: 120px; - } - .avatar { - vertical-align: middle; - margin-right: .6em; - width: 28px; - height: 28px; - } - &:hover { - box-shadow: 0px 0px 6px #CCC; - } + width: 800px; + margin: 60px auto auto auto; + background: white; + h2 { + margin: .5em 1em; + } + .field { + margin: 1.2em 0 2em 0; + } + .ipt { + width: 540px; + } + textarea { + height: 120px; + } + .avatar { + vertical-align: middle; + margin-right: .6em; + width: 28px; + height: 28px; + } + &:hover { + box-shadow: 0px 0px 6px #CCC; + } } #repo-create-cancel { - margin-left: 4em; + margin-left: 4em; } #repo-create-owner-list { - top: 30px; - left: 0; - width: auto; - max-width: 300px; - .octicon { - margin-right: 12px; - opacity: 0; - } - .avatar { - width: 20px; - height: 20px; - } - li { - white-space: nowrap; - &.checked { - .octicon { - opacity: 1; - } + top: 30px; + left: 0; + width: auto; + max-width: 300px; + .octicon { + margin-right: 12px; + opacity: 0; } - a { - text-overflow: ellipsis; - -o-text-overflow: ellipsis; - overflow: hidden; + .avatar { + width: 20px; + height: 20px; + } + li { + white-space: nowrap; + &.checked { + .octicon { + opacity: 1; + } + } + a { + text-overflow: ellipsis; + -o-text-overflow: ellipsis; + overflow: hidden; + } } - } } .file-name { - margin-left: 1em; + margin-left: 1em; } .file-size { - font-size: 13px; - color: #888; - margin-left: 1em; + font-size: 13px; + color: #888; + margin-left: 1em; } .code-view { - overflow: auto; - overflow-x: auto; - overflow-y: hidden; - background: white; - .view-raw { - min-height: 40px; - text-align: center; - padding-top: 20px; - .btn { - font-size: 1.05em; - line-height: 16px; - padding: 6px 8px; + overflow: auto; + overflow-x: auto; + overflow-y: hidden; + background: white; + .view-raw { + min-height: 40px; + text-align: center; + padding-top: 20px; + .btn { + font-size: 1.05em; + line-height: 16px; + padding: 6px 8px; + } } - } - table { - width: 100%; - td { - padding: 0; + table { + width: 100%; + td { + padding: 0; + } } - } - .lines-num { - vertical-align: top; - text-align: right; - color: #999; - background: #f5f5f5; - width: 1%; - span { - font-family: Monaco,Menlo,Consolas,"Courier New",monospace; - line-height: 1.6; - padding: 0 10px; - cursor: pointer; - display: block; + .lines-num { + vertical-align: top; + text-align: right; + color: #999; + background: #f5f5f5; + width: 1%; + span { + font-family: Monaco,Menlo,Consolas,"Courier New",monospace; + line-height: 1.6; + padding: 0 10px; + cursor: pointer; + display: block; + } } - } - .lines-code > pre { - border: none; - border-left: 1px solid #ddd; - > ol.linenums > li { - padding: 0 10px; - &.active { - background: #ffffdd; - } + .lines-code > pre { + border: none; + border-left: 1px solid #ddd; + > ol.linenums > li { + padding: 0 10px; + &.active { + background: #ffffdd; + } + } } - } } .repo-setting-zone { - padding: 30px; + padding: 30px; } #team-repositories-list, #team-members-list, #repo-collab-list { - list-style: none; - padding: 10px 0 5px 0; - li.collab { - clear: both; - height: 50px; - padding: 0 15px 0 15px; - } - a.member { - color: #444; - height: 50px; - line-height: 50px; - &:hover { - color: #4183C4; + list-style: none; + padding: 10px 0 5px 0; + li.collab { + clear: both; + height: 50px; + padding: 0 15px 0 15px; + } + a.member { + color: #444; + height: 50px; + line-height: 50px; + &:hover { + color: #4183C4; + } + } + .avatar { + margin-right: 1em; + width: 40px; + } + .remove-collab { + color: #DD4B39; } - } - .avatar { - margin-right: 1em; - width: 40px; - } - .remove-collab { - color: #DD4B39; - } } .repo-user-list-block { position: relative; @@ -595,32 +592,49 @@ font-size: 14px; } } -.diff-file-box .code-diff tbody tr:hover td, .diff-file-box .code-diff tbody tr:hover pre { - background-color: #FFF8D2 !important; - border-color: #F0DB88 !important; +.diff-file-box { + .file-body.file-code { + .lines-num { + text-align: right; + color: #999; + background: #fafafa; + width: 1%; + } + .lines-num-old { + border-right: 1px solid #DDD; + } + } + .code-diff { + tbody { + tr { + &.tag-code { + td, pre { + background-color: #E0E0E0 !important; + border-color: #ADADAD !important; + } + } + &.del-code { + td, pre { + background-color: #ffe2dd !important; + border-color: #e9aeae !important; + } + } + &.add-code { + td, pre { + background-color: #d1ffd6 !important; + border-color: #b4e2b4 !important; + } + } + &:hover { + td, pre { + background-color: #FFF8D2 !important; + border-color: #F0DB88 !important; + } + } + } + } + } } -.diff-file-box .file-body.file-code .lines-num-old { -border-right: 1px solid #DDD; -} -.file-content .file-body.file-code .lines-num { -text-align: right; -color: #999; -background: #fafafa; -width: 1%; -} -.diff-file-box .code-diff tbody tr.tag-code td, .diff-file-box .code-diff tbody tr.tag-code pre { -background-color: #E0E0E0 !important; -border-color: #ADADAD !important; -} -.diff-file-box .code-diff tbody tr.del-code td, .diff-file-box .code-diff tbody tr.del-code pre { -background-color: #ffe2dd !important; -border-color: #e9aeae !important; -} -.diff-file-box .code-diff tbody tr.add-code td, .diff-file-box .code-diff tbody tr.add-code pre { -background-color: #d1ffd6 !important; -border-color: #b4e2b4 !important; -} - .compare-head-box { margin-top: 10px; .compare { diff --git a/templates/.VERSION b/templates/.VERSION index 6955a87118..607d148f00 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.5.5.1013 Beta \ No newline at end of file +0.5.5.1014 Beta \ No newline at end of file diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl index 9dac1cac97..0376664669 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -50,7 +50,7 @@ {{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}

-
    +
      {{range .Diff.Files}}