summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskyblue <ssx205@gmail.com>2014-04-03 11:13:44 +0800
committerskyblue <ssx205@gmail.com>2014-04-03 11:13:44 +0800
commitbbadbbdf685a7f6cb1924442a115aa88bb520e07 (patch)
treebc3f500110d3ed49b84d742fd85ee36201098c1b
parentbfdadaa13c5dc289beed8e13c6e0d8a0eabeae37 (diff)
parent1757a59a999be2c1b3a17244231cad6a579282d4 (diff)
downloadgitea-bbadbbdf685a7f6cb1924442a115aa88bb520e07.tar.gz
gitea-bbadbbdf685a7f6cb1924442a115aa88bb520e07.zip
Merge branch 'dev' of github.com:gogits/gogs into dev
-rw-r--r--gogs.go2
-rw-r--r--models/git.go19
-rw-r--r--models/repo.go2
-rw-r--r--modules/mailer/mail.go11
-rw-r--r--modules/middleware/repo.go1
-rwxr-xr-xpublic/css/gogs.css4
-rw-r--r--public/js/ZeroClipboard.swfbin0 -> 1071 bytes
-rw-r--r--public/js/app.js45
-rw-r--r--public/js/lib.js13
-rw-r--r--routers/repo/issue.go16
-rw-r--r--routers/repo/release.go22
-rw-r--r--templates/release/list.tmpl10
-rw-r--r--templates/repo/nav.tmpl4
-rw-r--r--templates/repo/single_bare.tmpl2
-rw-r--r--templates/repo/toolbar.tmpl11
-rw-r--r--web.go25
16 files changed, 152 insertions, 35 deletions
diff --git a/gogs.go b/gogs.go
index a81f3ab597..88f53eeb8e 100644
--- a/gogs.go
+++ b/gogs.go
@@ -19,7 +19,7 @@ import (
// Test that go1.2 tag above is included in builds. main.go refers to this definition.
const go12tag = true
-const APP_VER = "0.2.0.0401 Alpha"
+const APP_VER = "0.2.0.0402 Alpha"
func init() {
base.AppVer = APP_VER
diff --git a/models/git.go b/models/git.go
index d3bad6e0ce..46345d0ffc 100644
--- a/models/git.go
+++ b/models/git.go
@@ -56,6 +56,25 @@ func GetBranches(userName, repoName string) ([]string, error) {
return brs, nil
}
+// GetTags returns all tags of given repository.
+func GetTags(userName, repoName string) ([]string, error) {
+ repo, err := git.OpenRepository(RepoPath(userName, repoName))
+ if err != nil {
+ return nil, err
+ }
+
+ refs, err := repo.AllTags()
+ if err != nil {
+ return nil, err
+ }
+
+ tags := make([]string, len(refs))
+ for i, ref := range refs {
+ tags[i] = ref.Name
+ }
+ return tags, nil
+}
+
func IsBranchExist(userName, repoName, branchName string) bool {
repo, err := git.OpenRepository(RepoPath(userName, repoName))
if err != nil {
diff --git a/models/repo.go b/models/repo.go
index 0c808f1845..e3270b1838 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -74,6 +74,7 @@ type Repository struct {
NumStars int
NumForks int
NumIssues int
+ NumReleases int `xorm:"NOT NULL"`
NumClosedIssues int
NumOpenIssues int `xorm:"-"`
IsPrivate bool
@@ -513,6 +514,7 @@ func NotifyWatchers(act *Action) error {
continue
}
+ act.Id = 0
act.UserId = watches[i].UserId
if _, err = orm.InsertOne(act); err != nil {
return errors.New("repo.NotifyWatchers(create action): " + err.Error())
diff --git a/modules/mailer/mail.go b/modules/mailer/mail.go
index d0decbe068..b99fc8fdfc 100644
--- a/modules/mailer/mail.go
+++ b/modules/mailer/mail.go
@@ -92,8 +92,8 @@ func SendActiveMail(r *middleware.Render, user *models.User) {
}
// SendNotifyMail sends mail notification of all watchers.
-func SendNotifyMail(userId, repoId int64, userName, repoName, subject, content string) error {
- watches, err := models.GetWatches(repoId)
+func SendNotifyMail(user, owner *models.User, repo *models.Repository, issue *models.Issue) error {
+ watches, err := models.GetWatches(repo.Id)
if err != nil {
return errors.New("mail.NotifyWatchers(get watches): " + err.Error())
}
@@ -101,7 +101,7 @@ func SendNotifyMail(userId, repoId int64, userName, repoName, subject, content s
tos := make([]string, 0, len(watches))
for i := range watches {
uid := watches[i].UserId
- if userId == uid {
+ if user.Id == uid {
continue
}
u, err := models.GetUserById(uid)
@@ -115,7 +115,10 @@ func SendNotifyMail(userId, repoId int64, userName, repoName, subject, content s
return nil
}
- msg := NewMailMessageFrom(tos, userName, subject, content)
+ subject := fmt.Sprintf("[%s] %s", repo.Name, issue.Name)
+ content := fmt.Sprintf("%s<br>-<br> <a href=\"%s%s/%s/issues/%d\">View it on Gogs</a>.",
+ issue.Content, base.AppUrl, owner.Name, repo.Name, issue.Index)
+ msg := NewMailMessageFrom(tos, user.Name, subject, content)
msg.Info = fmt.Sprintf("Subject: %s, send notify emails", subject)
SendAsync(&msg)
return nil
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index f446d6a85b..2139742c70 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -79,6 +79,7 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
ctx.Handle(404, "RepoAssignment", err)
return
}
+ repo.NumOpenIssues = repo.NumIssues - repo.NumClosedIssues
ctx.Repo.Repository = repo
ctx.Data["IsBareRepo"] = ctx.Repo.Repository.IsBare
diff --git a/public/css/gogs.css b/public/css/gogs.css
index a018a9dbae..6bed771140 100755
--- a/public/css/gogs.css
+++ b/public/css/gogs.css
@@ -1235,9 +1235,9 @@ html, body {
/* admin dashboard/configuration */
.admin-dl-horizontal > dt {
- width: 320px;
+ width: 220px;
}
.admin-dl-horizontal > dd {
- margin-left: 340px;
+ margin-left: 240px;
}
diff --git a/public/js/ZeroClipboard.swf b/public/js/ZeroClipboard.swf
new file mode 100644
index 0000000000..13bf8e3962
--- /dev/null
+++ b/public/js/ZeroClipboard.swf
Binary files differ
diff --git a/public/js/app.js b/public/js/app.js
index 5181933d24..0ba0675f20 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -159,6 +159,7 @@ var Gogits = {
$tabs.tab("show");
$tabs.find("li:eq(0) a").tab("show");
};
+
// fix dropdown inside click
Gogits.initDropDown = function () {
$('.dropdown-menu.no-propagation').on('click', function (e) {
@@ -166,6 +167,7 @@ var Gogits = {
});
};
+
// render markdown
Gogits.renderMarkdown = function () {
var $md = $('.markdown');
@@ -192,6 +194,7 @@ var Gogits = {
});
};
+ // render code view
Gogits.renderCodeView = function () {
function selectRange($list, $select, $from) {
$list.removeClass('active');
@@ -255,6 +258,43 @@ var Gogits = {
}).trigger('hashchange');
};
+ // copy utils
+ Gogits.bindCopy = function (selector) {
+ if ($(selector).hasClass('js-copy-bind')) {
+ return;
+ }
+ $(selector).zclip({
+ path: "/js/ZeroClipboard.swf",
+ copy: function () {
+ var t = $(this).data("copy-val");
+ var to = $($(this).data("copy-from"));
+ var str = "";
+ if (t == "txt") {
+ str = to.text();
+ }
+ if (t == 'val') {
+ str = to.val();
+ }
+ if (t == 'html') {
+ str = to.html();
+ }
+ return str;
+ },
+ afterCopy: function () {
+ var $this = $(this);
+ $this.tooltip('hide')
+ .attr('data-original-title', 'Copied OK');
+ setTimeout(function () {
+ $this.tooltip("show");
+ }, 200);
+ setTimeout(function () {
+ $this.tooltip('hide')
+ .attr('data-original-title', 'Copy to Clipboard');
+ }, 3000);
+ }
+ }).addClass("js-copy-bind");
+ }
+
})(jQuery);
// ajax utils
@@ -343,7 +383,10 @@ function initRepository() {
$clone.find('span.clone-url').text($this.data('link'));
}
}).eq(0).trigger("click");
- // todo copy to clipboard
+ $("#repo-clone").on("shown.bs.dropdown",function () {
+ Gogits.bindCopy("[data-init=copy]");
+ });
+ Gogits.bindCopy("[data-init=copy]:visible");
}
})();
diff --git a/public/js/lib.js b/public/js/lib.js
index 8735ac9c11..bd42152b0c 100644
--- a/public/js/lib.js
+++ b/public/js/lib.js
@@ -480,3 +480,16 @@ PR.registerLangHandler(PR.createSimpleLexer([["kwd",/^#[a-z]+/i,null,"#"]],[]),[
var a=null;
var a=null;
PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:>?|]+/,a,":|>?"],["dec",/^%(?:YAML|TAG)[^\n\r#]+/,a,"%"],["typ",/^&\S+/,a,"&"],["typ",/^!\S*/,a,"!"],["str",/^"(?:[^"\\]|\\.)*(?:"|$)/,a,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,a,"'"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^\s+/,a," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\n\r]|$)/],["pun",/^-/],["kwd",/^\w+:[\n\r ]/],["pln",/^\w+/]]),["yaml","yml"]);
+
+/*
+ * zClip :: jQuery ZeroClipboard v1.1.1
+ * http://steamdev.com/zclip
+ *
+ * Copyright 2011, SteamDev
+ * Released under the MIT license.
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * Date: Wed Jun 01, 2011
+ */
+
+(function(a){a.fn.zclip=function(c){if(typeof c=="object"&&!c.length){var b=a.extend({path:"ZeroClipboard.swf",copy:null,beforeCopy:null,afterCopy:null,clickAfter:true,setHandCursor:true,setCSSEffects:true},c);return this.each(function(){var e=a(this);if(e.is(":visible")&&(typeof b.copy=="string"||a.isFunction(b.copy))){ZeroClipboard.setMoviePath(b.path);var d=new ZeroClipboard.Client();if(a.isFunction(b.copy)){e.bind("zClip_copy",b.copy)}if(a.isFunction(b.beforeCopy)){e.bind("zClip_beforeCopy",b.beforeCopy)}if(a.isFunction(b.afterCopy)){e.bind("zClip_afterCopy",b.afterCopy)}d.setHandCursor(b.setHandCursor);d.setCSSEffects(b.setCSSEffects);d.addEventListener("mouseOver",function(f){e.trigger("mouseenter")});d.addEventListener("mouseOut",function(f){e.trigger("mouseleave")});d.addEventListener("mouseDown",function(f){e.trigger("mousedown");if(!a.isFunction(b.copy)){d.setText(b.copy)}else{d.setText(e.triggerHandler("zClip_copy"))}if(a.isFunction(b.beforeCopy)){e.trigger("zClip_beforeCopy")}});d.addEventListener("complete",function(f,g){if(a.isFunction(b.afterCopy)){e.trigger("zClip_afterCopy")}else{if(g.length>500){g=g.substr(0,500)+"...\n\n("+(g.length-500)+" characters not shown)"}e.removeClass("hover");alert("Copied text to clipboard:\n\n "+g)}if(b.clickAfter){e.trigger("click")}});d.glue(e[0],e.parent()[0]);a(window).bind("load resize",function(){d.reposition()})}})}else{if(typeof c=="string"){return this.each(function(){var f=a(this);c=c.toLowerCase();var e=f.data("zclipId");var d=a("#"+e+".zclip");if(c=="remove"){d.remove();f.removeClass("active hover")}else{if(c=="hide"){d.hide();f.removeClass("active hover")}else{if(c=="show"){d.show()}}}})}}}})(jQuery);var ZeroClipboard={version:"1.0.7",clients:{},moviePath:"ZeroClipboard.swf",nextId:1,$:function(a){if(typeof(a)=="string"){a=document.getElementById(a)}if(!a.addClass){a.hide=function(){/*this.style.display="none"*/};a.show=function(){this.style.display=""};a.addClass=function(b){this.removeClass(b);this.className+=" "+b};a.removeClass=function(d){var e=this.className.split(/\s+/);var b=-1;for(var c=0;c<e.length;c++){if(e[c]==d){b=c;c=e.length}}if(b>-1){e.splice(b,1);this.className=e.join(" ")}return this};a.hasClass=function(b){return !!this.className.match(new RegExp("\\s*"+b+"\\s*"))}}return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(d,b,c){var a=this.clients[d];if(a){a.receiveEvent(b,c)}},register:function(b,a){this.clients[b]=a},getDOMObjectPosition:function(c,a){var b={left:0,top:0,width:c.width?c.width:c.offsetWidth,height:c.height?c.height:c.offsetHeight};if(c&&(c!=a)){b.left+=c.offsetLeft;b.top+=c.offsetTop}return b},Client:function(a){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);if(a){this.glue(a)}}};ZeroClipboard.Client.prototype={id:0,ready:false,movie:null,clipText:"",handCursorEnabled:true,cssEffects:true,handlers:null,glue:function(d,b,e){this.domElement=ZeroClipboard.$(d);var f=99;if(this.domElement.style.zIndex){f=parseInt(this.domElement.style.zIndex,10)+1}if(typeof(b)=="string"){b=ZeroClipboard.$(b)}else{if(typeof(b)=="undefined"){b=document.getElementsByTagName("body")[0]}}var c=ZeroClipboard.getDOMObjectPosition(this.domElement,b);this.div=document.createElement("div");this.div.className="zclip";this.div.id="zclip-"+this.movieId;$(this.domElement).data("zclipId","zclip-"+this.movieId);var a=this.div.style;a.position="absolute";a.left=""+c.left+"px";a.top=""+c.top+"px";a.width=""+c.width+"px";a.height=""+c.height+"px";a.zIndex=f;if(typeof(e)=="object"){for(addedStyle in e){a[addedStyle]=e[addedStyle]}}b.appendChild(this.div);this.div.innerHTML=this.getHTML(c.width,c.height)},getHTML:function(d,a){var c="";var b="id="+this.id+"&width="+d+"&height="+a;if(navigator.userAgent.match(/MSIE/)){var e=location.href.match(/^https/i)?"https://":"http://";c+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+d+'" height="'+a+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+b+'"/><param name="wmode" value="transparent"/></object>'}else{c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+d+'" height="'+a+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+b+'" wmode="transparent" />'}return c},hide:function(){if(this.div){this.div.style.left="-2000px"}},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.domElement=null;this.div=null}},reposition:function(c){if(c){this.domElement=ZeroClipboard.$(c);if(!this.domElement){this.hide()}}if(this.domElement&&this.div){var b=ZeroClipboard.getDOMObjectPosition(this.domElement);var a=this.div.style;a.left=""+b.left+"px";a.top=""+b.top+"px"}},setText:function(a){this.clipText=a;if(this.ready){this.movie.setText(a)}},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");if(!this.handlers[a]){this.handlers[a]=[]}this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a;if(this.ready){this.movie.setHandCursor(a)}},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(d,f){d=d.toString().toLowerCase().replace(/^on/,"");switch(d){case"load":this.movie=document.getElementById(this.movieId);if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=true;return}this.ready=true;try{this.movie.setText(this.clipText)}catch(h){}try{this.movie.setHandCursor(this.handCursorEnabled)}catch(h){}break;case"mouseover":if(this.domElement&&this.cssEffects){this.domElement.addClass("hover");if(this.recoverActive){this.domElement.addClass("active")}}break;case"mouseout":if(this.domElement&&this.cssEffects){this.recoverActive=false;if(this.domElement.hasClass("active")){this.domElement.removeClass("active");this.recoverActive=true}this.domElement.removeClass("hover")}break;case"mousedown":if(this.domElement&&this.cssEffects){this.domElement.addClass("active")}break;case"mouseup":if(this.domElement&&this.cssEffects){this.domElement.removeClass("active");this.recoverActive=false}break}if(this.handlers[d]){for(var b=0,a=this.handlers[d].length;b<a;b++){var g=this.handlers[d][b];if(typeof(g)=="function"){g(this,f)}else{if((typeof(g)=="object")&&(g.length==2)){g[0][g[1]](this,f)}else{if(typeof(g)=="string"){window[g](this,f)}}}}}}}; \ No newline at end of file
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 6cad2c25d2..be92542641 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -31,7 +31,8 @@ func Issues(ctx *middleware.Context) {
ctx.Data["IssueCreatedCount"] = 0
var posterId int64 = 0
- if ctx.Query("type") == "created_by" {
+ isCreatedBy := ctx.Query("type") == "created_by"
+ if isCreatedBy {
if !ctx.IsSigned {
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
ctx.Redirect("/user/login/", 302)
@@ -53,6 +54,7 @@ func Issues(ctx *middleware.Context) {
}
var createdByCount int
+ showIssues := make([]models.Issue, 0, len(issues))
// Get posters.
for i := range issues {
u, err := models.GetUserById(issues[i].PosterId)
@@ -60,15 +62,19 @@ func Issues(ctx *middleware.Context) {
ctx.Handle(200, "issue.Issues(get poster): %v", err)
return
}
- issues[i].Poster = u
+ if isCreatedBy && u.Id != posterId {
+ continue
+ }
if u.Id == posterId {
createdByCount++
}
+ issues[i].Poster = u
+ showIssues = append(showIssues, issues[i])
}
- ctx.Data["Issues"] = issues
+ ctx.Data["Issues"] = showIssues
ctx.Data["IssueCount"] = ctx.Repo.Repository.NumIssues
- ctx.Data["OpenCount"] = ctx.Repo.Repository.NumIssues - ctx.Repo.Repository.NumClosedIssues
+ ctx.Data["OpenCount"] = ctx.Repo.Repository.NumOpenIssues
ctx.Data["ClosedCount"] = ctx.Repo.Repository.NumClosedIssues
ctx.Data["IssueCreatedCount"] = createdByCount
ctx.Data["IsShowClosed"] = ctx.Query("state") == "closed"
@@ -107,7 +113,7 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat
// Mail watchers.
if base.Service.NotifyMail {
- if err = mailer.SendNotifyMail(ctx.User.Id, ctx.Repo.Repository.Id, ctx.User.Name, ctx.Repo.Repository.Name, issue.Name, issue.Content); err != nil {
+ if err = mailer.SendNotifyMail(ctx.User, ctx.Repo.Owner, ctx.Repo.Repository, issue); err != nil {
ctx.Handle(200, "issue.CreateIssue", err)
return
}
diff --git a/routers/repo/release.go b/routers/repo/release.go
new file mode 100644
index 0000000000..8e8b93c9ea
--- /dev/null
+++ b/routers/repo/release.go
@@ -0,0 +1,22 @@
+// Copyright 2014 The Gogs Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package repo
+
+import (
+ "github.com/gogits/gogs/models"
+ "github.com/gogits/gogs/modules/middleware"
+)
+
+func Releases(ctx *middleware.Context) {
+ ctx.Data["Title"] = "Releases"
+ ctx.Data["IsRepoToolbarReleases"] = true
+ tags, err := models.GetTags(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
+ if err != nil {
+ ctx.Handle(404, "repo.Releases(GetTags)", err)
+ return
+ }
+ ctx.Data["Releases"] = tags
+ ctx.HTML(200, "release/list")
+}
diff --git a/templates/release/list.tmpl b/templates/release/list.tmpl
new file mode 100644
index 0000000000..7d582e3ff8
--- /dev/null
+++ b/templates/release/list.tmpl
@@ -0,0 +1,10 @@
+{{template "base/head" .}}
+{{template "base/navbar" .}}
+{{template "repo/nav" .}}
+{{template "repo/toolbar" .}}
+<div id="body" class="container">
+ {{range .Releases}}
+ {{.}}
+ {{end}}
+</div>
+{{template "base/footer" .}} \ No newline at end of file
diff --git a/templates/repo/nav.tmpl b/templates/repo/nav.tmpl
index 6156d5791e..3ce27f921e 100644
--- a/templates/repo/nav.tmpl
+++ b/templates/repo/nav.tmpl
@@ -18,9 +18,9 @@
<button class="btn btn-default" data-link="{{.CloneLink.SSH}}" type="button">SSH</button>
<button class="btn btn-default" data-link="{{.CloneLink.HTTPS}}" type="button">HTTPS</button>
</span>
- <input type="text" class="form-control clone-group-url" value="" readonly/>
+ <input type="text" class="form-control clone-group-url" value="" readonly id="repo-clone-ipt"/>
<span class="input-group-btn">
- <button class="btn btn-default" type="button"><i class="fa fa-copy" data-toggle="tooltip" title="copy to clipboard" data-placement="top"></i></button>
+ <button class="btn btn-default" type="button" data-toggle="tooltip" title="copy to clipboard" data-placement="top" data-init="copy" data-copy-val="val" data-copy-from="#repo-clone-ipt"><i class="fa fa-copy"></i></button>
</span>
</div>
<p class="help-block text-center">Need help cloning? Visit <a href="#">Help</a>!</p>
diff --git a/templates/repo/single_bare.tmpl b/templates/repo/single_bare.tmpl
index 035e78e8b0..fc0a3bd96c 100644
--- a/templates/repo/single_bare.tmpl
+++ b/templates/repo/single_bare.tmpl
@@ -17,7 +17,7 @@
</span>
<input type="text" class="form-control clone-group-url" id="guide-clone-url" value="" readonly/>
<span class="input-group-btn">
- <button class="btn btn-default" type="button"><i class="fa fa-copy" data-toggle="tooltip" title="copy to clipboard" data-placement="top"></i></button>
+ <button class="btn btn-default" type="button" data-toggle="tooltip" title="copy to clipboard" data-placement="top" data-init="copy" data-copy-val="val" data-copy-from="#guide-clone-url"><i class="fa fa-copy"></i></button>
</span>
</div>
<p>We recommend every repository include a <strong>README</strong>, <strong>LICENSE</strong>, and <strong>.gitignore</strong>.</p>
diff --git a/templates/repo/toolbar.tmpl b/templates/repo/toolbar.tmpl
index 6b48ecf506..08167ef82b 100644
--- a/templates/repo/toolbar.tmpl
+++ b/templates/repo/toolbar.tmpl
@@ -8,18 +8,15 @@
<li class="{{if .IsRepoToolbarCommits}}active{{end}}"><a href="{{.RepoLink}}/commits/{{if .BranchName}}{{.BranchName}}{{else}}master{{end}}">Commits</a></li>
<!-- <li class="{{if .IsRepoToolbarBranches}}active{{end}}"><a href="{{.RepoLink}}/branches">Branches</a></li> -->
<!-- <li class="{{if .IsRepoToolbarPulls}}active{{end}}"><a href="{{.RepoLink}}/pulls">Pull Requests</a></li> -->
- <li class="{{if .IsRepoToolbarIssues}}active{{end}}"><a href="{{.RepoLink}}/issues">Issues <!--<span class="badge">42</span>--></a></li>
+ <li class="{{if .IsRepoToolbarIssues}}active{{end}}"><a href="{{.RepoLink}}/issues">{{if .Repository.NumOpenIssues}}<span class="badge">{{.Repository.NumOpenIssues}}</span> {{end}}Issues <!--<span class="badge">42</span>--></a></li>
{{if .IsRepoToolbarIssues}}
- <li class="tmp">{{if .IsRepoToolbarIssuesList}}<a href="{{.RepoLink}}/issues/new">
- <button class="btn btn-primary btn-sm">New Issue</button>
- </a>{{else}}<a href="{{.RepoLink}}/issues">
- <button class="btn btn-primary btn-sm">Issues List</button>
- </a>{{end}}</li>
+ <li class="tmp">{{if .IsRepoToolbarIssuesList}}<a href="{{.RepoLink}}/issues/new"><button class="btn btn-primary btn-sm">New Issue</button>
+ </a>{{else}}<a href="{{.RepoLink}}/issues"><button class="btn btn-primary btn-sm">Issues List</button></a>{{end}}</li>
{{end}}
+ <li class="{{if .IsRepoToolbarReleases}}active{{end}}"><a href="{{.RepoLink}}/releases">{{if .Repository.NumReleases}}<span class="badge">{{.Repository.NumReleases}}</span> {{end}}Releases</a></li>
<!-- <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">More <b class="caret"></b></a>
<ul class="dropdown-menu">
- <li><a href="{{.RepoLink}}/release">Release</a></li>
<li><a href="{{.RepoLink}}/wiki">Wiki</a></li>
</ul>
</li> -->{{end}}
diff --git a/web.go b/web.go
index 48d80b4fed..5fc3350f1f 100644
--- a/web.go
+++ b/web.go
@@ -11,8 +11,8 @@ import (
"github.com/codegangsta/cli"
"github.com/go-martini/martini"
- "github.com/martini-contrib/oauth2"
- "github.com/martini-contrib/sessions"
+ // "github.com/martini-contrib/oauth2"
+ // "github.com/martini-contrib/sessions"
"github.com/gogits/binding"
@@ -60,15 +60,15 @@ func runWeb(*cli.Context) {
// Middlewares.
m.Use(middleware.Renderer(middleware.RenderOptions{Funcs: []template.FuncMap{base.TemplateFuncs}}))
- scope := "https://api.github.com/user"
- oauth2.PathCallback = "/oauth2callback"
- m.Use(sessions.Sessions("my_session", sessions.NewCookieStore([]byte("secret123"))))
- m.Use(oauth2.Github(&oauth2.Options{
- ClientId: "09383403ff2dc16daaa1",
- ClientSecret: "5f6e7101d30b77952aab22b75eadae17551ea6b5",
- RedirectURL: base.AppUrl + oauth2.PathCallback,
- Scopes: []string{scope},
- }))
+ // scope := "https://api.github.com/user"
+ // oauth2.PathCallback = "/oauth2callback"
+ // m.Use(sessions.Sessions("my_session", sessions.NewCookieStore([]byte("secret123"))))
+ // m.Use(oauth2.Github(&oauth2.Options{
+ // ClientId: "09383403ff2dc16daaa1",
+ // ClientSecret: "5f6e7101d30b77952aab22b75eadae17551ea6b5",
+ // RedirectURL: base.AppUrl + oauth2.PathCallback,
+ // Scopes: []string{scope},
+ // }))
m.Use(middleware.InitContext())
@@ -92,7 +92,7 @@ func runWeb(*cli.Context) {
m.Get("/avatar/:hash", avt.ServeHTTP)
m.Group("/user", func(r martini.Router) {
- r.Any("/login/github", user.SocialSignIn)
+ // r.Any("/login/github", user.SocialSignIn)
r.Any("/login", binding.BindIgnErr(auth.LogInForm{}), user.SignIn)
r.Any("/sign_up", binding.BindIgnErr(auth.RegisterForm{}), user.SignUp)
}, reqSignOut)
@@ -147,6 +147,7 @@ func runWeb(*cli.Context) {
m.Group("/:username/:reponame", func(r martini.Router) {
r.Get("/issues", repo.Issues)
r.Get("/issues/:index", repo.ViewIssue)
+ r.Get("/releases", repo.Releases)
r.Get("/pulls", repo.Pulls)
r.Get("/branches", repo.Branches)
}, ignSignIn, middleware.RepoAssignment(true))