aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/base/markdown.go26
-rw-r--r--public/js/app.js9
-rw-r--r--public/ng/css/gogs.css57
-rw-r--r--public/ng/js/gogs.js9
-rw-r--r--public/ng/less/gogs/issue.less58
-rw-r--r--public/ng/less/gogs/repository.less2
-rw-r--r--routers/api/v1/user.go1
-rw-r--r--templates/repo/issue2/list.tmpl32
8 files changed, 172 insertions, 22 deletions
diff --git a/modules/base/markdown.go b/modules/base/markdown.go
index 7b371dbd..c85bd020 100644
--- a/modules/base/markdown.go
+++ b/modules/base/markdown.go
@@ -100,10 +100,11 @@ func (options *CustomRender) Image(out *bytes.Buffer, link []byte, title []byte,
}
var (
- MentionPattern = regexp.MustCompile(`@[0-9a-zA-Z_]{1,}`)
- commitPattern = regexp.MustCompile(`(\s|^)https?.*commit/[0-9a-zA-Z]+(#+[0-9a-zA-Z-]*)?`)
- issueFullPattern = regexp.MustCompile(`(\s|^)https?.*issues/[0-9]+(#+[0-9a-zA-Z-]*)?`)
- issueIndexPattern = regexp.MustCompile(`#[0-9]+`)
+ MentionPattern = regexp.MustCompile(`@[0-9a-zA-Z_]{1,}`)
+ commitPattern = regexp.MustCompile(`(\s|^)https?.*commit/[0-9a-zA-Z]+(#+[0-9a-zA-Z-]*)?`)
+ issueFullPattern = regexp.MustCompile(`(\s|^)https?.*issues/[0-9]+(#+[0-9a-zA-Z-]*)?`)
+ issueIndexPattern = regexp.MustCompile(`#[0-9]+`)
+ sha1CurrentPattern = regexp.MustCompile(`\b[0-9a-f]{40}\b`)
)
func RenderSpecialLink(rawBytes []byte, urlPrefix string) []byte {
@@ -153,7 +154,22 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string) []byte {
rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(
` <a href="%s">#%s</a>`, m, ShortSha(string(m[i+7:j])))), -1)
}
- ms = issueIndexPattern.FindAll(rawBytes, -1)
+ rawBytes = RenderissueIndexPattern(rawBytes, urlPrefix)
+ rawBytes = RenderSha1CurrentPattern(rawBytes, urlPrefix)
+ return rawBytes
+}
+
+func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte {
+ ms := sha1CurrentPattern.FindAll(rawBytes, -1)
+ for _, m := range ms {
+ rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(
+ `<a href="%s/commit/%s"><code>%s</code></a>`, urlPrefix, m, ShortSha(string(m)))), -1)
+ }
+ return rawBytes
+}
+
+func RenderissueIndexPattern(rawBytes []byte, urlPrefix string) []byte {
+ ms := issueIndexPattern.FindAll(rawBytes, -1)
for _, m := range ms {
rawBytes = bytes.Replace(rawBytes, m, []byte(fmt.Sprintf(
`<a href="%s/issues/%s">%s</a>`, urlPrefix, m[1:], m)), -1)
diff --git a/public/js/app.js b/public/js/app.js
index 2a7cf08b..23b629e3 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -303,6 +303,9 @@ var Gogits = {};
// api working
Gogits.getUsers = function (val, $target) {
+ var notEmpty = function (str) {
+ return str && str.length > 0;
+ }
$.ajax({
url: '/api/v1/users/search?q=' + val,
dataType: "json",
@@ -310,7 +313,11 @@ var Gogits = {};
if (json.ok && json.data.length) {
var html = '';
$.each(json.data, function (i, item) {
- html += '<li><img src="' + item.avatar + '">' + item.username + '</li>';
+ html += '<li><img src="' + item.avatar + '">' + item.username;
+ if (notEmpty(item.full_name)) {
+ html += ' (' + item.full_name + ')';
+ }
+ html += '</li>';
});
$target.toggleShow();
$target.find('ul').html(html);
diff --git a/public/ng/css/gogs.css b/public/ng/css/gogs.css
index 6fbc218a..dad84583 100644
--- a/public/ng/css/gogs.css
+++ b/public/ng/css/gogs.css
@@ -1416,7 +1416,7 @@ The register and sign-in page style
}
.code-view .lines-num span {
font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
- line-height: 1.6;
+ line-height: 20px;
padding: 0 10px;
cursor: pointer;
display: block;
@@ -2061,10 +2061,6 @@ textarea#issue-add-content {
font-size: 15px;
margin: 0 6px;
}
-#issue-list .item .index-num,
-#pull-list .item .index-num {
- padding: .25em .6em;
-}
#issue-list .comment,
#pull-list .comment {
color: #666;
@@ -2072,10 +2068,6 @@ textarea#issue-add-content {
top: 6px;
right: 0;
}
-#issue-list .issue-label,
-#pull-list .issue-label {
- padding: .25em .6em;
-}
#issue-list .issue-label a,
#pull-list .issue-label a {
color: #FFF;
@@ -2092,6 +2084,53 @@ textarea#issue-add-content {
#pull-list .desc a:hover {
color: #03a2ef;
}
+#issue-list-filter .drop > a {
+ width: 90px;
+ padding: 0;
+ margin-left: 12px;
+ text-align: center;
+}
+#issue-list-filter .drop-down {
+ z-index: 999;
+ width: 236px;
+ left: -158px;
+ top: 22px;
+ padding: 0 12px;
+}
+#issue-list-filter .drop-down h4 {
+ line-height: 40px;
+ border-bottom: 1px solid #CCC;
+ margin-bottom: 0;
+}
+#issue-list-filter .drop-down li {
+ line-height: 30px;
+ border-bottom: 1px dashed #EEE;
+ padding-left: 9px;
+}
+#issue-list-filter .drop-down li:hover {
+ background-color: #fcffec;
+}
+#issue-list-filter .drop-down > ul > li > a {
+ display: block;
+}
+#issue-list-filter .labels .color {
+ margin-top: 8px;
+ display: inline-block;
+ width: 12px;
+ height: 12px;
+ background-color: red;
+ margin-right: 9px;
+ margin-left: 9px;
+}
+#issue-list-filter .labels .name {
+ vertical-align: top;
+ display: inline-block;
+ color: #444;
+}
+#issue-list-filter .milestones a {
+ color: #444;
+ font-weight: bold;
+}
#issue-list-pager {
margin: 18px 0 24px 0;
font-size: 14px;
diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js
index 3578cd7c..1d5a113e 100644
--- a/public/ng/js/gogs.js
+++ b/public/ng/js/gogs.js
@@ -203,6 +203,9 @@ var Gogs = {};
// Search users by keyword.
Gogs.searchUsers = function (val, $target) {
+ var notEmpty = function (str) {
+ return str && str.length > 0;
+ }
$.ajax({
url: Gogs.AppSubUrl + '/api/v1/users/search?q=' + val,
dataType: "json",
@@ -210,7 +213,11 @@ var Gogs = {};
if (json.ok && json.data.length) {
var html = '';
$.each(json.data, function (i, item) {
- html += '<li><a><img src="' + item.avatar_url + '">' + item.username + '</a></li>';
+ html += '<li><a><img src="' + item.avatar_url + '">' + item.username;
+ if (notEmpty(item.full_name)) {
+ html += ' (' + item.full_name + ')';
+ }
+ html += '</a></li>';
});
$target.html(html);
$target.toggleShow();
diff --git a/public/ng/less/gogs/issue.less b/public/ng/less/gogs/issue.less
index e03f79e3..15f3a32d 100644
--- a/public/ng/less/gogs/issue.less
+++ b/public/ng/less/gogs/issue.less
@@ -295,9 +295,6 @@ textarea#issue-add-content {
font-size: 15px;
margin: 0 6px;
}
- .index-num {
- padding: .25em .6em;
- }
}
.comment {
color: #666;
@@ -306,7 +303,6 @@ textarea#issue-add-content {
right: 0;
}
.issue-label {
- padding: .25em .6em;
a {
color: #FFF;
}
@@ -321,6 +317,60 @@ textarea#issue-add-content {
}
}
}
+// issue list filter
+#issue-list-filter{
+ .drop > a{
+ width: 90px;
+ padding: 0;
+ margin-left: 12px;
+ text-align: center;
+ }
+ .drop-down{
+ z-index: 999;
+ width: 236px;
+ left:-158px; // 260 - 90 - 12
+ top:22px;
+ padding: 0 12px;
+ h4{
+ line-height: 40px;
+ border-bottom: 1px solid #CCC;
+ margin-bottom: 0;
+ }
+ li{
+ line-height: 30px;
+ border-bottom: 1px dashed #EEE;
+ padding-left: 9px;
+ &:hover{
+ background-color: #fcffec;
+ }
+ }
+ > ul > li > a{
+ display: block;
+ }
+ }
+ .labels{
+ .color{
+ margin-top: 8px;
+ display: inline-block;
+ width: 12px;
+ height: 12px;
+ background-color: red;
+ margin-right: 9px;
+ margin-left: 9px;
+ }
+ .name{
+ vertical-align: top;
+ display: inline-block;
+ color: #444;
+ }
+ }
+ .milestones{
+ a{
+ color: #444;
+ font-weight: bold;
+ }
+ }
+}
// issue list pager
#issue-list-pager {
margin: 18px 0 24px 0;
diff --git a/public/ng/less/gogs/repository.less b/public/ng/less/gogs/repository.less
index 45387fec..4eef314b 100644
--- a/public/ng/less/gogs/repository.less
+++ b/public/ng/less/gogs/repository.less
@@ -447,7 +447,7 @@
width: 1%;
span {
font-family: Monaco,Menlo,Consolas,"Courier New",monospace;
- line-height: 1.6;
+ line-height: 20px;
padding: 0 10px;
cursor: pointer;
display: block;
diff --git a/routers/api/v1/user.go b/routers/api/v1/user.go
index 2b41adae..15c423f7 100644
--- a/routers/api/v1/user.go
+++ b/routers/api/v1/user.go
@@ -37,6 +37,7 @@ func SearchUsers(ctx *middleware.Context) {
results[i] = &api.User{
UserName: us[i].Name,
AvatarUrl: us[i].AvatarLink(),
+ FullName: us[i].FullName,
}
}
diff --git a/templates/repo/issue2/list.tmpl b/templates/repo/issue2/list.tmpl
index db69afb7..c7a271d1 100644
--- a/templates/repo/issue2/list.tmpl
+++ b/templates/repo/issue2/list.tmpl
@@ -9,7 +9,7 @@
<li><a href="#">Labels</a></li>
<li><a href="#">Milestones</a></li>
<li class="right" id="issue-new"><a href="#"><button id="issue-new-btn" class="btn btn-green text-bold">New Issue</button></a></li>
- <li class="right"><a href="#">Filter</a></li>
+ <!--<li class="right"><a href="#">Filter</a></li>-->
</ul>
<div id="issue-list-container">
<div id="issue-list-menu">
@@ -21,6 +21,36 @@
<i class="octicon octicon-issue-closed"></i> 12 Close
</a></span>
</div>
+ <ul id="issue-list-filter" class="right menu menu-line">
+ <li class="down drop label-filter">
+ <a href="#">Labels</a>
+ <div class="drop-down">
+ <h4>Labels</h4>
+ <ul class="labels list-no-style">
+ <li class="no-label"><strong>no label</strong></li>
+ <li><a href="#"><span class="color"></span><span class="name">bug</span></a></li>
+ <li><a href="#"><span class="color"></span><span class="name">feature</span></a></li>
+ <li><a href="#"><span class="color"></span><span class="name">roadmap</span></a></li>
+ </ul>
+ </div>
+ </li>
+ <li class="down drop milestone-filter">
+ <a href="#">Milestones</a>
+ <div class="drop-down">
+ <h4>Milestones</h4>
+ <ul class="milestones list-no-style">
+ <li class="no-label"><strong>no milestone</strong></li>
+ <li><a href="#">v1</a></li>
+ </ul>
+ </div>
+ </li>
+ <li class="down drop assignee-list">
+ <a href="#">Assignee</a>
+ <div class="drop-down">
+ aabbcc
+ </div>
+ </li>
+ </ul>
<div class="clear"></div>
</div>
<ul id="issue-list" class="list-no-style">