#93 mod-dashboard

Merged
lewis merged 17 commits from mod-dashboard into develop 2 years ago
  1. +2
    -1
      options/locale/locale_en-US.ini
  2. +2
    -1
      options/locale/locale_zh-CN.ini
  3. +8
    -8
      routers/user/home.go
  4. +10
    -1
      routers/user/profile.go
  5. +2
    -6
      templates/base/head_navbar.tmpl
  6. +0
    -0
      templates/explore/repo_list.tmpl
  7. +131
    -0
      templates/user/dashboard/repo_list_dashboard.tmpl
  8. +8
    -3
      templates/user/profile.tmpl

+ 2
- 1
options/locale/locale_en-US.ini View File

@@ -391,7 +391,8 @@ follow = Follow
unfollow = Unfollow
heatmap.loading = Loading Heatmap…
user_bio = Biography

own = Own
all = All
form.name_reserved = The username '%s' is reserved.
form.name_pattern_not_allowed = The pattern '%s' is not allowed in a username.
form.name_chars_not_allowed = User name '%s' contains invalid characters.


+ 2
- 1
options/locale/locale_zh-CN.ini View File

@@ -391,7 +391,8 @@ follow=关注
unfollow=取消关注
heatmap.loading=正在加载热图...
user_bio=简历

own = 个人
all = 所有
form.name_reserved='%s' 用户名被保留。
form.name_pattern_not_allowed=用户名中不允许使用 "%s"。
form.name_chars_not_allowed=用户名 '%s' 包含无效字符。


+ 8
- 8
routers/user/home.go View File

@@ -145,18 +145,18 @@ func Dashboard(ctx *context.Context) {
ctx.Data["MirrorCount"] = len(mirrors)
ctx.Data["Mirrors"] = mirrors

retrieveFeeds(ctx, models.GetFeedsOptions{
RequestedUser: ctxUser,
Actor: ctx.User,
IncludePrivate: true,
OnlyPerformedBy: false,
IncludeDeleted: false,
})
//retrieveFeeds(ctx, models.GetFeedsOptions{
// RequestedUser: ctxUser,
// Actor: ctx.User,
// IncludePrivate: true,
// OnlyPerformedBy: false,
// IncludeDeleted: false,
//})

if ctx.Written() {
return
}
ctx.HTML(200, tplDashboard)
//ctx.HTML(200, tplDashboard)
}

// Milestones render the user milestones page


+ 10
- 1
routers/user/profile.go View File

