Forráskód Böngészése

Started Implementing Private Profile #76

Yoginth 7 éve
szülő
commit
90a37f7124

+ 1 - 0
README.md

@@ -1,4 +1,5 @@
 # Git + Rem(ote) = Gitote ❤️
+
 #### Software version control made simple!
 
 Welcome to the [gitote](https://gitote.in) codebase. We are so excited to have you. With your help, we can build out Gitote to be more stable and better serve our platform.

+ 1 - 0
models/user.go

@@ -77,6 +77,7 @@ type User struct {
 	// Permissions
 	IsActive         bool // Activate primary email
 	PrivateEmail     bool
+	PrivateProfile   bool
 	IsBeta           bool
 	IsStaff          bool
 	IsIntern         bool

+ 1 - 0
pkg/form/admin.go

@@ -52,6 +52,7 @@ type AdminEditUser struct {
 	IsMaker          bool
 	IsBugHunter      bool
 	GitoteDeveloper  bool
+	PrivateProfile   bool
 	IsBeta           bool
 	IsStaff          bool
 	IsIntern         bool

+ 13 - 12
pkg/form/user.go

@@ -73,18 +73,19 @@ func (f *SignIn) Validate(ctx *macaron.Context, errs binding.Errors) binding.Err
 }
 
 type UpdateProfile struct {
-	Name         string `binding:"Required;AlphaDashDot;MaxSize(35)"`
-	FullName     string `binding:"MaxSize(100)"`
-	Company      string
-	Description  string `binding:"MaxSize(255)"`
-	Email        string `binding:"Required;Email;MaxSize(254)"`
-	Website      string `binding:"Url;MaxSize(100)"`
-	Location     string `binding:"MaxSize(50)"`
-	Status       string `binding:"MaxSize(25)"`
-	ThemeColor   string
-	IsBeta       bool
-	ShowAds      bool
-	PrivateEmail bool
+	Name           string `binding:"Required;AlphaDashDot;MaxSize(35)"`
+	FullName       string `binding:"MaxSize(100)"`
+	Company        string
+	Description    string `binding:"MaxSize(255)"`
+	Email          string `binding:"Required;Email;MaxSize(254)"`
+	Website        string `binding:"Url;MaxSize(100)"`
+	Location       string `binding:"MaxSize(50)"`
+	Status         string `binding:"MaxSize(25)"`
+	ThemeColor     string
+	IsBeta         bool
+	ShowAds        bool
+	PrivateEmail   bool
+	PrivateProfile bool
 }
 
 type UpdateSocial struct {

+ 1 - 0
routes/admin/users.go

@@ -228,6 +228,7 @@ func EditUserPost(c *context.Context, f form.AdminEditUser) {
 	u.IsBugHunter = f.IsBugHunter
 	u.GitoteDeveloper = f.GitoteDeveloper
 	u.IsBeta = f.IsBeta
+	u.PrivateProfile = f.PrivateProfile
 	u.IsStaff = f.IsStaff
 	u.IsIntern = f.IsIntern
 	u.Recognized = f.Recognized

+ 2 - 0
routes/user/setting.go

@@ -58,6 +58,7 @@ func Settings(c *context.Context) {
 	c.Data["is_beta"] = c.User.IsBeta
 	c.Data["show_ads"] = c.User.ShowAds
 	c.Data["private_email"] = c.User.PrivateEmail
+	c.Data["private_profile"] = c.User.PrivateProfile
 	c.Success(SETTINGS_PROFILE)
 }
 
@@ -125,6 +126,7 @@ func SettingsPost(c *context.Context, f form.UpdateProfile) {
 	c.User.IsBeta = f.IsBeta
 	c.User.ShowAds = f.ShowAds
 	c.User.PrivateEmail = f.PrivateEmail
+	c.User.PrivateProfile = f.PrivateProfile
 
 	if err := models.UpdateUser(c.User); err != nil {
 		c.ServerError("UpdateUser", err)

+ 0 - 23
templates/admin/logs.tmpl

@@ -1,23 +0,0 @@
-{{/** WIP - Beta **/}}
-{{template "base/head" .}}
-<div class="admin monitor">
-	<div class="ui container">
-		<div class="ui grid">
-			{{template "admin/navbar" .}}
-			<div class="twelve wide column content">
-				{{template "base/alert" .}}
-				<h4 class="ui top attached header">
-					Application Logs 📖 <span class="ui basic green label small">Beta</span>
-				</h4>
-				<div class="ui unstackable attached table segment">
-                    <div class="ui existing segment oembed">
-                    	<code>
-                    		{{.AppLog}}
-                    	</code>
-                    </div>
-				</div>
-			</div>
-		</div>
-	</div>
-</div>
-{{template "base/footer" .}}

+ 22 - 0
templates/user/activity.tmpl

@@ -0,0 +1,22 @@
+<div class="ui eleven wide column">
+    <div class="ui secondary pointing menu">
+        <a class="{{if ne .TabName "activity"}}active{{end}} item" href="{{.Owner.HomeLink}}">
+            <i class="menu-icon octicon">📁</i>&nbsp;{{.i18n.Tr "user.repositories"}} <span class="ui grey label mobile-count">{{.Owner.NumRepos}}</span>
+        </a>
+        <a class="item">
+            <a class="{{if eq .TabName "activity"}}active{{end}} item" href="{{.Owner.HomeLink}}?tab=activity">
+                <i class="menu-icon octicon">🔊</i>&nbsp;{{.i18n.Tr "user.activity"}}
+            </a>
+        </a>
+    </div>
+
+    {{if ne .TabName "activity"}}
+        {{template "explore/repo_list" .}}
+        {{template "explore/page" .}}
+    {{else}}
+        <br>
+        <div class="feeds">
+            {{template "user/dashboard/feeds" .}}
+        </div>
+    {{end}}
+</div>

+ 1 - 22
templates/user/profile.tmpl

@@ -239,28 +239,7 @@
 					</div>
 				</div>
 			</div>
-			<div class="ui eleven wide column">
-				<div class="ui secondary pointing menu">
-					<a class="{{if ne .TabName "activity"}}active{{end}} item" href="{{.Owner.HomeLink}}">
-						<i class="menu-icon octicon">📁</i>&nbsp;{{.i18n.Tr "user.repositories"}} <span class="ui grey label mobile-count">{{.Owner.NumRepos}}</span>
-					</a>
-					<a class="item">
-						<a class="{{if eq .TabName "activity"}}active{{end}} item" href="{{.Owner.HomeLink}}?tab=activity">
-							<i class="menu-icon octicon">🔊</i>&nbsp;{{.i18n.Tr "user.activity"}}
-						</a>
-					</a>
-				</div>
-
-				{{if ne .TabName "activity"}}
-					{{template "explore/repo_list" .}}
-					{{template "explore/page" .}}
-				{{else}}
-					<br>
-					<div class="feeds">
-						{{template "user/dashboard/feeds" .}}
-					</div>
-				{{end}}
-			</div>
+			{{template "user/activity" .}}
 		</div>
 	</div>
 </div>