diff --git a/controller/index.go b/controller/index.go index 346829b6c..d70a41319 100644 --- a/controller/index.go +++ b/controller/index.go @@ -15,35 +15,18 @@ import ( ) func ShowIndex(c *gin.Context) { - // remote := context.Remote(c) + db := context.Database(c) user := session.User(c) if user == nil { c.HTML(200, "login.html", gin.H{}) return } - // attempt to get the repository list from the - // cache since the operation is expensive - // v, ok := cache.Get(user.Login) - // if ok { - // c.HTML(200, "repos.html", gin.H{ - // "User": user, - // "Repos": v, - // }) - // return - // } - - // fetch the repmote repos - // repos, err := remote.Repos(user) - // if err != nil { - // c.AbortWithStatus(http.StatusInternalServerError) - // return - // } - // cache.Add(user.Login, repos) + repos, _ := model.GetRepoList(db, user) c.HTML(200, "repos.html", gin.H{ - "User": user, - // "Repos": repos, + "User": user, + "Repos": repos, }) } diff --git a/model/repo.go b/model/repo.go index 36f5c3430..282c59cf7 100644 --- a/model/repo.go +++ b/model/repo.go @@ -112,6 +112,7 @@ WHERE repo_id IN ( FROM builds WHERE build_author = ? ) +ORDER BY repo_full_name ` const repoDeleteStmt = ` diff --git a/static/styles/pages/feed.sass b/static/styles/pages/feed.sass new file mode 100644 index 000000000..8eef63e22 --- /dev/null +++ b/static/styles/pages/feed.sass @@ -0,0 +1,47 @@ +.repo-row + .col-sm-4 + width:100%; + .col-sm-4:last-child .card + border-bottom:none + .card + border: none; + border-bottom: 1px solid #EEE; + border-radius: 0px; + position: relative + display: flex; + text-decoration:none; + .card-block + h3 + font-size: 1.1rem; + color:#2b303b; + .card-text + color: rgba(0,0,0,0.5); + font-size:0.95rem; + margin:0px; + + .btn-group + position: absolute; + top: 15px; + right: 0px; + + .btn-danger + color: #bf616a; + background: #FFF; + border: 1px solid #bf616a; + outline: none; + cursor: pointer; + width: auto; + text-transform: uppercase; + padding: 0px 10px; + border-radius: 2px; + font-size: 11px; + line-height: 30px; + height: auto; + margin-left: 10px; + + .card-header + background: #FFF; + border-bottom: none; + padding-right:0px; + padding-left:0px; + width:45px; \ No newline at end of file diff --git a/static/styles/style.sass b/static/styles/style.sass index 0a55e3e03..079efbcef 100644 --- a/static/styles/style.sass +++ b/static/styles/style.sass @@ -14,6 +14,7 @@ @import pages/user.sass @import pages/repo.sass @import pages/login.sass +@import pages/feed.sass @import header @import search diff --git a/static/styles_gen/style.css b/static/styles_gen/style.css index f1cc91d19..0dcfc78bc 100644 --- a/static/styles_gen/style.css +++ b/static/styles_gen/style.css @@ -273,6 +273,22 @@ body.login div.alert { position: fixed; top: 0px; left: 0px; right: 0px; line-he @keyframes fadein { 0% { opacity: 0; } 100% { opacity: 1; } } +.repo-row .col-sm-4 { width: 100%; } + +.repo-row .col-sm-4:last-child .card { border-bottom: none; } + +.repo-row .card { border: none; border-bottom: 1px solid #EEE; border-radius: 0px; position: relative; display: flex; text-decoration: none; } + +.repo-row .card-block h3 { font-size: 1.1rem; color: #2b303b; } + +.repo-row .card-block .card-text { color: rgba(0, 0, 0, 0.5); font-size: 0.95rem; margin: 0px; } + +.repo-row .card-block .btn-group { position: absolute; top: 15px; right: 0px; } + +.repo-row .card-block .btn-group .btn-danger { color: #bf616a; background: #FFF; border: 1px solid #bf616a; outline: none; cursor: pointer; width: auto; text-transform: uppercase; padding: 0px 10px; border-radius: 2px; font-size: 11px; line-height: 30px; height: auto; margin-left: 10px; } + +.repo-row .card-header { background: #FFF; border-bottom: none; padding-right: 0px; padding-left: 0px; width: 45px; } + .tt-open { position: absolute; top: 34px; left: 0px; z-index: 100; display: none; background: #FFF; min-width: 100%; border: 1px solid #eee; border-radius: 0px; } .tt-selectable:hover, .tt-cursor { background: #f4f4f4; } diff --git a/template/amber/repos.amber b/template/amber/repos.amber index 6f8085926..b23b5fc0b 100644 --- a/template/amber/repos.amber +++ b/template/amber/repos.amber @@ -3,11 +3,21 @@ extends base block append head title Dashboard +block header + ol + li Dashboard + block content div.container - div.alert.alert-info - | We haven't decided what to put on the main screen yet. This will - | be decided before we snapshot a beta release. In the mean time, - | use the search box to find a repository. Make sure you type the - | fully qualified repository name (ie owner/name) + if len(Repos) == 0 + div.alert.alert-info + | Your repository list is empty. + div.row.repo-row + each $repo in Repos + div.col-sm-4 + a.card[href="/"+$repo.FullName] + div.card-header + img.avatar[src=$repo.Avatar] + div.card-block + h3.login #{$repo.Name} \ No newline at end of file