Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Merge branch 'master' into master

Cette révision appartient à :
akuma06 2017-05-06 22:17:13 +02:00 révisé par GitHub
révision 220dcaa361
4 fichiers modifiés avec 20 ajouts et 6 suppressions

7
model/status.go Fichier normal
Voir le fichier

@ -0,0 +1,7 @@
package model
//user status e.g. verified, filtered, etc
type Status struct {
Id int `json:"id"`
Name string `json:"name",sql:"size:255"`
}

Voir le fichier

@ -36,6 +36,8 @@ type User struct {
LastLoginIp string `json:"lastLoginIp",sql:"size:100"` LastLoginIp string `json:"lastLoginIp",sql:"size:100"`
CurrentLoginIp string `json:"currentLoginIp",sql:"size:100"` CurrentLoginIp string `json:"currentLoginIp",sql:"size:100"`
Status Status `gorm:"many2one:users_status;"`
// Liking // Liking
LikingCount int `json:"likingCount"` LikingCount int `json:"likingCount"`
LikedCount int `json:"likedCount"` LikedCount int `json:"likedCount"`
@ -43,6 +45,7 @@ type User struct {
Liked []User `gorm:"foreignkey:follower_id;associationforeignkey:userId;many2many:users_followers;"` Liked []User `gorm:"foreignkey:follower_id;associationforeignkey:userId;many2many:users_followers;"`
Connections []Connection Connections []Connection
Languages []Language `gorm:"many2many:user_languages;"` // Many To Many, user_languages is the join table Languages []Language `gorm:"many2many:user_languages;"` // Many To Many, user_languages is the join table
Roles []Role `gorm:"many2many:users_roles;"` // Many To Many, users_roles Roles []Role `gorm:"many2many:users_roles;"` // Many To Many, users_roles
Torrents []Torrents Torrents []Torrents
@ -79,7 +82,7 @@ type PublicUser struct {
Connections omit `json:"connections,omitempty"` Connections omit `json:"connections,omitempty"`
Languages omit `json:"languages,omitempty"` Languages omit `json:"languages,omitempty"`
Roles omit `json:"roles,omitempty"` Roles omit `json:"roles,omitempty"`
Torrents omit `json:"articles,omitempty"` Torrents omit `json:"articles,omitempty"` //should user torrents not be displayed?
} }
// Connection is a connection model for oauth. // Connection is a connection model for oauth.

Voir le fichier

@ -38,6 +38,7 @@
<option value="torrent_name" {{if eq .Search.Sort "torrent_name"}}selected{{end}}>Name</option> <option value="torrent_name" {{if eq .Search.Sort "torrent_name"}}selected{{end}}>Name</option>
<option value="date" {{if eq .Search.Sort "date"}}selected{{end}}>Date</option> <option value="date" {{if eq .Search.Sort "date"}}selected{{end}}>Date</option>
<option value="downloads" {{if eq .Search.Sort "downloads"}}selected{{end}}>Downloads</option> <option value="downloads" {{if eq .Search.Sort "downloads"}}selected{{end}}>Downloads</option>
<option value="filesize" {{if eq .Search.Sort "filesize"}}selected{{end}}>Size</option>
</select> </select>
<select name="order" class="form-control input-sm"> <select name="order" class="form-control input-sm">
<option value="desc" {{if eq .Search.Order "desc"}}selected{{end}}>Descending</option> <option value="desc" {{if eq .Search.Order "desc"}}selected{{end}}>Descending</option>

Voir le fichier

@ -7,7 +7,10 @@ import (
func FormatFilesize(bytes int64) string { func FormatFilesize(bytes int64) string {
var unit string var unit string
var value float64 var value float64
if bytes > 1024*1024*1024 { if bytes > 1024*1024*1024*1024 {
unit = "TiB"
value = float64(bytes) / (1024*1024*1024*1024)
} else if bytes > 1024*1024*1024 {
unit = "GiB" unit = "GiB"
value = float64(bytes) / (1024*1024*1024) value = float64(bytes) / (1024*1024*1024)
} else if bytes > 1024*1024 { } else if bytes > 1024*1024 {