@@ -178,10 +178,17 @@ func Profile(ctx *context.Context) {

total = ctxUser.NumFollowing
case "activity":
typeQuery := ctx.Query("type")
ctx.Data["ActTabName"] = typeQuery
onlyPerformedBy := true
if typeQuery == "all" {
onlyPerformedBy = false
}
retrieveFeeds(ctx, models.GetFeedsOptions{RequestedUser: ctxUser,
Actor: ctx.User,
IncludePrivate: showPrivate,
OnlyPerformedBy: true,
OnlyPerformedBy: onlyPerformedBy,
IncludeDeleted: false,
})
if ctx.Written() {
@@ -261,6 +268,8 @@ func Profile(ctx *context.Context) {

ctx.Data["ShowUserEmail"] = len(ctxUser.Email) > 0 && ctx.IsSigned && (!ctxUser.KeepEmailPrivate || ctxUser.ID == ctx.User.ID)

Dashboard(ctx)

ctx.HTML(200, tplProfile)
}



+ 2
- 6
templates/base/head_navbar.tmpl View File

@@ -9,7 +9,7 @@
</div>

{{if .IsSigned}}
<a class="item {{if .PageIsDashboard}}active{{end}}" href="/dashboard">{{.i18n.Tr "dashboard"}}</a>
<a class="item {{if .PageIsDashboard}}active{{end}}" href="{{AppSubUrl}}/{{.SignedUser.Name}}">{{.i18n.Tr "dashboard"}}</a>
<a class="item" href="{{AppSubUrl}}/OpenI">{{.i18n.Tr "custom.head.openi"}}</a>
{{if not .UnitIssuesGlobalDisabled}}
<a class="item {{if .PageIsIssues}}active{{end}}" href="{{AppSubUrl}}/issues">{{.i18n.Tr "issues"}}</a>
@@ -109,13 +109,9 @@
</div>

<div class="divider"></div>
<a class="item" href="{{AppSubUrl}}/dashboard">
{{svg "octicon-info" 16}}
{{.i18n.Tr "your_dashboard"}}<!-- Your dashboard -->
</a>
<a class="item" href="{{AppSubUrl}}/{{.SignedUser.Name}}">
{{svg "octicon-person" 16}}
{{.i18n.Tr "your_profile"}}<!-- Your profile -->
{{.i18n.Tr "your_dashboard"}}<!-- Your profile -->
</a>
<a class="item" href="{{AppSubUrl}}/{{.SignedUser.Name}}?tab=stars">
{{svg "octicon-star" 16}}


+ 0
- 0
templates/explore/repo_list.tmpl View File


+ 131
- 0
templates/user/dashboard/repo_list_dashboard.tmpl View File

@@ -0,0 +1,131 @@
<h2 class="ui left floated medium header">
{{.i18n.Tr "explore.repos"}}
</h2>
<div class="ui clearing divider"></div>
<div id="app" class="six wide column">
<repo-search
:search-limit="searchLimit"
:suburl="suburl"
:uid="uid"
:more-repos-link="'{{.ContextUser.HomeLink}}'"
{{if not .ContextUser.IsOrganization}}
:organizations="[
{{range .ContextUser.Orgs}}
{name: '{{.Name}}', num_repos: '{{.NumRepos}}'},
{{end}}
]"
:is-organization="false"
:organizations-total-count="{{.ContextUser.GetOrganizationCount}}"
:can-create-organization="{{.SignedUser.CanCreateOrganization}}"
{{end}}
inline-template
v-cloak
>
<div>
<div v-show="tab === 'repos'" class="ui tab active list dashboard-repos">
<div class="ui attached secondary segment repos-search">
<div class="ui fluid right action left icon input" :class="{loading: isLoading}">
<input @input="searchRepos(reposFilter)" v-model="searchQuery" ref="search" placeholder="{{.i18n.Tr "home.search_repos"}}">
<i class="search icon"></i>
<div class="ui dropdown button" title="{{.i18n.Tr "home.filter"}}">
<i class="icon filter"></i>
<div class="menu">
<div class="item">
<a @click="toggleArchivedFilter()">
<div class="ui checkbox" id="archivedFilterCheckbox" title="{{.i18n.Tr "home.show_both_archived_unarchived"}}" v-if="archivedFilter === 'both'">
<input type="checkbox">
<label><i class="archive icon archived-icon"></i>{{.i18n.Tr "home.show_archived"}}</label>
</div>
<div class="ui checkbox" id="archivedFilterCheckbox" title="{{.i18n.Tr "home.show_only_unarchived"}}" v-if="archivedFilter === 'unarchived'">
<input type="checkbox">
<label><i class="archive icon archived-icon"></i>{{.i18n.Tr "home.show_archived"}}</label>
</div>
<div class="ui checkbox" id="archivedFilterCheckbox" title="{{.i18n.Tr "home.show_only_archived"}}" v-if="archivedFilter === 'archived'">
<input type="checkbox">
<label><i class="archive icon archived-icon"></i>{{.i18n.Tr "home.show_archived"}}</label>
</div>
</a>
</div>
<div class="item">
<a @click="togglePrivateFilter()">
<div class="ui checkbox" id="privateFilterCheckbox" title="{{.i18n.Tr "home.show_both_private_public"}}" v-if="privateFilter === 'both'">
<input type="checkbox">
<label><svg class="svg octicon-lock" width="16" height="16" aria-hidden="true"><use xlink:href="#octicon-lock" /></svg>{{.i18n.Tr "home.show_private"}}</label>
</div>
<div class="ui checkbox" id="privateFilterCheckbox" title="{{.i18n.Tr "home.show_only_public"}}" v-if="privateFilter === 'public'">
<input type="checkbox">
<label><svg class="svg octicon-lock" width="16" height="16" aria-hidden="true"><use xlink:href="#octicon-lock" /></svg>{{.i18n.Tr "home.show_private"}}</label>
</div>
<div class="ui checkbox" id="privateFilterCheckbox" title="{{.i18n.Tr "home.show_only_private"}}" v-if="privateFilter === 'private'">
<input type="checkbox">
<label><svg class="svg octicon-lock" width="16" height="16" aria-hidden="true"><use xlink:href="#octicon-lock" /></svg>{{.i18n.Tr "home.show_private"}}</label>
</div>
</a>
</div>
</div>
</div>
</div>
<div class="ui secondary pointing borderless menu center aligned grid repos-filter">
<a class="item" :class="{active: reposFilter === 'all'}" @click="changeReposFilter('all')">
{{.i18n.Tr "all"}}
<div v-show="reposFilter === 'all'" class="ui circular mini grey label">${repoTypeCount}</div>
</a>
<a class="item" :class="{active: reposFilter === 'sources'}" @click="changeReposFilter('sources')">
{{.i18n.Tr "sources"}}
<div v-show="reposFilter === 'sources'" class="ui circular mini grey label">${repoTypeCount}</div>
</a>
<a class="item" :class="{active: reposFilter === 'forks'}" @click="changeReposFilter('forks')">
{{.i18n.Tr "forks"}}
<div v-show="reposFilter === 'forks'" class="ui circular mini grey label">${repoTypeCount}</div>
</a>
<a class="item" :class="{active: reposFilter === 'mirrors'}" @click="changeReposFilter('mirrors')">
{{.i18n.Tr "mirrors"}}
<div v-show="reposFilter === 'mirrors'" class="ui circular mini grey label">${repoTypeCount}</div>
</a>
<a class="item" :class="{active: reposFilter === 'collaborative'}" @click="changeReposFilter('collaborative')">
{{.i18n.Tr "collaborative"}}
<div v-show="reposFilter === 'collaborative'" class="ui circular mini grey label">${repoTypeCount}</div>
</a>
</div>
</div>
<div class="ui attached table segment">
<ul class="repo-owner-name-list">
<li v-for="repo in repos" :class="{'private': repo.private}" v-show="showRepo(repo)">
<a :href="suburl + '/' + repo.full_name">
<svg :class="'svg ' + repoClass(repo)" width="16" height="16" aria-hidden="true"><use :xlink:href="'#' + repoClass(repo)" /></svg>
<strong class="text truncate item-name">${repo.full_name}</strong>
<i v-if="repo.archived" class="archive icon archived-icon"></i>
<span class="ui right text light grey">
${repo.stars_count} <span class="rear">{{svg "octicon-star" 16}}</span>
</span>
</a>
</li>
<li v-if="showMoreReposLink">
<div class="center">
<div class="ui borderless pagination menu narrow">
<a class="item navigation" :class="{'disabled': page === 1}"
@click="changePage(1)" title="{{$.i18n.Tr "admin.first_page"}}">
<i class="angle double left icon"></i>
</a>
<a class="item navigation" :class="{'disabled': page === 1}"
@click="changePage(page - 1)" title="{{$.i18n.Tr "repo.issues.previous"}}">
<i class="left arrow icon"></i>
</a>
<a class="active item">${page}</a>
<a class="item navigation" :class="{'disabled': page === finalPage}"
@click="changePage(page + 1)" title="{{$.i18n.Tr "repo.issues.next"}}">
<i class="icon right arrow"></i>
</a>
<a class="item navigation" :class="{'disabled': page === finalPage}"
@click="changePage(finalPage)" title="{{$.i18n.Tr "admin.last_page"}}">
<i class="angle double right icon"></i>
</a>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</repo-search>
</div>

+ 8
- 3
templates/user/profile.tmpl View File

@@ -89,7 +89,7 @@
<a class='{{if eq .TabName "datasets"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=datasets">
{{svg "octicon-inbox" 16}} {{.i18n.Tr "user.datasets"}}
</a>
<a class='{{if eq .TabName "activity"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity">
<a class='{{if eq .TabName "activity"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity&type=own">
{{svg "octicon-rss" 16}} {{.i18n.Tr "user.activity"}}
</a>
<a class='{{if eq .TabName "stars"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=stars">
@@ -117,6 +117,12 @@
</div>
<div class="ui divider"></div>
{{end}}
<div class="ui secondary stackable pointing menu">
<a class='{{if eq .ActTabName "own"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity&type=own">
{{svg "octicon-person" 16}} {{.i18n.Tr "user.own"}}</a>
<a class='{{if eq .ActTabName "all"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity&type=all">
{{svg "octicon-organization" 16}} {{.i18n.Tr "user.all"}}</a>
</div>
<div class="feeds">
{{template "user/dashboard/feeds" .}}
</div>
@@ -135,8 +141,7 @@
{{template "explore/dataset_list" .}}
{{template "base/paginate" .}}
{{else}}
{{template "explore/repo_search" .}}
{{template "explore/repo_list" .}}
{{template "user/dashboard/repo_list_dashboard" .}}
{{template "base/paginate" .}}
{{end}}
</div>


Loading…
Cancel
Save