Browse Source

Merge branch 'dev' of github.com:gogits/gogs into dev

lunnyxiao 11 years ago
parent
commit
a6ec6def8d

File diff suppressed because it is too large
+ 48 - 0
conf/locale/locale_en-US.ini


File diff suppressed because it is too large
+ 48 - 0
conf/locale/locale_zh-CN.ini


+ 16 - 5
models/models.go

@@ -143,27 +143,38 @@ func NewEngine() (err error) {
 
 type Statistic struct {
 	Counter struct {
-		User, PublicKey, Repo, Watch, Action, Access,
-		Issue, Comment, Mirror, Oauth, Release,
-		LoginSource, Webhook, Milestone int64
+		User, Org, PublicKey,
+		Repo, Watch, Star, Action, Access,
+		Issue, Comment, Oauth, Follow,
+		Mirror, Release, LoginSource, Webhook,
+		Milestone, Label, HookTask,
+		Team, UpdateTask, Attachment int64
 	}
 }
 
 func GetStatistic() (stats Statistic) {
 	stats.Counter.User = CountUsers()
-	stats.Counter.Repo = CountRepositories()
+	stats.Counter.Org = CountOrganizations()
 	stats.Counter.PublicKey, _ = x.Count(new(PublicKey))
+	stats.Counter.Repo = CountRepositories()
 	stats.Counter.Watch, _ = x.Count(new(Watch))
+	stats.Counter.Star, _ = x.Count(new(Star))
 	stats.Counter.Action, _ = x.Count(new(Action))
 	stats.Counter.Access, _ = x.Count(new(Access))
 	stats.Counter.Issue, _ = x.Count(new(Issue))
 	stats.Counter.Comment, _ = x.Count(new(Comment))
-	stats.Counter.Mirror, _ = x.Count(new(Mirror))
 	stats.Counter.Oauth, _ = x.Count(new(Oauth2))
+	stats.Counter.Follow, _ = x.Count(new(Follow))
+	stats.Counter.Mirror, _ = x.Count(new(Mirror))
 	stats.Counter.Release, _ = x.Count(new(Release))
 	stats.Counter.LoginSource, _ = x.Count(new(LoginSource))
 	stats.Counter.Webhook, _ = x.Count(new(Webhook))
 	stats.Counter.Milestone, _ = x.Count(new(Milestone))
+	stats.Counter.Label, _ = x.Count(new(Label))
+	stats.Counter.HookTask, _ = x.Count(new(HookTask))
+	stats.Counter.Team, _ = x.Count(new(Team))
+	stats.Counter.UpdateTask, _ = x.Count(new(UpdateTask))
+	stats.Counter.Attachment, _ = x.Count(new(Attachment))
 	return
 }
 

+ 6 - 0
models/org.go

@@ -159,6 +159,12 @@ func CreateOrganization(org, owner *User) (*User, error) {
 	return org, sess.Commit()
 }
 
+// CountOrganizations returns number of organizations.
+func CountOrganizations() int64 {
+	count, _ := x.Where("type=1").Count(new(User))
+	return count
+}
+
 // TODO: need some kind of mechanism to record failure.
 // DeleteOrganization completely and permanently deletes everything of organization.
 func DeleteOrganization(org *User) (err error) {

+ 9 - 9
models/user.go

@@ -45,13 +45,13 @@ var (
 // User represents the object of individual and member of organization.
 type User struct {
 	Id            int64
-	LowerName     string `xorm:"unique not null"`
-	Name          string `xorm:"unique not null"`
+	LowerName     string `xorm:"UNIQUE NOT NULL"`
+	Name          string `xorm:"UNIQUE NOT NULL"`
 	FullName      string
-	Email         string `xorm:"unique not null"`
-	Passwd        string `xorm:"not null"`
+	Email         string `xorm:"UNIQUE NOT NULL"`
+	Passwd        string `xorm:"NOT NULL"`
 	LoginType     LoginType
-	LoginSource   int64 `xorm:"not null default 0"`
+	LoginSource   int64 `xorm:"NOT NULL DEFAULT 0"`
 	LoginName     string
 	Type          UserType
 	Orgs          []*User       `xorm:"-"`
@@ -60,16 +60,16 @@ type User struct {
 	NumFollowings int
 	NumStars      int
 	NumRepos      int
-	Avatar        string `xorm:"varchar(2048) not null"`
-	AvatarEmail   string `xorm:"not null"`
+	Avatar        string `xorm:"VARCHAR(2048) NOT NULL"`
+	AvatarEmail   string `xorm:"NOT NULL"`
 	Location      string
 	Website       string
 	IsActive      bool
 	IsAdmin       bool
 	Rands         string    `xorm:"VARCHAR(10)"`
 	Salt          string    `xorm:"VARCHAR(10)"`
-	Created       time.Time `xorm:"created"`
-	Updated       time.Time `xorm:"updated"`
+	Created       time.Time `xorm:"CREATED"`
+	Updated       time.Time `xorm:"UPDATED"`
 
 	// For organization.
 	Description string

+ 42 - 0
public/ng/css/gogs.css

@@ -234,6 +234,24 @@ img.avatar-100 {
 .text-black {
   color: #444444;
 }
+.table {
+  width: 100%;
+  max-width: 100%;
+}
+.table > thead > tr > th,
+.table > tbody > tr > th,
+.table > tfoot > tr > th,
+.table > thead > tr > td,
+.table > tbody > tr > td,
+.table > tfoot > tr > td {
+  border-top: 1px solid #e7eaec;
+  line-height: 1.42857;
+  padding: 8px;
+  vertical-align: top;
+}
+th {
+  text-align: left;
+}
 .markdown {
   background-color: white;
   font-size: 16px;
@@ -1342,6 +1360,7 @@ The register and sign-in page style
   width: 100%;
   list-style: none;
 }
+#admin-wrapper,
 #setting-wrapper {
   padding-bottom: 100px;
 }
@@ -1906,3 +1925,26 @@ textarea#issue-add-content {
   height: 40px;
   line-height: 40px;
 }
+.admin-desc {
+  padding: 10px 20px;
+}
+.admin-table {
+  padding: 15px 20px 5px 20px;
+}
+.dl-horizontal dt {
+  float: left;
+  width: 160px;
+  clear: left;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.admin-dl-horizontal {
+  padding: 20px;
+}
+.admin-dl-horizontal > dt {
+  width: 250px;
+}
+.admin-dl-horizontal > dd {
+  margin-left: 240px;
+}

+ 2 - 2
public/ng/css/ui.css

@@ -261,6 +261,7 @@ optgroup {
   font-weight: bold;
 }
 table {
+  background-color: transparent;
   border-collapse: collapse;
   border-spacing: 0;
 }
@@ -683,8 +684,7 @@ ul.menu-radius > li:last-child > a {
   background-color: white;
 }
 .panel .panel-body .panel-desc {
-  padding: 0 40px;
-  margin-bottom: 20px;
+  padding: 0 40px 20px 40px;
 }
 .panel .panel-content {
   padding: 1em 1.2em;

+ 2 - 1
public/ng/less/gogs.less

@@ -6,4 +6,5 @@
 @import "gogs/repository";
 @import "gogs/settings";
 @import "gogs/issue";
-@import "gogs/organization";
+@import "gogs/organization";
+@import "gogs/admin";

+ 23 - 0
public/ng/less/gogs/admin.less

@@ -0,0 +1,23 @@
+.admin-desc {
+	padding: 10px 20px;
+}
+.admin-table {
+	padding: 15px 20px 5px 20px;
+}
+.dl-horizontal dt {
+	float: left;
+	width: 160px;
+	clear: left;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+}
+.admin-dl-horizontal {
+	padding: 20px;
+	> dt {
+		width: 250px;
+	}
+	> dd {
+		margin-left: 240px;
+	}
+}

+ 18 - 0
public/ng/less/gogs/base.less

@@ -250,4 +250,22 @@ clear: both;
 }
 .text-black {
     color: #444444;
+}
+.table {
+    width: 100%;
+    max-width: 100%;
+}
+.table > thead > tr > th, 
+.table > tbody > tr > th, 
+.table > tfoot > tr > th, 
+.table > thead > tr > td, 
+.table > tbody > tr > td, 
+.table > tfoot > tr > td {
+    border-top: 1px solid #e7eaec;
+    line-height: 1.42857;
+    padding: 8px;
+    vertical-align: top;
+}
+th {
+    text-align: left;
 }

+ 1 - 1
public/ng/less/gogs/settings.less

@@ -1,5 +1,5 @@
 @import "../ui/var";
-
+#admin-wrapper,
 #setting-wrapper {
     padding-bottom: 100px;
 }

+ 1 - 2
public/ng/less/ui/panel.less

@@ -10,8 +10,7 @@
     .panel-body {
         background-color: white;
         .panel-desc {
-            padding: 0 40px;
-            margin-bottom: 20px;
+            padding: 0 40px 20px 40px;
         }
     }
     .panel-content {

+ 3 - 3
public/ng/less/ui/reset.less

@@ -321,10 +321,10 @@ optgroup {
 }
 
 // table elements
-
 table {
-  border-collapse: collapse;
-  border-spacing: 0;
+    background-color: transparent;
+    border-collapse: collapse;
+    border-spacing: 0;
 }
 
 td,

+ 3 - 2
routers/admin/admin.go

@@ -123,8 +123,9 @@ const (
 )
 
 func Dashboard(ctx *middleware.Context) {
-	ctx.Data["Title"] = "Admin Dashboard"
-	ctx.Data["PageIsDashboard"] = true
+	ctx.Data["Title"] = ctx.Tr("admin.dashboard")
+	ctx.Data["PageIsAdmin"] = true
+	ctx.Data["PageIsAdminDashboard"] = true
 
 	// Run operation.
 	op, _ := com.StrTo(ctx.Query("op")).Int()

File diff suppressed because it is too large
+ 145 - 137
templates/admin/dashboard.tmpl


+ 13 - 9
templates/admin/nav.tmpl

@@ -1,10 +1,14 @@
-<div id="user-setting-nav" class="col-md-2 admin-nav">
-    <ul class="list-group">
-        <li class="list-group-item{{if .PageIsDashboard}} active{{end}}"><a href="/admin"><i class="fa fa-tachometer fa-lg"></i> Dashboard</a></li>
-        <li class="list-group-item{{if .PageIsUsers}} active{{end}}"><a href="/admin/users"><i class="fa fa-users fa-lg"></i> Users</a></li>
-        <li class="list-group-item{{if .PageIsRepos}} active{{end}}"><a href="/admin/repos"><i class="fa fa-book fa-lg"></i> Repositories</a></li>
-        <li class="list-group-item{{if .PageIsAuths}} active{{end}}"><a href="/admin/auths"><i class="fa fa-certificate fa-lg"></i> Authentication</a></li>
-        <li class="list-group-item{{if .PageIsConfig}} active{{end}}"><a href="/admin/config"><i class="fa fa-cogs fa-lg"></i> Configuration</a></li>
-        <li class="list-group-item{{if .PageIsMonitor}} active{{end}}"><a href="/admin/monitor"><i class="fa fa-th fa-lg"></i> Monitoring</a></li>
-    </ul>
+<div id="setting-menu" class="grid-1-5 panel panel-radius left">
+    <p class="panel-header"><strong>{{.i18n.Tr "admin_panel"}}</strong></p>
+    <div class="panel-body">
+        <ul class="menu menu-vertical switching-list grid-1-5 left">
+            <li {{if .PageIsAdminDashboard}}class="current"{{end}}><a href="/admin">{{.i18n.Tr "admin.dashboard"}}</a></li>
+            <li {{if .PageIsAdminUsers}}class="current"{{end}}><a href="/admin/users">{{.i18n.Tr "admin.users"}}</a></li>
+            <li {{if .PageIsAdminOrganizations}}class="current"{{end}}><a href="/admin/orgs">{{.i18n.Tr "admin.organizations"}}</a></li>
+            <li {{if .PageIsAdminRepositories}}class="current"{{end}}><a href="/admin/repos">{{.i18n.Tr "admin.repositories"}}</a></li>
+            <li {{if .PageIsAdminAuthentication}}class="current"{{end}}><a href="/admin/auths">{{.i18n.Tr "admin.authentication"}}</a></li>
+            <li {{if .PageIsAdminConfig}}class="current"{{end}}><a href="/admin/config">{{.i18n.Tr "admin.config"}}</a></li>
+            <li {{if .PageIsAdminMonitor}}class="current"{{end}}><a href="/admin/monitor">{{.i18n.Tr "admin.monitor"}}</a></li>
+        </ul>
+    </div>
 </div>

+ 3 - 19
templates/base/navbar.tmpl

@@ -27,7 +27,9 @@
                 <img src="{{.SignedUser.AvatarLink}}?s=28" alt="user-avatar" title="username"/>
             </a>
             <a class="navbar-right nav-item{{if .PageIsUserSetting}} active{{end}}" href="/user/settings"  data-toggle="tooltip" data-placement="bottom" title="Settings"><i class="fa fa-cogs fa-lg"></i></a>
-            {{if .IsAdmin}}<a class="navbar-right nav-item{{if .PageIsAdmin}} active{{end}}" href="/admin"  data-toggle="tooltip" data-placement="bottom" title="Admin"><i class="fa fa-gear fa-lg"></i></a>{{end}}
+            {{if .IsAdmin}}
+            <a class="navbar-right nav-item{{if .PageIsAdmin}} active{{end}}" href="/admin"  data-toggle="tooltip" data-placement="bottom" title="Admin"><i class="fa fa-gear fa-lg"></i></a>
+            {{end}}
             <div class="navbar-right nav-item pull-right{{if .PageIsNewRepo}} active{{end}}" id="nav-repo-new" data-toggle="tooltip" data-placement="bottom" title="New Repo">
                 <button type="button" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus-square fa-lg"></i></button>
                 <div class="dropdown-menu">
@@ -45,21 +47,3 @@
         </nav>
     </div>
 </div>
-<!--<nav class="navbar navbar-inverse navbar-fixed-top">
-	<div class="container">
-		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
-				<i class="fa fa-bars"></i>
-			</button>
-			<a class="navbar-brand" href="/"><img src="/img/favicon.png" alt="Gogs Logo"></a>
-		</div>
-
-		<div class="collapse navbar-collapse" id="gopmweb-navbar-collapse">
-			<ul class="nav navbar-nav">
-				<li><a>{{.Title}}</a></li>
-			</ul>
-			
-			<a href="/user/signin" class="navbar-right btn btn-success navbar-btn">Sign In</a>
-		</div>
-	</div>
-</nav>-->

+ 1 - 1
templates/ng/base/header.tmpl

@@ -19,7 +19,7 @@
             <a href="/user/settings" title="{{.i18n.Tr "account_settings"}}"><i class="octicon octicon-settings"></i></a>
         </li>
             {{if .IsAdmin}}
-            <li class="right">
+            <li class="right {{if .PageIsAdmin}}current{{end}}">
                 <a href="/admin" title="{{.i18n.Tr "admin_panel"}}"><i class="octicon octicon-circuit-board"></i></a>
             </li>
             {{end}}

+ 1 - 1
templates/repo/settings/options.tmpl

@@ -9,7 +9,7 @@
 	            <div class="setting-content">
 	                {{template "ng/base/alert" .}}
 	                <div id="setting-content">
-	                    <div id="user-profile-setting-content" class="panel panel-radius">
+	                    <div class="panel panel-radius">
 	                        <div class="panel-header">
 	                        	<strong>{{.i18n.Tr "repo.settings.basic_settings"}}</strong>
 	                        </div>