more minor fix on 1581

This commit is contained in:
Unknwon 2015-09-10 15:45:03 -04:00
parent 26ac016b9f
commit fa728d8dff
9 changed files with 70 additions and 70 deletions

View file

@ -14,7 +14,7 @@ version = Version
page = Page page = Page
template = Template template = Template
language = Language language = Language
create_new = Create new... create_new = Create...
user_profile_and_more = User profile and more user_profile_and_more = User profile and more
signed_in_as = Signed in as signed_in_as = Signed in as
@ -718,6 +718,7 @@ notices = System Notices
monitor = Monitoring monitor = Monitoring
prev = Prev. prev = Prev.
next = Next next = Next
total = Total: %d
dashboard.statistic = Statistic dashboard.statistic = Statistic
dashboard.operations = Operations dashboard.operations = Operations
@ -804,7 +805,7 @@ repos.stars = Stars
repos.issues = Issues repos.issues = Issues
auths.auth_manage_panel = Authentication Manage Panel auths.auth_manage_panel = Authentication Manage Panel
auths.new = Add New Authentication Source auths.new = Add New Source
auths.name = Name auths.name = Name
auths.type = Type auths.type = Type
auths.enabled = Enabled auths.enabled = Enabled

View file

@ -134,6 +134,12 @@ func (source *LoginSource) PAM() *PAMConfig {
return source.Cfg.(*PAMConfig) return source.Cfg.(*PAMConfig)
} }
// CountLoginSources returns number of login sources.
func CountLoginSources() int64 {
count, _ := x.Count(new(LoginSource))
return count
}
func CreateSource(source *LoginSource) error { func CreateSource(source *LoginSource) error {
_, err := x.Insert(source) _, err := x.Insert(source)
return err return err

View file

@ -237,7 +237,7 @@ func GetStatistic() (stats Statistic) {
stats.Counter.Follow, _ = x.Count(new(Follow)) stats.Counter.Follow, _ = x.Count(new(Follow))
stats.Counter.Mirror, _ = x.Count(new(Mirror)) stats.Counter.Mirror, _ = x.Count(new(Mirror))
stats.Counter.Release, _ = x.Count(new(Release)) stats.Counter.Release, _ = x.Count(new(Release))
stats.Counter.LoginSource, _ = x.Count(new(LoginSource)) stats.Counter.LoginSource = CountLoginSources()
stats.Counter.Webhook, _ = x.Count(new(Webhook)) stats.Counter.Webhook, _ = x.Count(new(Webhook))
stats.Counter.Milestone, _ = x.Count(new(Milestone)) stats.Counter.Milestone, _ = x.Count(new(Milestone))
stats.Counter.Label, _ = x.Count(new(Label)) stats.Counter.Label, _ = x.Count(new(Label))

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -15,4 +15,8 @@
} }
} }
} }
.ui.header,
.ui.segment {
box-shadow: 0 1px 2px 0 rgba(34,36,38,.15);
}
} }

View file

@ -34,6 +34,8 @@ func Authentications(ctx *middleware.Context) {
ctx.Handle(500, "GetAuths", err) ctx.Handle(500, "GetAuths", err)
return return
} }
ctx.Data["Total"] = models.CountLoginSources()
ctx.HTML(200, AUTHS) ctx.HTML(200, AUTHS)
} }

View file

@ -30,7 +30,7 @@
<input class="ipt ipt-large ipt-radius {{if .Err_AuthName}}ipt-error{{end}}" id="name" name="name" value="{{.Source.Name}}" required /> <input class="ipt ipt-large ipt-radius {{if .Err_AuthName}}ipt-error{{end}}" id="name" name="name" value="{{.Source.Name}}" required />
</div> </div>
{{if eq $type 2 3}} {{if eq $type 2 5}}
<div class="field"> <div class="field">
<label class="req" for="host">{{.i18n.Tr "admin.auths.host"}}</label> <label class="req" for="host">{{.i18n.Tr "admin.auths.host"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Host}}ipt-error{{end}}" id="host" name="host" value="{{.Source.LDAP.Host}}" required /> <input class="ipt ipt-large ipt-radius {{if .Err_Host}}ipt-error{{end}}" id="host" name="host" value="{{.Source.LDAP.Host}}" required />
@ -57,7 +57,7 @@
<input class="ipt ipt-large ipt-radius {{if .Err_UserBase}}ipt-error{{end}}" id="user_base" name="user_base" value="{{.Source.LDAP.UserBase}}" /> <input class="ipt ipt-large ipt-radius {{if .Err_UserBase}}ipt-error{{end}}" id="user_base" name="user_base" value="{{.Source.LDAP.UserBase}}" />
</div> </div>
{{end}} {{end}}
{{if eq $type 3}} {{if eq $type 5}}
<div class="field"> <div class="field">
<label class="req" for="user_dn">{{.i18n.Tr "admin.auths.user_dn"}}</label> <label class="req" for="user_dn">{{.i18n.Tr "admin.auths.user_dn"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_UserDN}}ipt-error{{end}}" id="user_dn" name="user_dn" value="{{.Source.LDAP.UserDN}}" /> <input class="ipt ipt-large ipt-radius {{if .Err_UserDN}}ipt-error{{end}}" id="user_dn" name="user_dn" value="{{.Source.LDAP.UserDN}}" />
@ -85,7 +85,7 @@
</div> </div>
{{else if eq $type 4}} {{else if eq $type 3}}
<div class="field"> <div class="field">
<label class="req">{{.i18n.Tr "admin.auths.smtp_auth"}}</label> <label class="req">{{.i18n.Tr "admin.auths.smtp_auth"}}</label>
<select name="smtp_auth"> <select name="smtp_auth">
@ -105,7 +105,7 @@
<input class="ipt ipt-large ipt-radius {{if .Err_SmtpPort}}ipt-error{{end}}" id="smtp_port" name="smtp_port" value="{{.Source.SMTP.Port}}" /> <input class="ipt ipt-large ipt-radius {{if .Err_SmtpPort}}ipt-error{{end}}" id="smtp_port" name="smtp_port" value="{{.Source.SMTP.Port}}" />
</div> </div>
{{else if eq $type 5}} {{else if eq $type 4}}
<div class="field"> <div class="field">
<label class="req" for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label> <label class="req" for="pam_service_name">{{.i18n.Tr "admin.auths.pam_service_name"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_PAMServiceName}}ipt-error{{end}}" id="pam_service_name" name="pam_service_name" value="{{.Source.PAM.ServiceName}}" /> <input class="ipt ipt-large ipt-radius {{if .Err_PAMServiceName}}ipt-error{{end}}" id="pam_service_name" name="pam_service_name" value="{{.Source.PAM.ServiceName}}" />
@ -113,7 +113,7 @@
{{end}} {{end}}
<div class="field"> <div class="field">
{{if eq $type 4}} {{if eq $type 3}}
<label></label> <label></label>
<input name="tls" type="checkbox" {{if .Source.SMTP.TLS}}checked{{end}}> <input name="tls" type="checkbox" {{if .Source.SMTP.TLS}}checked{{end}}>
<strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong> <strong>{{.i18n.Tr "admin.auths.enable_tls"}}</strong>

