Procházet zdrojové kódy

Remove News in Admin panel and Closes #24

Yoginth před 6 roky
rodič
revize
e6706b95c8

+ 0 - 6
cmd/web.go

@@ -262,12 +262,6 @@ func runWeb(c *cli.Context) error {
 		m.Get("/monitor", admin.Monitor)
 		m.Get("/allusers", admin.AllUsers)
 		
-		m.Group("/news", func() {
-			m.Get("", admin.News)
-			m.Get("/new", admin.NewsNew)
-			m.Get("/edit", admin.NewsEdit)
-		})
-		
 		m.Group("/users", func() {
 			m.Get("", admin.Users)
 			m.Combo("/new").Get(admin.NewUser).Post(bindIgnErr(form.AdminCreateUser{}), admin.NewUserPost)

+ 0 - 43
routes/admin/news.go

@@ -1,43 +0,0 @@
-// Copyright 2015 - Present, The Gogs Authors. All rights reserved.
-// Copyright 2018 - Present, Gitote. All rights reserved.
-//
-// This source code is licensed under the MIT license found in the
-// LICENSE file in the root directory of this source tree.
-
-package admin
-
-import (
-	"gitote/gitote/pkg/context"
-)
-
-const (
-	// NewsTPL list page template
-	NewsTPL = "admin/news/list"
-
-	// NewsNewTPL page template
-	NewsNewTPL = "admin/news/new"
-
-	// NewsEditTPL page template
-	NewsEditTPL = "admin/news/edit"
-)
-
-// News shows news page
-func News(c *context.Context) {
-	c.Data["Title"] = "News"
-	c.Data["PageIsAdminNews"] = true
-	c.HTML(200, NewsTPL)
-}
-
-// NewsNew shows new news page
-func NewsNew(c *context.Context) {
-	c.Data["Title"] = "News"
-	c.Data["PageIsAdminNews"] = true
-	c.HTML(200, NewsNewTPL)
-}
-
-// NewsEdit shows edit news page
-func NewsEdit(c *context.Context) {
-	c.Data["Title"] = "News"
-	c.Data["PageIsAdminNews"] = true
-	c.HTML(200, NewsEditTPL)
-}

+ 0 - 4
templates/admin/navbar.tmpl

@@ -4,10 +4,6 @@
 		<a class="{{if .PageIsAdminDashboard}}active{{end}} item" href="{{AppSubURL}}/admin">
 			📈 Dashboard
 		</a>
-		<a class="{{if .PageIsAdminNews}}active{{end}} item" href="{{AppSubURL}}/admin/news">
-			🌐 News
-			<span class="ui green basic label small">Beta</span>
-		</a>
 		<a class="{{if .PageIsAdminUsers}}active{{end}} item" href="{{AppSubURL}}/admin/users">
 			👦 Users
 		</a>

+ 0 - 228
templates/admin/news/edit.tmpl

@@ -1,228 +0,0 @@
-{{template "base/head" .}}
-<div class="admin edit user">
-	<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">
-					Edit Account 🖊
-				</h4>
-				<div class="ui attached segment">
-					<form class="ui form" action="{{.Link}}" method="post">
-						{{.CSRFTokenHTML}}
-						<div class="inline field {{if .Err_UserName}}error{{end}}">
-							<label for="user_name">Username</label>
-							<a class="ui image label {{if .User.Suspended}}red{{end}}" href="{{AppURL}}{{.User.Name}}" target="_blank">
-								<img src="{{AppendAvatarSize .User.RelAvatarLink 40}}"> {{.User.Name}}
-							</a>
-							<div class="ui label">
-								Followers <div class="detail">{{.User.NumFollowers}}</div>
-							</div>
-							<div class="ui label">
-								Following <div class="detail">{{.User.NumFollowing}}</div>
-							</div>
-						</div>
-						<!-- Types and name -->
-						<div class="inline required field {{if .Err_LoginType}}error{{end}}">
-							<label>Authentication Source</label>
-							<div class="ui selection type dropdown">
-								<input type="hidden" id="login_type" name="login_type" value="{{.LoginSource.Type}}-{{.LoginSource.ID}}" required>
-								<div class="text">Local</div>
-								<i class="dropdown icon"></i>
-								<div class="menu">
-									<div class="item" data-value="0-0">Local</div>
-									{{range .Sources}}
-										<div class="item" data-value="{{.Type}}-{{.ID}}">{{.Name}}</div>
-									{{end}}
-								</div>
-							</div>
-						</div>
-						<div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .User.LoginSource 0}}hide{{end}}">
-							<label for="login_name">Authentication Login Name</label>
-							<input id="login_name" name="login_name" value="{{.User.LoginName}}" autofocus>
-						</div>
-						<div class="field {{if .Err_FullName}}error{{end}}">
-							<label for="full_name">Full Name</label>
-							<input id="full_name" name="full_name" value="{{.User.FullName}}">
-						</div>
-						<div class="field {{if .Err_Description}}error{{end}}">
-							<label for="description">Description</label>
-							<textarea id="description" name="description" rows="2">{{.User.Description}}</textarea>
-						</div>
-						<div class="field {{if .Err_Company}}error{{end}}">
-							<label for="company">Company</label>
-							<input id="company" name="company" value="{{.User.Company}}">
-						</div>
-						<div class="required field {{if .Err_Email}}error{{end}}">
-							<label for="email">Email</label>
-							<input id="email" name="email" type="email" value="{{.User.Email}}" autofocus required>
-						</div>
-						<input class="fake" type="password">
-						<div class="local field {{if .Err_Password}}error{{end}} {{if not (eq .User.LoginSource 0)}}hide{{end}}">
-							<label for="password">Password</label>
-							<input id="password" name="password" type="password">
-							<p class="help">Leave it empty to remain unchanged.</p>
-						</div>
-						<div class="field {{if .Err_Website}}error{{end}}">
-							<label for="website">Website</label>
-							<input id="website" name="website" type="url" value="{{.User.Website}}" placeholder="e.g. https://mydomain.com">
-						</div>
-						<div class="field {{if .Err_Location}}error{{end}}">
-							<label for="location">Location</label>
-							<input id="location" name="location" value="{{.User.Location}}">
-						</div>
-						<div class="field {{if .Err_Twitter}}error{{end}}">
-							<label for="twitter">Twitter</label>
-							<input id="twitter" name="twitter" value="{{.User.Twitter}}">
-						</div>
-						<div class="field {{if .Err_Linkedin}}error{{end}}">
-							<label for="linkedin">Linkedin</label>
-							<input id="linkedin" name="linkedin" value="{{.User.Linkedin}}">
-						</div>
-						<div class="field {{if .Err_Github}}error{{end}}">
-							<label for="github">GitHub</label>
-							<input id="github" name="github" value="{{.User.Github}}">
-						</div>
-						<div class="field {{if .Err_Gitlab}}error{{end}}">
-							<label for="gitlab">GitLab</label>
-							<input id="gitlab" name="gitlab" value="{{.User.Gitlab}}">
-						</div>
-						<div class="field {{if .Err_Stackoverflow}}error{{end}}">
-							<label for="stackoverflow">Stackoverflow</label>
-							<input id="stackoverflow" name="stackoverflow" value="{{.User.Stackoverflow}}">
-						</div>
-						<div class="field {{if .Err_Twitch}}error{{end}}">
-							<label for="twitch">Twitch</label>
-							<input id="twitch" name="twitch" value="{{.User.Twitch}}">
-						</div>
-						<div class="field {{if .Err_Telegram}}error{{end}}">
-							<label for="telegram">Telegram</label>
-							<input id="telegram" name="telegram" value="{{.User.Telegram}}">
-						</div>
-						<div class="field {{if .Err_Codepen}}error{{end}}">
-							<label for="codepen">Codepen</label>
-							<input id="codepen" name="codepen" value="{{.User.Codepen}}">
-						</div>
-						<div class="field {{if .Err_Notes}}error{{end}}">
-							<label for="staff_notes">Staff Notes</label>
-							<textarea id="staff_notes" name="staff_notes" rows="2">{{.User.StaffNotes}}</textarea>
-							<p class="help">Take notes about <b>{{.User.Name}}</b> for future purpose.</p>
-							<p class="help"><b>Note:</b> This will displayed as <b>reason</b> on prohibited page</p>
-						</div>
-
-						<div class="ui divider"></div>
-
-						<div class="inline field {{if .Err_MaxRepoCreation}}error{{end}}">
-							<label for="max_repo_creation">Maximum Repository Creation Limit</label>
-							<input id="max_repo_creation" name="max_repo_creation" type="number" value="{{.User.MaxRepoCreation}}">
-							<p class="help">(Set -1 to use global default limit)</p>
-						</div>
-
-						<div class="ui divider"></div>
-
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong>This account is activated</strong></label>
-								<input name="active" type="checkbox" {{if .User.IsActive}}checked{{end}}>
-							</div>
-						</div>
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong>This account is verified</strong> <i class="verified octicon octicon-verified"></i></label>
-								<input name="is_verified" type="checkbox" {{if .User.IsVerified}}checked{{end}}>
-							</div>
-						</div>
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong>This account is maker</strong> <i class="maker octicon octicon-paintcan"></i></label>
-								<input name="is_maker" type="checkbox" {{if .User.IsMaker}}checked{{end}}>
-							</div>
-						</div>
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong>This account is staff</strong> <i class="isstaff octicon octicon-tools"></i></label>
-								<input name="is_staff" type="checkbox" {{if .User.IsStaff}}checked{{end}}>
-							</div>
-						</div>
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong>This account is intern</strong></label>
-								<input name="is_intern" type="checkbox" {{if .User.IsIntern}}checked{{end}}>
-							</div>
-						</div>
-						<div class="field">
-							<input id="recognized" name="recognized" value="{{.User.Recognized}}" placeholder="Recognized As">
-						</div>
-						<div class="field">
-							<input id="certified" name="certified" value="{{.User.Certified}}" placeholder="Date" type="date">
-						</div>
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong>This user is Bug Hunter</strong> <i class="bughunter octicon octicon-gist-secret"></i></label>
-								<input name="is_bug_hunter" type="checkbox" {{if .User.IsBugHunter}}checked{{end}}>
-							</div>
-						</div>
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong>This user is Gitote Developer</strong></label>
-								<input name="gitote_developer" type="checkbox" {{if .User.GitoteDeveloper}}checked{{end}}>
-							</div>
-						</div>
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong>This account is Beta Member</strong> <i class="developer octicon octicon-circuit-board"></i></label>
-								<input name="is_beta" type="checkbox" {{if .User.IsBeta}}checked{{end}}>
-							</div>
-						</div>
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong style="color:red">This account is suspended</strong></label>
-								<input name="suspended" type="checkbox" {{if .User.Suspended}}checked{{end}}>
-							</div>
-						</div>
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong>This account has administrator permissions</strong></label>
-								<input name="admin" type="checkbox" {{if .User.IsAdmin}}checked{{end}}>
-							</div>
-						</div>
-						<div class="inline field">
-							<div class="ui checkbox">
-								<label><strong>This account has permissions to create Git hooks</strong></label>
-								<input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}}>
-							</div>
-						</div>
-						{{if .EnableLocalPathMigration}}
-							<div class="inline field">
-								<div class="ui checkbox">
-									<label><strong>This account has permissions to import local repositories</strong></label>
-									<input name="allow_import_local" type="checkbox" {{if .User.CanImportLocal}}checked{{end}}>
-								</div>
-							</div>
-						{{end}}
-
-						<div class="ui divider"></div>
-
-						<div class="field">
-							<button class="ui green button">Update Account Profile</button>
-							<div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.User.ID}}">Delete This Account</div>
-						</div>
-					</form>
-				</div>
-			</div>
-		</div>
-	</div>
-</div>
-
-<div class="ui small basic delete modal">
-	<div class="ui icon header">
-		<i class="trash icon"></i>
-		Account Deletion
-	</div>
-	<div class="content">
-		<p>This account is going to be deleted permanently, do you want to continue?</p>
-	</div>
-	{{template "base/delete_modal_actions" .}}
-</div>
-{{template "base/footer" .}}

