1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-10-30 08:27:32 -04:00

Merge branch 'master' of github.com:gogits/gogs

This commit is contained in:
slene 2014-03-20 23:37:38 +08:00
commit 88eaa68763
5 changed files with 55 additions and 8 deletions

View File

@ -20,7 +20,7 @@ import (
// Test that go1.1 tag above is included in builds. main.go refers to this definition. // Test that go1.1 tag above is included in builds. main.go refers to this definition.
const go11tag = true const go11tag = true
const APP_VER = "0.1.1.0320.1" const APP_VER = "0.1.2.0320.1"
func init() { func init() {
base.AppVer = APP_VER base.AppVer = APP_VER

View File

@ -411,6 +411,10 @@ func DeleteRepository(userId, repoId int64, userName string) (err error) {
session.Rollback() session.Rollback()
return err return err
} }
if _, err = session.Delete(&Watch{RepoId: repoId}); err != nil {
session.Rollback()
return err
}
if err = session.Commit(); err != nil { if err = session.Commit(); err != nil {
session.Rollback() session.Rollback()
return err return err

View File

@ -445,7 +445,7 @@ html, body {
padding: 0; padding: 0;
} }
#gogs-repo-watching .dropdown-menu .dropdown-item:hover .dropdown-header { #gogs-repo-watching .dropdown-menu .dropdown-item:hover .dropdown-header, #gogs-repo-watching .dropdown-item .dropdown-header.text-primary {
color: rgb(65, 131, 196); color: rgb(65, 131, 196);
cursor: pointer; cursor: pointer;
} }
@ -678,7 +678,7 @@ html, body {
} }
.file-content .file-body.file-code .lines-num span { .file-content .file-body.file-code .lines-num span {
font-family: Menlo,Monaco,Consolas,"Courier New",monospace; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
line-height: 1.6; line-height: 1.6;
padding: 0 8px 0 10px; padding: 0 8px 0 10px;
cursor: pointer; cursor: pointer;
@ -783,6 +783,10 @@ html, body {
width: 120px; width: 120px;
} }
.commit-list .author {
min-width: 180px;
}
.guide-box pre, .guide-box .input-group { .guide-box pre, .guide-box .input-group {
margin-top: 20px; margin-top: 20px;
margin-bottom: 30px; margin-bottom: 30px;

View File

@ -181,6 +181,7 @@ function initUserSetting() {
} }
function initRepository() { function initRepository() {
// guide box script
(function () { (function () {
var $guide = $('.guide-box'); var $guide = $('.guide-box');
if ($guide.length) { if ($guide.length) {
@ -197,6 +198,40 @@ function initRepository() {
// todo copy to clipboard // todo copy to clipboard
} }
})(); })();
// watching script
(function () {
var $watch = $('#gogs-repo-watching'),
watchLink = $watch.data("watch"),
unwatchLink = $watch.data("unwatch");
$watch.on('click', '.to-watch',function () {
if ($watch.hasClass("watching")) {
return false;
}
$.get(watchLink, function (json) {
if (json.ok) {
$watch.find('.text-primary').removeClass('text-primary');
$watch.find('.to-watch h4').addClass('text-primary');
$watch.find('.fa-eye-slash').removeClass('fa-eye-slash').addClass('fa-eye');
$watch.removeClass("no-watching").addClass("watching");
}
});
return false;
}).on('click', '.to-unwatch', function () {
if ($watch.hasClass("no-watching")) {
return false;
}
$.get(unwatchLink, function (json) {
if (json.ok) {
$watch.find('.text-primary').removeClass('text-primary');
$watch.find('.to-unwatch h4').addClass('text-primary');
$watch.find('.fa-eye').removeClass('fa-eye').addClass('fa-eye-slash');
$watch.removeClass("watching").addClass("no-watching");
}
});
return false;
});
})();
} }
(function ($) { (function ($) {

View File

@ -13,20 +13,24 @@
<span class="caret"></span> <span class="caret"></span>
</button> </button>
</div> </div>
<div class="btn-group {{if .IsRepositoryWatching}}watching{{end}}" id="gogs-repo-watching"> <div class="btn-group {{if .IsRepositoryWatching}}watching{{else}}no-watching{{end}}" id="gogs-repo-watching" data-watch="/{{.SignedUser.Name}}/{{.Repository.Name}}/action/watch" data-unwatch="/{{.SignedUser.Name}}/{{.Repository.Name}}/action/unwatch">
{{if .IsRepositoryWatching}}
<button type="button" class="btn btn-default"><i class="fa fa-eye fa-lg fa-m"></i></button> <button type="button" class="btn btn-default"><i class="fa fa-eye fa-lg fa-m"></i></button>
{{else}}
<button type="button" class="btn btn-default"><i class="fa fa-eye-slash fa-lg fa-m"></i></button>
{{end}}
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span> <span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span> <span class="sr-only">Toggle Dropdown</span>
</button> </button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
<div class="dropdown-item text-left" data-val="not-watching"> <div class="dropdown-item text-left to-unwatch">
<h4 role="presentation" class="dropdown-header">Not Watching</h4> <h4 role="presentation" class="dropdown-header {{if not .IsRepositoryWatching}}text-primary{{end}}">Not Watching</h4>
<p class="description">You only receive notifications for conversations in which you participate or are @mentioned.</p> <p class="description">You only receive notifications for conversations in which you participate or are @mentioned.</p>
<p class="divider"></p> <p class="divider"></p>
</div> </div>
<div class="dropdown-item text-left" data-val="watching"> <div class="dropdown-item text-left to-watch">
<h4 role="presentation" class="dropdown-header">Watching</h4> <h4 role="presentation" class="dropdown-header {{if .IsRepositoryWatching}}text-primary{{end}}">Watching</h4>
<p class="description">You receive notifications for all conversations in this repository.</p> <p class="description">You receive notifications for all conversations in this repository.</p>
</div> </div>
</div> </div>