View file

@ -1,24 +1,21 @@
{{template "ng/base/head" .}} {{template "base/head" .}}
{{template "ng/base/header" .}} <div class="admin authentication">
<div id="admin-wrapper"> <div class="ui container">
<div id="setting-wrapper" class="main-wrapper"> <div class="ui grid">
<div id="admin-setting" class="container clear"> {{template "admin/navbar" .}}
{{template "admin/nav" .}} <div class="twelve wide column content">
<div class="grid-4-5 left"> {{template "base/alert" .}}
<div class="setting-content"> <h4 class="ui top attached header">
{{template "ng/base/alert" .}} {{.i18n.Tr "admin.auths.auth_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}})
<div id="setting-content"> <div class="ui right">
<div class="panel panel-radius"> <a class="ui blue tiny button" href="{{AppSubUrl}}/admin/auths/new">{{.i18n.Tr "admin.auths.new"}}</a>
<div class="panel-header">
<strong>{{.i18n.Tr "admin.auths.auth_manage_panel"}}</strong>
</div> </div>
<div class="panel-body admin-panel"> </h4>
<a class="btn-blue btn-medium btn-link btn-radius" href="{{AppSubUrl}}/admin/auths/new">{{.i18n.Tr "admin.auths.new"}}</a> <div class="ui attached table segment">
<div class="admin-table"> <table class="ui very basic striped table">
<table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>Id</th> <th>ID</th>
<th>{{.i18n.Tr "admin.auths.name"}}</th> <th>{{.i18n.Tr "admin.auths.name"}}</th>
<th>{{.i18n.Tr "admin.auths.type"}}</th> <th>{{.i18n.Tr "admin.auths.type"}}</th>
<th>{{.i18n.Tr "admin.auths.enabled"}}</th> <th>{{.i18n.Tr "admin.auths.enabled"}}</th>
@ -34,26 +31,16 @@
<td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{.Name}}</a></td> <td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{.Name}}</a></td>
<td>{{.TypeString}}</td> <td>{{.TypeString}}</td>
<td><i class="fa fa{{if .IsActived}}-check{{end}}-square-o"></i></td> <td><i class="fa fa{{if .IsActived}}-check{{end}}-square-o"></i></td>
<td><span title="{{DateFmtLong .Updated}}">{{DateFmtShort .Updated}}</span></td> <td><span class="poping up" data-content="{{DateFmtLong .Updated}}" data-variation="tiny">{{DateFmtShort .Updated}}</span></td>
<td><span title="{{DateFmtLong .Created}}">{{DateFmtShort .Created}}</span></td> <td><span class="poping up" data-content="{{DateFmtLong .Created}}" data-variation="tiny">{{DateFmtShort .Created}}</span></td>
<td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}"><i class="fa fa-pencil-square-o"></i></a></td> <td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}"><i class="fa fa-pencil-square-o"></i></a></td>
</tr> </tr>
{{end}} {{end}}
</tbody> </tbody>
</table> </table>
{{if or .LastPageNum .NextPageNum}}
<ul class="pagination">
{{if .LastPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/auths?p={{.LastPageNum}}">&laquo; Prev.</a></li>{{end}}
{{if .NextPageNum}}<li><a class="btn btn-medium btn-gray btn-radius" href="{{AppSubUrl}}/admin/auths?p={{.NextPageNum}}">&raquo; Next</a></li>{{end}}
</ul>
{{end}}
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{template "ng/base/footer" .}} {{template "base/footer" .}}