+ 0 - 42
templates/admin/news/list.tmpl

@@ -1,42 +0,0 @@
-{{template "base/head" .}}
-<div class="admin user">
-	<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">
-					News Manage Panel 🌐
-					<div class="ui right">
-						<a class="ui black tiny button" href="{{AppSubURL}}/admin/news/new">Create New News</a>
-					</div>
-				</h4>
-				<div class="ui unstackable attached table segment">
-					<table class="ui unstackable very basic striped table">
-						<thead>
-							<tr>
-								<th>ID</th>
-								<th>Heading</th>
-								<th>Body</th>
-								<th>Edit</th>
-							</tr>
-						</thead>
-						<tbody>
-							{{range .Users}}
-								<tr>
-									<td>{{.ID}}</td>
-									<td><span class="text truncate email">{{.Heading}}</span></td>
-									<td><span class="text truncate email">{{.Body}}</span></td>
-									<td><a href="{{$.Link}}/{{.ID}}">🖊</a></td>
-								</tr>
-							{{end}}
-						</tbody>
-					</table>
-				</div>
-
-				{{template "admin/base/page" .}}
-			</div>
-		</div>
-	</div>
-</div>
-{{template "base/footer" .}}

+ 0 - 37
templates/admin/news/new.tmpl

@@ -1,37 +0,0 @@
-{{template "base/head" .}}
-<div class="admin new user">
-	<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">
-					Create New Account ➕
-				</h4>
-				<div class="ui attached segment">
-					<form class="ui form" action="{{.Link}}" method="post">
-						{{.CSRFTokenHTML}}
-						<!-- Types and name -->
-						<div class="required field">
-							<label for="">Image URL</label>
-							<input type="url" id="" name="" value="" autofocus required>
-						</div>
-						<div class="required field">
-							<label for="">Heading</label>
-							<input id="" name="" value="" autofocus required>
-						</div>
-						<div class="required field">
-							<label for="">Body</label>
-							<textarea id="" name="" rows="2"></textarea>
-						</div>
-
-						<div class="field">
-							<button class="ui green button">Create New News</button>
-						</div>
-					</form>
-				</div>
-			</div>
-		</div>
-	</div>
-</div>
-{{template "base/footer" .}}